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

Q46 · 9618/21/O/N/23 Q5

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

Q469618/21/O/N/23original Q5Structured · 7 marks
Question 5 from 9618/21/O/N/23

Worked solution

(a)

Find the three wrong operators and write the correction:

Num > Min should be Num < Min (to find the smallest) [1]

Count & 1 should be Count + 1 (add, not join) [1]

UNTIL NextInput ← "END" should be UNTIL NextInput = "END" (compare, not assign) [1]

(b)(i)

Min starts at 999, so a number is only stored if it is below 999.

The problem is when all the numbers input are greater than 999, or there are no numbers at all [1]

Then the output minimum is wrongly 999 and not one of the input values [1]

(b)(ii)

Use a mix of words and numbers where every number is bigger than 999, ending with END.

Write for example: 1325, DOG, 7868, END

A mixture of numeric and non-numeric values with all the numbers greater than 999 [1]

The last value is END [1]

KEY IDEAA starting value like 999 is only safe if every real input is smaller; test data should break that assumption.
TOTAL 7 marks

Official mark scheme

Mark scheme for 9618/21/O/N/23 question 5
VIDEO
▶ Starts at Q5 (28:29)

Starts at Q5 (28:29) · by Pseudocode Pro. 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.