9618/22/M/J/25 question 2: worked solution (May/June 2025, paper 22)
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. Q55 9618/22/M/J/25 original Q2 Structured · 8 marks Worked solution (a) Stepwise refinement means improving a design in stages. It increases the level of detail of the algorithm, breaking the problem into smaller steps [1] It keeps doing this until each step can be directly written as lines of code [1] (b)(i) White-box testing tests different paths through the code, so choose data that sends the program down two different branches. Any two of these four tests score: Hours worked Value of sales Bonus pay between 1 and 40 2000 or less 0 above 40 2000 or less 10 between 1 and 40 above 2000 50 above 40 above 2000 100 Test one: one correct set of hours, sales and bonus pay from the table [1] Test two: a different correct set from the table [1] (b)(ii) Stub testing checks the calling parts of the program before every module exists. Write a simple module (a stub) to replace each unfinished module [1] Each stub returns an expected value or outputs a message to show it has been called [1] (b)(iii) Write the type of error and its description. Type of error: logic error [1] Description: the program does not behave as expected or gives the wrong result because of a fault in the logic of the algorithm [1] Run-time error (the program performs an illegal operation, for example dividing by zero) with that description also scores, but give only one pair. KEY IDEA Stepwise refinement adds detail in stages, white-box tests follow code paths, stubs stand in for unfinished modules and black-box tests find logic and run-time errors. TOTAL 8 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by Awab Aqib. Tap the picture to open it on YouTube.