Use the BASIC program below to answer questions 23 to 25 10 LET K = 2 20 LET L = 9 30 LET SUM = 0 40 FOR J = K TO STEP 2 50 SUM = SUM + J\(^2\) 60 PRINT "AN...

Nyocha: WAEC SSCE - Computer Studies - 2016 (Objective) Ihe Ọmụmụ: Computer Studies

Ajụjụ 1 Ripọtì

Use the BASIC program below to answer questions 23 to 25

10 LET K = 2

20 LET L = 9

30 LET SUM = 0

 40 FOR J = K TO STEP 2

50 SUM = SUM + J\(^2\)

60 PRINT "ANSWER =", SUM

70 NEXT J

80 END

How many times will the statement lines 50 and 60 be repeated? 

Akọwa Nkọwa
The statement in line 40 sets up a loop that will run from the value of K to a final value (not specified in the program). The "STEP 2" in line 40 indicates that the loop variable J will be incremented by 2 at each iteration. Since K is initialized to 2 in line 10, the loop will start with J = 2. The final value of J is not specified in the program, but we can see that the loop will continue as long as J is less than or equal to L (which is initialized to 9 in line 20). Therefore, the values of J that will be used in the loop are 2, 4, 6, 8. This means that the statements in lines 50 and 60 will be repeated 4 times. So the answer is (C) 4.

Budata Ngwa Ahụ Na Google Playstore

Ihe nile ichoro iji nwee ihe ịga nke ọma na JAMB, WAEC & NECO.

Green Bridge CBT Mobile App
Onye Enyemaka Nkata AI Nke Ọmụmụ Ihe Ahaziri Maka Gị
Ajụjụ ule IGCSE, JAMB, WAEC na NECO karịrị 200,000
Ihe karịrị 1200 Nkọwa Nkuzi
Nkwado Na-enweghị Ịntanetị - Mụọ Ihe Mgbe Ọ Bụla, Ebe Ọ Bụla
Jadawalin Gada Kore
Akọkọ akọle iwe & Ibeere agbara
Sọfụma Ọrụ Gi & Ọganihu Gi
Nkọwa Miri Emi Maka Ọmụmụ Ihe Zuru Ezu