2023 Home

Question 7

Section 1: Software design and development, and Computer systems

Curling is a sport where stones are thrown down a lane of ice towards a target. In the example below, stone B is closest to the middle of the target and is the winner.

page6 img0

A computer program calculates the distance of each stone from the middle of the target. The code below has been written to identify the winning stone but produces the wrong output.

…
Line 20 IF stone_A_distance < stone_B_distance THEN
Line 21     SEND "Stone B is the winner." TO DISPLAY
Line 22 ELSE
Line 23     SEND "Stone A is the winner." TO DISPLAY
Line 24 END IF
…

(a) State the type of error in the code above and how it can be corrected.

Type of error
Correction

2 marks


(b) State the part of the processor used to compare stone_A_distance to stone_B_distance.

1 mark