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

Q34 · 9618/22/M/J/21 Q7

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

Q349618/22/M/J/21original Q7Structured · 5 marks
Question 7 from 9618/22/M/J/21

Worked solution

(a)

Black-box testing uses inputs and expected outputs only. One test string should show every requirement, so it needs a space before the first word, a space after the last word, several spaces between words, and capital letters. For example:

∇∇Hello∇∇∇World∇

The string must have all four of these features: at least one leading space, at least one trailing space, multiple spaces between two words and at least one upper case letter.

At least one feature present [1]

Three features present [1]

All four features present [1]

(b)

Any two of these ways of finding where the assignment is missed:

Dry run the code with a trace table, or walk through it, to see when the assignment line is skipped [1]

Use a breakpoint (or single-step and watch variables) to see whether FString is set; or add output statements to track the code; or try different test strings to find which ones fail [1]

KEY IDEAA good black-box test string contains every special case at once, and a missed assignment is found by tracing or stepping through the code.
TOTAL 5 marks

Official mark scheme

Mark scheme for 9618/22/M/J/21 question 7
VIDEO
▶ Whole paper

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