9618/21/M/J/25 question 2: worked solution (May/June 2025, paper 21)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 12.3 Program Testing and Maintenance Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 3 of 3. Q52 9618/21/M/J/25 original Q2 Structured · 10 marks Worked solution (a)(i) Look at the order of the two decisions. The decision boxes are in the wrong order : a value such as 3000 fails the first test (> 4000) and goes straight to RETURN, so it is never tested against 2000 [1] (a)(ii) Swap them round: Swap the two decision boxes : first test >= 2000, and then test > 4000 for those values [1] (b)(i) Write any one value: 2000 (or 4000, 10, 100) [1] (b)(ii) Any two points: A constant cannot be changed while the program runs, so it cannot be different in two places [1] The value is only written once , so a change needs one edit, and the meaningful name makes the program easier to understand [1] (b)(iii) Library routines are already tried and tested , so they are free of errors (and give code that is hard to write yourself) [1] (c) Two other types of error: Syntax error [1] The rules of the programming language were not followed [1] Run-time error [1] The program tries an illegal operation, such as dividing by zero, while it runs [1] KEY IDEA Order of tests matters in a flowchart, and constants and library routines cut down on mistakes. TOTAL 10 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by Sir Sikandar Raza. Tap the picture to open it on YouTube.