Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 3 of 3.
Find two syntax errors and one other error:
Syntax error 1: NEXT Index is wrong in a WHILE loop; it should be ENDWHILE [1]
Syntax error 2: & is used to join an integer (Index) to a string in OUTPUT, so Index must be converted or separated with a comma [1]
Other error: the array is accessed outside its range, because Data[0] is used when the first element is index 1 [1]
Statement: OTHERWISE : OUTPUT "Alarm 1201" [1]
Explanation: Index MOD 2 can only give 0 or 1, so this branch can never run [1]
The program compiles, so it has no syntax errors, but it stops responding when it runs.
Write: a run-time error [1]
▶ Starts at Q5 (38:09)
Starts at Q5 (38:09) · by Pseudocode Pro. Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.