9618/22/O/N/25 question 2: worked solution (October/November 2025, paper 22)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 9.2 Algorithms Worked solution from the Algorithm Design and Problem-solving Paper 2 Problem-solving and Programming booklet, Part 2 of 2. Q45 9618/22/O/N/25 original Q2 Structured · 5 marks Worked solution Draw a loop that inputs a value, stops on 99.9 or when the array is full: START → Set Index to 1 → Input Num → decision "Is Num = 99.9?" If YES: END. If NO: Set Data[Index] to Num → Set Index to Index + 1 → decision "Is Index = 21?" If YES: END. If NO: back to Input Num. Array index set to 1 before the loop [1] Input a number inside the loop [1] Test for 99.9 with correct ending, before it is stored [1] Test for the array full (Index = 21, or 20 repeats) with correct ending [1] Assign the number to Data[Index] and increase the index [1] One decision "Num = 99.9 or Index = 21" placed straight after the input is also accepted. KEY IDEA Check for the end value straight after input so 99.9 is never stored, and stop after the 20th element. TOTAL 5 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by MAK CS. Tap the picture to open it on YouTube.