2210/23/O/N/25 question 7: worked solution (October/November 2025, paper 23)
Show as plain textHide plain text
Cambridge O Level Computer Science 2210 · 7.8 Identifying and correcting errors in algorithms Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 7 of 8. Q80 2210/23/O/N/25 original Q7 Structured · 8 marks Worked solution (a) 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] (b) Write any one of: iteration (the FOR loop), input , output . [1] (c)(i) Write: range check [1] (c)(ii) Repeat the input until the number is between 1 and 255. REPEAT INPUT DenaryNumber UNTIL DenaryNumber >= 1 AND DenaryNumber <= 255 A suitable loop [1] A suitable condition checking both limits [1] DenaryNumber input inside the loop [1] KEY IDEA A range check keeps asking for input until the value lies between the lower and upper limit. TOTAL 8 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Mr Bulmer's Learning Zone. Tap the picture to open it on YouTube.