Edge Races classify races as ‘beginner’, ‘intermediate’ or ‘advanced’ based on the total distance of the race. The program displays the classification after calculating the total distance.
…
Line 25 <calculate the total distance for the race>
Line 26 IF totalDistance < 25 THEN
Line 27 SET race TO "beginner"
Line 28 END IF
Line 29 IF totalDistance >= 25 OR totalDistance <=100 THEN
Line 30 SET race TO "intermediate"
Line 31 END IF
Line 32 IF totalDistance > 100 THEN
Line 33 SET race TO "advanced"
Line 34 END IF
Line 35 SEND race TO DISPLAY
…
(i) When tested the code produced an unexpected result.
Identify the type of error in the code above.
[1]
(ii) The code above is inefficient.
Using a programming language of your choice, re‑write lines 26 to 34 to make this more efficient.
[2]