Multiple choice technology mainframe

RESULT = 0 PERFORM VARYING C FROM 1 BY 1 UNTIL C = 6 COMPUTE RESULT = RESULT + 1 END-PERFORM What is the content of RESULT, after completion of above statements?

  1. 4

  2. 5

  3. 6

  4. 1

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The PERFORM VARYING loop iterates with C starting at 1 and incrementing by 1 until C equals 6. Since the condition UNTIL C = 6 is checked before each iteration, the loop runs for C = 1, 2, 3, 4, 5 (5 iterations), and stops when C becomes 6. Therefore RESULT = 5.