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...

Ìdánwò: WAEC SSCE - Computer Studies - 2016 (Objective) Ẹ̀kọ́: Computer Studies

Ibeere 1 Ìròyìn

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? 

Awọn alaye Idahun
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.

Ṣe igbasilẹ ohun elo naa lori Google Playstore

Gbogbo ohun ti o nilo lati ṣe dara julọ ninu JAMB, WAEC ati NECO.

Green Bridge CBT Mobile App
Asiko ẹkọ AI ti ara ẹni Chat Assistant
Ìbéèrè ìdánwò IGCSE, JAMB, WAEC ati NECO tó ju 200,000 lọ
Fiwọn 1200 Awọn akọsilẹ Ẹkọ ju.
Atilẹyin Aisinipo - Kọ ẹkọ Nigbakugba, Nibi gbogbo
Tẹ̀dí Green Bridge
Àkójọpọ̀ Ìtàn Lítíréṣọ̀ & Ìbéèrè Tó Lè Dáyéé ṣẹ́lẹ̀
Tẹle iṣẹ ṣiṣe rẹ ati ilọsiwaju rẹ.
Àlàyé tí ó jinlẹ̀ fún ìmòye tó jinlẹ̀.