Section 1: Software design and development, and Computer systems
Edge Races are developing a program to process information on races with multiple stages.
The first race has four stages as shown below.
The design for part of the program is shown below.
6.1 Loop 4 times
6.2 Get valid distance for stage
2.1 start fixed loop 12 times
2.2 add calories[index] to total
2.3 add 1 to index
2.4 end fixed loop
2.5 avgCalories = total / 12
Missing image: past-papers/generated/past-papers/generated/past-papers/generated/pdf-extraction/pdf-and-completed-extraction-files/2025/04-images/02-answers/q11-flowchart.svg
Missing image: past-papers/generated/past-papers/generated/past-papers/generated/pdf-extraction/pdf-and-completed-extraction-files/2025/04-images/02-answers/q11-sructure-diagram.svg
(a) The distance of a stage can range from 5 to 75 km.
(i) Using a design technique of your choice, refine step 6.2 to check the user enters a valid distance.
4 marks
(ii) Test data is used to ensure the distance entered is valid.
State the type of test in the table below.
| Type of test | Input | Expected results |
|---|---|---|
| 67.6 | Program continues | |
| 3.7 | Program displays an error message |
2 marks
(b) The following lines of code are written to input the distance for each stage of ‘Race one’.
…
Line 6 FOR stage FROM 0 TO 3 DO
Line 7 RECEIVE distance FROM KEYBOARD
…
Changes should be made to the code above to ensure that any number of stages could be processed.
Describe two changes that would be required.
2 marks
(c) 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
…
2 marks
(i) When tested the code produced an unexpected result.
Identify the type of error in the code above.
1 mark
(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 marks
(d) During execution the code is translated.
State the type of translator that has been used.
1 mark
(e) The average stage distance for each race is calculated and stored in the variable avgDistance.
(i) Using a programming language of your choice, write the code to store the average to 1 decimal place.
2 marks
(ii) The average stage distance should be displayed, as shown below for ‘Race one’.
Using a programming language of your choice and the variable avgDistance, write the code to produce the output above.
2 marks
