Multiple choice technology programming languages

Which of the following PL/I SELECT statements is correct ?

  1. SELECT (A); WHEN (A=0) PUT LIST(‘A = 0‘); WHEN (A=5) PUT LIST (‘A = 5‘); OTHERWISE PUT LIST (‘A IS NOT 0 NOR 5’); END;

  2. SELECT (A); WHEN (0) PUT LIST(‘A = 0‘); WHEN (5) PUT LIST (‘A = 5‘); OTHERWISE PUT LIST (‘A IS NOT 0 NOR 5’); END;

  3. SELECT; WHEN (A=0) PUT LIST(‘A = 0‘); WHEN (5) PUT LIST (‘A = 5‘); OTHERWISE PUT LIST (‘A IS NOT 0 NOR 5’); END;

  4. All of the above

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

Option B is correct because PL/I SELECT statements allow WHEN clauses with simple expressions that evaluate against the selector value. Option A is wrong because WHEN (A=0) is a comparison, not the value itself. Option C is wrong because it omits the selector (A) after SELECT. Option D is wrong since only B is correct.