9618/21/O/N/23 question 5: worked solution (October/November 2023, paper 21)

Show as 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. Q46 9618/21/O/N/23 original Q5 Structured · 7 marks 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 IDEA A 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 VIDEO ▶ Starts at Q5 (28:29) Starts at Q5 (28:29) · by Pseudocode Pro. Tap the picture to open it on YouTube.