9618/22/O/N/25 question 1: worked solution (October/November 2025, paper 22)

Show as plain text

Cambridge AS Level Computer Science 9618 · 11.1 Programming Basics Worked solution from the Programming Paper 2 Problem-solving and Programming booklet, Part 1 of 3. Q34 9618/22/O/N/25 original Q1 Structured · 11 marks Worked solution (a) Look at each example for IF/CASE (selection), FOR/WHILE (iteration) and CALL or a function call (subroutine): Pseudocode example Selection Iteration Subroutine IF Status = FALSE THEN ... FOR ... CALL Reset(Count) ... NEXT Count ... ENDIF ✓ ✓ ✓ OTHERWISE : Status ← TRUE ✓ WHILE AllDone() = TRUE ✓ ✓ 30 : NextChar ← 'X' ✓ Row 1 correct [1] Row 2 correct [1] Row 3 correct [1] Row 4 correct [1] (b) Variable Example data value Data type Result 5.42 REAL MonthLetter "JFMAMJJASOND" STRING Birthday 15/11/2009 DATE REAL [1] STRING [1] DATE [1] (c) Work each one out: INT(5.42) = 5, and 5 + 1 = 6, which is not greater than 6, so FALSE. LENGTH of the string = 12, so NUM_TO_STR gives "12". Result + "3.2" adds a number to a string, so it is an error. MONTH(Birthday) = 11, and 11 − 2 = 9. The 9th letter is S. Expression Evaluates to INT(Result) + 1 > 6 FALSE NUM_TO_STR(LENGTH(MonthLetter)) "12" NUM_TO_STR(Result + "3.2") ERROR MID(MonthLetter, MONTH(Birthday) − 2, 1) "S" FALSE [1] "12" [1] ERROR [1] "S" [1] KEY IDEA Selection is IF, CASE; iteration is FOR, WHILE, REPEAT; and mixing a number with a string in + is an error. TOTAL 11 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by MAK CS. Tap the picture to open it on YouTube.