Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 7 of 8.
Write three of these errors with their corrections:
Error 1: line 02. Change to DECLARE DenaryNumber : INTEGER (CHAR cannot be used with MOD and DIV) [1]
Error 2: line 05. Change to FOR Count ← 8 TO 1 STEP -1 (8 bits are needed) [1]
Error 3: line 06. Change to BinaryArray[Count] ← MOD(DenaryNumber, 2) (binary uses base 2) [1]
Write any one of: iteration (the FOR loop), input, output. [1]
Write: range check [1]
Repeat the input until the number is between 1 and 255.
REPEAT
INPUT DenaryNumber
UNTIL DenaryNumber >= 1 AND DenaryNumber <= 255A suitable loop [1]
A suitable condition checking both limits [1]
DenaryNumber input inside the loop [1]
▶ Topic lesson
A lesson on this topic · by Mr Bulmer's Learning Zone. 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.