Multiple choice technology mainframe

Which of the following COBOL EVALUATE statements in syntactically NOT correct?

  1. EVALUATE A <n> WHEN 0 DISPLAY 'A = 0' <n> WHEN 5 DISPLAY 'A = 5' <n> WHEN OTHER DISPLAY 'A IS NOT 0 NOR 5' <n> END-EVALUATE

  2. EVALUATE TRUE <n> WHEN A=0 DISPLAY 'A = 0' <n> WHEN A=5 DISPLAY 'A = 5' <n> WHEN OTHER DISPLAY 'A IS NOT 0 OR 5' <n> END-EVALUATE

  3. EVALUATE A <n> WHEN A=0 DISPLAY 'A = 0' <n> WHEN A=5 DISPLAY 'A = 5' <n> WHEN OTHER DISPLAY 'A IS NOT 0 NOR 5' <n> END-EVALUATE

  4. none

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

Option C is syntactically incorrect. In COBOL EVALUATE, when you specify a variable after EVALUATE (like 'EVALUATE A'), the WHEN clauses must contain direct values to compare against (like 'WHEN 0' or 'WHEN 5'), not conditional expressions. The form 'WHEN A=0' is only valid when using 'EVALUATE TRUE' (as shown in Option B). Option A correctly uses direct values (WHEN 0, WHEN 5) after EVALUATE A. Option B uses EVALUATE TRUE with conditional WHEN clauses, which is the correct way to use conditions.