Ana loda....

WAEC SSCE - Computer Studies - 2016 (Objective)

Tambaya 1 Rahoto

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

Which of the following best represents the sequence of output from the program?

Which of the following best represents the sequence of output from the program?

Bayanin Amsa
The program is adding 2 to the square of each even number from 2 to 8 and printing the result. The even numbers from 2 to 8 are 2, 4, 6, and 8. The square of each of these numbers are 4, 16, 36, and 64 respectively. Adding 2 to each of these squares gives 6, 18, 38, and 66. Therefore, the program will output: 4, 18, 38, 66. The option that best represents this sequence of output is: 4, 20, 56, 120.