Multiple choice

Directions: Use the following program segment:

IF Time < Best THEN PRINT "NEW WORLD RECORD!" ELSEIF Time < Best + 10 THEN PRINT "GOOD RACE" ELSE PRINT "AVERAGE RACE" END IF

If Time equals 130 and Best equals 120, what is output when this statement is executed?

  1. NEW WORLD RECORD!

  2. GOOD RACE

  3. AVERAGE RACE

  4. Nothing is output

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

When Time=130 and Best=120: First condition (130 < 120) is false. ELSEIF checks (130 < 120+10) = (130 < 130), which is also false (not strictly less than). Thus the ELSE clause executes, printing 'AVERAGE RACE'.