9618/23 · May/June 2025 · Worked solutions

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

Question 0

Part 0 — solution

"Neptune" 2 MP3

Mark points

  • Include the ideas shown in the solution above.

Question 1

Paper page 2 for Q1
Original paper page 2

Part 1(a)(i) — solution

MP1 When a task/module is repeated / reused / called // performed in 2 several places MP2 A specific task can be identified /coded as a module / subroutine / procedure / function. MP3 Reduces complexity of program / code // Program / code is simplified MP4 Module / subroutine / procedure / function already available. MP5 Testing / debugging / maintenance is easier Max 2

Mark points

  • Include the ideas shown in the solution above.

Part 1(a)(ii) — solution

MP1 Local variables are used within a module // are accessible only within 1 the module (in which they are declared) MP2 Global variables are accessible to all parts of the program / MP3 Local variables use memory only while the module in is executing // Global variables use memory for the whole time the program is running Max 1

Mark points

  • Include the ideas shown in the solution above.

Part 1(a)(iii) — solution

MP1 The same variable name can be reused in other parts of the 2 program MP2 Using local variables makes modules self-contained // cannot accidentally change the same identifier outside of the module MP3 Using local variables aids modularisation. MP4 Memory allocated to local variables can be reused when module not in use Max 2

Mark points

  • Include the ideas shown in the solution above.

Part 1(b) — solution

  1. // FALSE = TRUE

Mark points

  • // FALSE = TRUE

Part 1(c) — solution

Answer: 4

4 Variable Data type MemberCount INTEGER TotalTakings REAL BookingConfirmed BOOLEAN MemberDOB DATE Mark as follows:

Mark points

  • Correct result: 4

Part 1 — solution

mark per row

Mark points

  • Include the ideas shown in the solution above.

Question 2

Paper page 4 for Q2
Original paper page 4

Part 2(a)(i) — solution

MP1 400 2 MP2 6

Mark points

  • Include the ideas shown in the solution above.

Part 2(a)(ii) — solution

Answer: 3 · 409

3 Stack Memory Value location 409 408 'Y' TopOfStack 407 'Z' 406 ‘C’ 405 ‘F’ 404 ‘K’ 403 ‘B’

Mark points

  • Correct result: 3
  • Correct result: 409

Part 2(b)(i) — solution

Answer: 3

3 Index Data Pointer

Mark points

  • Correct result: 3

Part 2(b)(ii) — solution

Answer: 3 1

3 1

Mark points

  • Correct result: 3 1

Part 2(c) — solution

MP1 First value added to queue is the first value removed // FIFO // LILO 2 MP2 Two pointers needed to indicate the start and end of the queue MP3 May behave as a circular queue MP4 Manipulated using enqueue()/ dequeue() operations // by description Max 2 University Press & Assessment 2025 Page 8 of 14 9618/23 Cambridge International AS & A Level – Mark Scheme May/June 2025

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Marks Sub_Part3A: PROCEDURE Sub_Part3A(V: INTEGER, W: BOOLEAN, BYREF U : STRING)

Mark points

  • Include the ideas shown in the solution above.

Question 3

Part 3 — solution

402 ‘S’ 401 ‘R’ 400 ‘D’ MP1 TopOfStack pointing to 'Y' and value 'Y' in location 408 MP2 Values 'C' and 'Z' in 406 and 407 MP3 Values 'D' to 'F' unchanged in 400 to 405 and 409 is empty University Press & Assessment 2025 Page 7 of 14 9618/23 Cambridge International AS & A Level – Mark Scheme May/June 2025

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Example solution: 7 FUNCTION RollDice(NoOfTimes : INTEGER) RETURNS REAL DECLARE RollValue : INTEGER DECLARE Average : REAL DECLARE Count : INTEGER DECLARE Sum : INTEGER Sum  0 FOR Count  1 TO NoOfTimes RollValue  INT(RAND(6)) + 1 OUTPUT RollValue Sum  Sum + RollValue NEXT Count Average  Sum / NoOfTimes RETURN Average ENDFUNCTION MP1 Declare all variables used and initialise Sum to 0 MP2 Loop for ‘number of times’ parameter MP3 Use RAND() function with Integer parameter in a loop MP4 Use INT() function in a loop MP5 Generate a random integer between 1 and 6 in a loop MP6 Output each value generated in a loop MP7 Calculate Sum and if Average used check declared as REAL and return Average and check function header returns REAL

Mark points

  • Include the ideas shown in the solution above.

Question 4

Paper page 8 for Q4
Original paper page 8

Part 4(a) — solution

MP1 Open the file (Sales.txt) in read mode and subsequently close 5 MP2 Read a line (from the text file) MP3 Convert the line read (string) to a number MP4 If the number is greater than 500 and then output week number MP5 Increment week number (must have been Initialised …) MP6 Repeat from step 2 for 52 times // Repeat from step 2 until end of file Max 5 University Press & Assessment 2025 Page 9 of 14 9618/23 Cambridge International AS & A Level – Mark Scheme May/June 2025

Mark points

  • Include the ideas shown in the solution above.

Part 4(b) — solution

MP1 Going through the program a line / statement at a time 3 // doing a dry run // single-stepping (at run-time with an IDE) // Peer testing/review is carried out MP2 Creating a trace table MP3 Draw up test data // draw up list of inputs with expected output // boundary, normal, abnormal data is used MP4 Errors will be indicated when a variable / output gives an unexpected value MP5 Faults in the logic of the program can be detected // Errors may be indicated by an unexpected path through the program Max 3

Mark points

  • Include the ideas shown in the solution above.

Question 5

Paper page 10 for Q5
Original paper page 10

Part 5 — solution

"Uranus" -1 MP2 MP1 Earth pointer 1 MP2 Uranus pointer -1 MP3 Other four correct pointers

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

  1. IF MID(BitString, Index, 1) = '1' THEN
  2. IF Count MOD 2 = 1 THEN

Mark points

  • IF MID(BitString, Index, 1) = '1' THEN
  • IF Count MOD 2 = 1 THEN

Question 6

Paper page 12 for Q6
Original paper page 12

Part 6(a) — solution

MP1 A function returns a (single) value and a procedure does not 1 MP2 A procedure can pass parameters by ByRef Max 1

Mark points

  • Include the ideas shown in the solution above.

Part 6(b) — solution

Sub_Part1A: 5 PROCEDURE Sub_Part1A(R: INTEGER) 1 Mark Sub_Part2A: FUNCTION Sub_Part2A(T : REAL) RETURNS BOOLEAN

Mark points

  • Include the ideas shown in the solution above.

Part 6(c) — solution

Answer: 3

3 Symbol Explanation The module Main calls either Sub_A or Sub_B (which one is called is determined at run time) The module Sub_A will repeatedly call Sub_Part1A followed by Sub_Part2A then by Sub_Part3A MP1 Shape1: reference to selection MP2 Shape2: reference to repetition // iteration MP3 Descption (2) including correct use of all module names in both parts University Press & Assessment 2025 Page 11 of 14 9618/23 Cambridge International AS & A Level – Mark Scheme May/June 2025

Mark points

  • Correct result: 3

Question 7

Paper page 14 for Q7
Original paper page 14

Part 7(a)(i) — solution

  1. IF MONTH(TODAY()) = MONTH(LastVisitDate) THEN

Mark points

  • IF MONTH(TODAY()) = MONTH(LastVisitDate) THEN

Part 7(b)(i) — solution

  1. IF DAYINDEX(TODAY()) = 2 THEN

Mark points

  • IF DAYINDEX(TODAY()) = 2 THEN

Part 7(b)(i) — solution

  1. IF DAYINDEX(TODAY()) = 2 THEN

Mark points

  • IF DAYINDEX(TODAY()) = 2 THEN

Part 7(b)(ii) — solution

Example solution: 4 DayInt  STR_TO_NUM(LEFT(LastVisitDateString, 2)) MonthInt  STR_TO_NUM(MID(LastVisitDateString, 3, 2)) YearInt  STR_TO_NUM(RIGHT(LastVisitDateString, 4)) LastVisitDate  SETDATE(DayInt, MonthInt, YearInt) Mark as follows: MP1 Use of one substring function MP2 DayInt, MonthInt and YearInt all correctly extracted MP3 Use of STR_TO_NUM x 3 MP4 SETDATE() function used to convert to a date type and assigned to LastVisitDate University Press & Assessment 2025 Page 14 of 14

Mark points

  • Include the ideas shown in the solution above.