9618/21 · October/November 2025 · Worked solutions

Step-by-step solutions based on the mark scheme (not a mark-scheme dump).

Question 1

Paper page 2 for Q1
Original paper page 2

Part 1(a) — solution

Answer: 4

4 Expression MyString  'X' & MyString MyChar  MID ("ABCD", 1 / 2 / 3 / 4 , 1) MyString  NUM_TO_STR (DAY / MONTH / YEAR / DAYINDEX (MyDOB)) MyInt  INT(LENGTH(MyString) / 2) One mark per row

Mark points

  • Correct result: 4

Part 1(b) — solution

Answer: 3

3 Test description Test method carried out as soon as a program module has been alpha coded carried out as program modules are being integration combined completed by the developers without referring to black-box the code completed by the customer acceptance / beta One mark per row (2 to 4)

Mark points

  • Correct result: 3

Part 1(c) — solution

One mark per point: 3

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Initialisation of variables used as array index and count

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

One mark for TYPE RentalRecord and ENDTYPE statements

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Different data types held (for each rental) under a single identifier

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Declare local variables Index as integer, ThisNum and LastNum as real

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Declare local variables Index as integer, ThisNum and LastNum as real

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

The amount of values stored (in a text file) is not fixed / not limited (other than by secondary storage available) // The amount values stored is not limited to the size of the array

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Function heading, parameters return type and ending

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Function heading, parameters return type and ending

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

  1. [A1] | X1 added on line from S1 to state labelled S2

Mark points

  • [A1] | X1 added on line from S1 to state labelled S2

Part 1 — solution

Store date due back as a new data item / in the loan record

Mark points

  • Include the ideas shown in the solution above.

Question 2

Paper page 4 for Q2
Original paper page 4

Part 2 — solution

Example solution 5 Mark as follows:

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Loop through exactly 30 elements in the array

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

One mark for RentalID and CarID declared correctly

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Allows for iteration through rentals/records // Can access rentals/records in a loop // Can (directly) access a specific rental/record using an (array) index

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

The data is stored permanently / non-volatile // Data can be restored / reused without re-entering values

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Store date of loan and the loan length category as new data items / in the loan record Max 1 New Record

Mark points

  • Include the ideas shown in the solution above.

Question 3

Part 3 — solution

Correct explanation of both e.g. to stop program execution at specific point / line / statement / instruction and to execute one line / statement / instruction at a time to (locate an/the error) One mark for each bulleted point University Press & Assessment 2025 Page 6 of 19 9618/21 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2025

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Test for empty string in current array element // Test for non-empty string

Mark points

  • Include the ideas shown in the solution above.

Part 3(a)(i) — solution

Pseudocode: 4 TYPE RentalRecord DECLARE RentalID : STRING DECLARE CarID : INTEGER DECLARE DisCode : CHAR DECLARE Start : DATE DECLARE Duration : INTEGER DECLARE Completed : BOOLEAN ENDTYPE Mark as follows:

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

One mark for DisCode and Start declared correctly

Mark points

  • Include the ideas shown in the solution above.

Part 3(a)(ii) — solution

DECLARE Rental : ARRAY[1:500] OF RentalRecord 2 One mark per underlined phrase

Mark points

  • Include the ideas shown in the solution above.

Part 3(b) — solution

One mark per point: 3

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Simplifies the code/program / less code needed / reduces code duplication // Makes code/program easier to understand // Makes testing / debugging easier // Program maintenance easier University Press & Assessment 2025 Page 9 of 19 9618/21 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2025

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Attempt at conditional loop including both tests

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Convert Number to a string and loop for length of converted Number

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

  1. [A4] Obtain/use: Line from S2 to S5 with event label

Mark points

  • [A4] Obtain/use: Line from S2 to S5 with event label

Part 3 — solution

Attempt to reference an individual data item in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

New Records with Category (and Loan length field) Change to Program:

Mark points

  • Include the ideas shown in the solution above.

Question 4

Paper page 6 for Q4
Original paper page 6

Part 4 — solution

Increment count if appropriate in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

One mark for Duration and Completed declared correctly

Mark points

  • Include the ideas shown in the solution above.

Part 4(a) — solution

Example solution - conditional: 6 PROCEDURE Store() DECLARE ThisNum, LastNum : REAL DECLARE Index : INTEGER // index to global array INPUT ThisNum LastNum  ThisNum Number[1]  ThisNum INPUT ThisNum Index  2 WHILE Index < 21 AND ThisNum > LastNum Number[Index]  ThisNum LastNum  ThisNum Index  Index + 1 IF Index < 21 THEN INPUT ThisNum ENDIF ENDWHILE OUTPUT Index - 1, " values were stored in the array" ENDPROCEDURE Alternative loop: // Loop without using LastNum WHILE Index < 21 AND ThisNumNum > Number[Index - 1] Number[Index]  ThisNum Index  Index + 1 IF Index < 21 THEN //skip input if array full INPUT ThisNum ENDIF ENDWHILE Mark as follows:

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Completely correct conditional loop including both tests

Mark points

  • Include the ideas shown in the solution above.

Part 4(a) — solution

Alternative FOR loop example solution: PROCEDURE Store() DECLARE ThisNum, LastNum : REAL DECLARE Index : INTEGER // index to global array DECLARE Count : INTEGER INPUT ThisNum LastNum  ThisNum Number[1]  ThisNum Count  1 INPUT ThisNum FOR Index  2 TO 20 IF ThisNum > LastNum THEN Number[Index]  ThisNum LastNum  ThisNum Count  Count + 1 IF Index < 20 THEN INPUT ThisNum ENDIF ELSE BREAK ENDIF NEXT Index OUTPUT Count, " values were stored in the array" ENDPROCEDURE Alternative loop: Count  1 INPUT ThisNum FOR Index  2 TO 20 IF ThisNum > Number[Index - 1] THEN Number[Index]  ThisNum Count  Count + 1 IF Index < 20 THEN INPUT ThisNum ENDIF ELSE BREAK ENDIF NEXT Index Mark as follows:

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Count-controlled loop with BREAK if current value greater than previous value

Mark points

  • Include the ideas shown in the solution above.

Part 4(b)(i) — solution

One mark per point: 2

Mark points

  • Include the ideas shown in the solution above.

Part 4(b)(ii) — solution

Each (real) value would have to be converted to a string 1

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

attempt to use MOD and DIV to sum successive digits in Number

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

  1. Lines from S3 with correct event labels including 'loop' label

Mark points

  • Lines from S3 with correct event labels including 'loop' label

Part 4 — solution

Return value from Modify and parameter to Final

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Test for correct StudentID field in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Correct test for StudentID and correct BookID in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

(Use the loan length category of a book to) calculate the date due date

Mark points

  • Include the ideas shown in the solution above.

Question 5

Paper page 8 for Q5
Original paper page 8

Part 5 — solution

Assign input value to current element if greater than previous element and input next value in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

... Assign input value to current element following correct comparison in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 5(a)(i) — solution

It is a value that is invalid as an (array) index // not in the range of valid 1 (index) values

Mark points

  • Include the ideas shown in the solution above.

Part 5(a)(ii) — solution

To test whether the current element / value at index matches the given / 1 search string / data / parameter

Mark points

  • Include the ideas shown in the solution above.

Part 5(a)(iii) — solution

The value of FoundAt is only updated to the (current) index if it currently 1 stores the initial value / -1 // FoundAt is not updated when it currently stores any other value than -1

Mark points

  • Include the ideas shown in the solution above.

Part 5(b)(i) — solution

The loop continues after the (first instance) of the search value / string / 1 matching element has been found Comparisons/tests continue to be made even if the search value / string / matching element has been found

Mark points

  • Include the ideas shown in the solution above.

Part 5(b)(ii) — solution

One mark per point 2 Construct: A conditional loop Justification: The loop / search can be terminated as soon as the (first occurrence of) SearchString / required value / required string / matching element is found

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

completely correct sum of digits in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

  1. ... and that OnLoan = TRUE in a loop

Mark points

  • ... and that OnLoan = TRUE in a loop

Part 5 — solution

… If book not returned yet, then set OnLoan field to FALSE

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Compare due date with today’s date (to check if overdue / to calculate fine)

Mark points

  • Include the ideas shown in the solution above.

Question 6

Paper page 10 for Q6
Original paper page 10

Part 6 — solution

Final output giving count of elements stored plus message following a reasonable attempt after loop University Press & Assessment 2025 Page 11 of 19 9618/21 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2025

Mark points

  • Include the ideas shown in the solution above.

Part 6(a) — solution

Number: Any number where the first two digits sum to 5 / 15 and the 2 last three digits are 623 Explanation: The remainder is the same / 3 // The sum of the (first four) digits is the same / 13 University Press & Assessment 2025 Page 12 of 19 9618/21 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2025

Mark points

  • Include the ideas shown in the solution above.

Part 6(b) — solution

Example solution – conversion of Number to a string 7 FUNCTION Generate(Number : INTEGER) RETURNS INTEGER DECLARE Total, Index, CheckDigit : INTEGER DECLARE NumString : STRING Total  0 NumString  NUM_TO_STR(Number) FOR Index  1 TO LENGTH(NumString) Total  Total + STR_TO_NUM(MID(NumString, Index, 1)) NEXT Index CheckDigit  Total MOD 10 Number  Number * 10 + CheckDigit // NumString  Numstring & NUM_TO_STR(CheckDigit) RETURN Number // STR_TO_NUM(NumString) ENDFUNCTION Mark as follows:

Mark points

  • Include the ideas shown in the solution above.

Part 6(b) — solution

Example Solution – no conversion to string FUNCTION Generate(Number : INTEGER) RETURNS INTEGER DECLARE Total, CheckDigit, Remainder, Num: INTEGER Num  Number Total  0 WHILE Num > 0 Remainder  Num MOD 10 Num  Num DIV 10 Total  Total + Remainder ENDWHILE CheckDigit  Total MOD 10 Number  Number * 10 + CheckDigit RETURN Number ENDFUNCTION Mark as follows:

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

RETURN TRUE if book loan Found and not already returned

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

Map loan length category to length of loan / date due back Max 1 Max 2 marks University Press & Assessment 2025 Page 19 of 19

Mark points

  • Include the ideas shown in the solution above.

Question 7

Paper page 12 for Q7
Original paper page 12

Part 7 — solution

Add CheckDigit to original number multiplied by 10 and return number // Convert CheckDigit to a character and appended to NumString and then convert to a number and return University Press & Assessment 2025 Page 13 of 19 9618/21 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2025

Mark points

  • Include the ideas shown in the solution above.

Part 7(a) — solution

Answer: 5

5 One mark for each:

Mark points

  • Correct result: 5

Part 7(b) — solution

Answer: 5

5 One mark per point:

Mark points

  • Correct result: 5

Part 7 — solution

RETURN FALSE if book loan Found and loan already returned

Mark points

  • Include the ideas shown in the solution above.

Question 8

Paper page 14 for Q8
Original paper page 14

Part 8(a) — solution

  1. CONSTANT Max = 5
  2. WHILE Index <= 5000 / Index <= 4999 AND Count < Max
  3. IF Loan[Index].StudentID = ThisStudentID AND __
  4. Loan[Index].OnLoan =

Mark points

  • CONSTANT Max = 5
  • WHILE Index <= 5000 / Index <= 4999 AND Count < Max
  • IF Loan[Index].StudentID = ThisStudentID AND __
  • Loan[Index].OnLoan =

Part 8(b) — solution

  1. IF Loan[Index].StudentID = ThisStudentID AND __
  2. Loan[Index].BookID = ThisBookID THEN
  3. IF Loan[Index].OnLoan = TRUE THEN // Not

Mark points

  • IF Loan[Index].StudentID = ThisStudentID AND __
  • Loan[Index].BookID = ThisBookID THEN
  • IF Loan[Index].OnLoan = TRUE THEN // Not

Part 8 — solution

RETURN FALSE if book loan not found Alterantive example solution – not immediate return FUNCTION ReturnBook(ThisStudentID, ThisBookID : STRING) RETURNS BOOLEAN DECLARE Index : INTEGER DECLARE Found, OK : BOOLEAN Index  1 Found  FALSE OK  TRUE University Press & Assessment 2025 Page 18 of 19 9618/21 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2025

Mark points

  • Include the ideas shown in the solution above.

Part 8(b) — solution

  1. IF Loan[Index].StudentID = ThisStudentID AND __
  2. Loan[Index].BookID = ThisBookID THEN
  3. IF Loan[Index].OnLoan = FALSE THEN // Already

Mark points

  • IF Loan[Index].StudentID = ThisStudentID AND __
  • Loan[Index].BookID = ThisBookID THEN
  • IF Loan[Index].OnLoan = FALSE THEN // Already

Part 8(c) — solution

Award marks for reference to following design features: 2 Change to existing Record:

Mark points

  • Include the ideas shown in the solution above.