Multiple choice technology programming languages

If someone wanted a COBOL perform "loop" to execute once before the condition is checked, which of the following would they do?

  1. Use a standard perform statement

  2. Use an in line perform

  3. Skillful use of the COBOL reserved word "AFTER"

  4. This is not possible in COBOL

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

In COBOL, to execute a PERFORM loop once before the condition is checked, you would use a PERFORM...WITH TEST AFTER clause or construct the loop with the condition checked at the end. However, the question references 'skillful use of the AFTER' clause, which in COBOL's PERFORM VARYING syntax allows you to specify when the condition is evaluated. By placing the condition check appropriately in a PERFORM...UNTIL or PERFORM...VARYING structure, you can ensure the loop body executes at least once before termination conditions are evaluated.