Cambridge AS Level Computer Science 9618 · 12.3 Program Testing and Maintenance

Q55 · 9618/22/M/J/25 Q2

Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 3 of 3.

Q559618/22/M/J/25original Q2Structured · 8 marks
Question 2 from 9618/22/M/J/25

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 workedValue of salesBonus pay
between 1 and 402000 or less0
above 402000 or less10
between 1 and 40above 200050
above 40above 2000100

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 IDEAStepwise 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

Mark scheme for 9618/22/M/J/25 question 2
VIDEO
▶ Whole paper

Video solution of the whole paper · by Awab Aqib. 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.