Multiple choice technology programming languages

The COBOL perform loop is the equivalent of which of the following structures found in other languages, such as Java or C++ ?

  1. For Loop

  2. Do-While Loop

  3. Nested Loop

  4. While Loop

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

The COBOL PERFORM loop with UNTIL condition is equivalent to a Do-While loop in languages like Java or C++. Both execute the loop body at least once before checking the continuation condition. 'PERFORM paragraph-name UNTIL condition' will execute the paragraph first, then test the condition - this is exactly how Do-While works. While loops check condition before execution, and FOR loops are iteration-based with counters.