Multiple choice

In a double-alternative block IF statement, _______.

  1. Both THEN and ELSE clauses may be executed

  2. ELSE clause is always executed

  3. Either THEN or ELSE clause will be executed

  4. THEN clause is always executed

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

In a double-alternative block IF, the condition is evaluated once. If true, the THEN clause executes and the ELSE clause is skipped. If false, the ELSE clause executes and the THEN clause is skipped. Only one of the two clauses ever executes during a single pass through the IF statement - never both, and never neither.