9618/22 · May/June 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)(i) — solution

  1. Rapid development of program/prototypes required
  2. Need for prototypes (at an early stage)
  3. Complexity of problem
  4. Skills / experience of development team / programmer(s)
  5. Budget / Time / Resources available
  6. Size of development team
  7. Developer / programmer can return to earlier stages / any stage
  8. Avoidance of repeating previous stages in development of program
  9. How much involvement clients will have
  10. Allows the (program) requirements to be changed during program
  11. (Program) requirements agreed at start of development of program

Mark points

  • Rapid development of program/prototypes required
  • Need for prototypes (at an early stage)
  • Complexity of problem
  • Skills / experience of development team / programmer(s)
  • Budget / Time / Resources available
  • Size of development team
  • Developer / programmer can return to earlier stages / any stage
  • Avoidance of repeating previous stages in development of program
  • How much involvement clients will have
  • Allows the (program) requirements to be changed during program
  • (Program) requirements agreed at start of development of program

Part 1(a)(ii) — solution

Which programming language would best be suited to control the production 1 line // Which programming language would best suit the problem being solved

Mark points

  • Include the ideas shown in the solution above.

Part 1(b)(i) — solution

  1. Change to (production line) requirements
  2. New technology / hardware available (to control production line)
  3. Changes made to library modules used
  4. Change in relevant legislation

Mark points

  • Change to (production line) requirements
  • New technology / hardware available (to control production line)
  • Changes made to library modules used
  • Change in relevant legislation

Part 1(b)(ii) — solution

Perfective // Corrective 1

Mark points

  • Include the ideas shown in the solution above.

Part 1(c) — solution

1 mark for each correct row 4 Expression Data type RIGHT(MachineCode, 4) STRING Speed * 2.5 REAL NOT Status BOOLEAN IS_NUM(Check) BOOLEAN

Mark points

  • Include the ideas shown in the solution above.

Part 1(d)(ii) — solution

Answer: 1000 1

1000 1

Mark points

  • Correct result: 1000 1

Part 1(d)(iii) — solution

DECLARE Product : ARRAY [0:99, 0:9] OF INTEGER 2

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

  1. [0:99, 0:9

Mark points

  • [0:99, 0:9

Part 1 — solution

mark for all other parts of declaration DECLARE Product : ARRAY [0:99, 0:9] OF INTEGER University Press & Assessment 2025 Page 7 of 20 9618/22 Cambridge International AS & A Level – Mark Scheme May/June 2025

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Mark: The three new states drawn and labelled.

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Mark: Two of the events drawn with labels connecting correct states and correct line direction

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Mark: Four of the events drawn with labels connecting correct states and correct line direction.

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Mark: All and only six events drawn with labels connecting correct states and correct line direction. University Press & Assessment 2025 Page 11 of 20 9618/22 Cambridge International AS & A Level – Mark Scheme May/June 2025

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

1018 1 7

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

mark for global array Data row 8 containing the value 1043

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

mark for global array Pointer row 7 containing the value 8 and row 8 containing the value 4

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

mark for each point 1. Converting loyalty points to string and concatenating / joining / append with Customer ID 2. Storing concatenated string in an array of string University Press & Assessment 2025 Page 20 of 20

Mark points

  • Include the ideas shown in the solution above.

Question 2

Paper page 4 for Q2
Original paper page 4

Part 2(a) — solution

Mark as follows: 2 1. To increase the level of detail of the algorithm // To break the problem / task into smaller steps … 2. … until steps can be directly translated into lines of code // from which it can be programmed

Mark points

  • Include the ideas shown in the solution above.

Part 2(b)(i) — solution

  1. Sales value = 2000
  2. Sales value = 2000

Mark points

  • Sales value = 2000
  • Sales value = 2000

Part 2(b)(ii) — solution

  1. Simple modules are written to replace each of the unfinished modules
  2. Each simple module will return an expected value / will output a message

Mark points

  • Simple modules are written to replace each of the unfinished modules
  • Each simple module will return an expected value / will output a message

Part 2(b)(iii) — solution

One mark for naming type of error and one mark for corresponding 2 description Type of error: Logic (error) Description: Where the program does not behave as expected / Does not give expected result / An error in the logic of the algorithm Or Type of error: Run-time (error) Description: The program performs an illegal operation Max 2 University Press & Assessment 2025 Page 8 of 20 9618/22 Cambridge International AS & A Level – Mark Scheme May/June 2025

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

1007 2 3

Mark points

  • Include the ideas shown in the solution above.

Question 3

Paper page 6 for Q3
Original paper page 6

Part 3 — solution

Example solution 8 DECLARE FirstNumber : INTEGER DECLARE SecondNumber : INTEGER DECLARE ThirdNumber : INTEGER FirstNumber  INT(RAND(21)) – 10 OUTPUT FirstNumber REPEAT SecondNumber  INT(RAND(21)) – 10 UNTIL FirstNumber <> SecondNumber OUTPUT SecondNumber IF FirstNumber < 0 AND SecondNumber < 0 THEN ThirdNumber  INT(RAND(6)) + 30 OUTPUT ThirdNumber ENDIF Mark points: 1. Declare all variables used 2. Use RAND() function with any integer parameter 3. Use INT() function with any numeric parameter 4. Conditional loop until two different random numbers are generated 5. Use INT() function using random number generated between −10 and 10 inclusive in a loop 6. Output two different random integers / numbers 7. Check if both random integers / numbers are negative 8. then output a (third) random integer / number between 30 and 35 inclusive University Press & Assessment 2025 Page 9 of 20 9618/22 Cambridge International AS & A Level – Mark Scheme May/June 2025

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

1010 3 1

Mark points

  • Include the ideas shown in the solution above.

Question 4

Part 4 — solution

Answer: 6

6 One mark for each functional group as listed: 1. Initialise Index used for Number to either 1 or 0 before first loop 2. Loop 100 times 3. Input value 4. Increment array index and store value in Number array at element referenced by array index in a loop 5. Output loop starts at last element in Number array 6. Output Number array element referenced by Index in a loop 7. Output all elements of Number array once in reverse order Max 6 University Press & Assessment 2025 Page 10 of 20 9618/22 Cambridge International AS & A Level – Mark Scheme May/June 2025

Mark points

  • Correct result: 6

Part 4 — solution

1056 4 6

Mark points

  • Include the ideas shown in the solution above.

Question 5

Part 5(a) — solution

Answer: 4

4 Mark as follows:

Mark points

  • Correct result: 4

Part 5(b) — solution

  1. IF NextHour = Hour THEN

Mark points

  • IF NextHour = Hour THEN

Part 5(b) — solution

Alternative solution and mark scheme use of an array to hold count for each hour Also, for use of 24 variables and 24 selection conditions DECLARE HoursArray[0 : 23] OF INTEGER DECLARE Index, Hour : INTEGER DECLARE Line : STRING FOR Index  0 TO 23 HoursArray[Index]  0 NEXT Index OPENFILE "TimeTaken.txt" FOR READ WHILE NOT EOF("TimeTaken.txt") READFILE "TimeTaken.txt", Line Hour  STR_TO_NUM(LEFT(Line, 2)) HoursArray[Hour]  HoursArray[Hour] + 1 ENDWHILE FOR Index  0 TO 23 IF HoursArray[Index] <> 0 THEN OUTPUT "Hour : ", Index, " Total : ", HoursArray[Index] ENDIF NEXT Index CLOSEFILE "TimeTaken.txt" Mark as follows: 1. Initialisation of 24 array elements to 0 // Initialisation of 24 Integer variables to 0 2. Open "TimeTaken.txt" for read and subsequently close 3. Conditional loop until EOF 4. Read a line from "TimeTaken.txt" in a loop 5. Extract Hour from line read in a loop 6. Convert Hour to an integer value in a loop 7. Increment appropriate array element / variable in a loop 8. Output of each hour and corresponding count variable (with a suitable message) for all values where count is not zero University Press & Assessment 2025 Page 13 of 20 9618/22 Cambridge International AS & A Level – Mark Scheme May/June 2025

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

1092 5 –1

Mark points

  • Include the ideas shown in the solution above.

Question 6

Paper page 12 for Q6
Original paper page 12

Part 6(a)(i) — solution

Value Start Unused New Last Current 4 1043 2 8 8 –1 2 Region 1

Mark points

  • Include the ideas shown in the solution above.

Part 6(a)(ii) — solution

Data Pointer 3

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

1062 6 5

Mark points

  • Include the ideas shown in the solution above.

Part 6(b) — solution

Example answer: 2 The ADT is a linked list and the procedure Place()inserts / add a new node / value into it / the linked list Mark as follows: 1. 1 mark for identifying the ADT as a linked list 2. 1 mark for identifying operation as inserting / adding a value / node into a linked list University Press & Assessment 2025 Page 15 of 20 9618/22 Cambridge International AS & A Level – Mark Scheme May/June 2025

Mark points

  • Include the ideas shown in the solution above.

Question 7

Paper page 14 for Q7
Original paper page 14

Part 7 — solution

4 Region 4 Award 1 mark per region

Mark points

  • Include the ideas shown in the solution above.

Part 7 — solution

1034 7 8

Mark points

  • Include the ideas shown in the solution above.

Part 7(a) — solution

  1. CONSTANT Unused = 99999
  2. CONSTANT Upper = 1000
  3. WHILE Found = FALSE AND Loyalty[Index, 1] <> 99999
  4. IF Loyalty[Index,1] = CustomerID THEN

Mark points

  • CONSTANT Unused = 99999
  • CONSTANT Upper = 1000
  • WHILE Found = FALSE AND Loyalty[Index, 1] <> 99999
  • IF Loyalty[Index,1] = CustomerID THEN

Part 7(a) — solution

  1. IF Loyalty[Index, 1] = CustomerID THEN
  2. IF Loyalty[Index, 1] = 99999 THEN

Mark points

  • IF Loyalty[Index, 1] = CustomerID THEN
  • IF Loyalty[Index, 1] = 99999 THEN

Part 7(a) — solution

  1. Index = CustomerID – 10000
  2. IF Loyalty[Index, 1] = CustomerID THEN
  3. WHILE Start <= End
  4. IF Loyalty[Mid, 1] = CustomerID THEN

Mark points

  • Index = CustomerID – 10000
  • IF Loyalty[Index, 1] = CustomerID THEN
  • WHILE Start <= End
  • IF Loyalty[Mid, 1] = CustomerID THEN

Part 7(a) — solution

Mark points 1. Create function header and ending with correct parameter and return type 2. Check CustomerID is within range and if not return –1 3. Conditional loop that halves array search space with each iteration 4. Check if CustomerID is stored in current array element in loop 5. Mechanism to end loop if CustomerID is found in array in a loop 6. Mechanism to end loop if CustomerID is not in array in a loop 7. If CustomerID found in array then return correct loyalty points 8. If CustomerID not in array then return –1

Mark points

  • Include the ideas shown in the solution above.

Part 7(b) — solution

  1. WHILE Loyalty[Index, 1] <> 99999 AND Index <= 1000
  2. IF Loyalty[Index, 2] >= 11 THEN

Mark points

  • WHILE Loyalty[Index, 1] <> 99999 AND Index <= 1000
  • IF Loyalty[Index, 2] >= 11 THEN

Part 7 — solution

Sum points and Increment Count in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 7(c)(i) — solution

An array can only store data of the same type // An array cannot store data 1 of different types

Mark points

  • Include the ideas shown in the solution above.

Part 7(c)(ii) — solution

1 mark for each point 2 1. a new (composite) data type / record is defined (that consists of both INTEGER and STRING) 2. an array based on this new type is declared Alternative

Mark points

  • Include the ideas shown in the solution above.

Question 8

Part 8 — solution

1043 8 4

Mark points

  • Include the ideas shown in the solution above.

Question 10

Part 10 — solution

0 10 –1 Mark as follows:

Mark points

  • Include the ideas shown in the solution above.