Multiple choice technology mainframe

A PL/I programmer wants to repeat an instruction 5 times. How can he/she code this?

  1. REPEAT 5 TIMES;instruction;END;

  2. DO J=1 TO 5;instruction;END;

  3. COUNTER = 1;DO WHILE COUNTER < 5;COUNTER = COUNTER + 1;instruction;END;

  4. REPEAT VARYING COUNTER FROM 1 BY 1 UNTIL COUNTER = 5;instruction;END;

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

PL/I uses the DO loop construct for iteration control. The correct syntax for repeating an instruction 5 times is DO J=1 TO 5; instruction; END; which creates a controlled loop with an index variable. The REPEAT keyword doesn't exist in PL/I, and the WHILE option would require different initialization and would execute only 4 times with < 5 condition.