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

Assessment: WAEC SSCE - Computer Studies - 2016 (Objective) Subject: Computer Studies

Question 1 Report

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? 

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

Download The App On Google Playstore

Everything you need to excel in your exams

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
200,000+ Exam Questions Across IGCSE, JAMB, WAEC & NECO
Over 3,900 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning