9618/22 · October/November 2024 · 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

(Corrective) Maintenance 1

Mark points

  • Include the ideas shown in the solution above.

Part 1(b) — solution

  1. Set a breakpoint at the start of / within Lookup, to stop execution at a
  2. then use single stepping to execute one statement / instruction at a time
  3. to display the value of variables using a watch window

Mark points

  • Set a breakpoint at the start of / within Lookup, to stop execution at a
  • then use single stepping to execute one statement / instruction at a time
  • to display the value of variables using a watch window

Part 1(c) — solution

Features include: 2 MP1 Editor MP2 Auto- (syntax) complete / auto correction // identify undeclared variables(s) MP3 Prettyprint / auto-indentation / auto (structure) highlighter MP4 Dynamic syntax checking MP5 Expand / collapse code blocks MP6 Context sensitive prompts Max 2 marks

Mark points

  • Include the ideas shown in the solution above.

Part 1(d) — solution

One mark per row: 3 Variable name Used to store Data type Name a customer name STRING Index an array index INTEGER Result the result of the division of any two non-zero REAL numbers University Press & Assessment 2024 Page 4 of 12 9618/22 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2024

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

mark for each statement and description Max 3 marks

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

  1. CONSTANT Asterisk = '*'
  2. CONSTANT Asterisks = "********************" //20

Mark points

  • CONSTANT Asterisk = '*'
  • CONSTANT Asterisks = "********************" //20

Part 2(a) — solution

MP4 Trim asterisk string to number calculated in MP3 MP5 Extract the last four characters MP6 Concatenate trimmed asterisk string with last four characters of CardNumber MP7 Return masked string Max 6 marks

Mark points

  • Include the ideas shown in the solution above.

Part 2(b)(i) — solution

DECLARE CardNumber : ARRAY [1:100, 1:2] OF STRING 2 MP1 Correct dimensions MP2 All other parts of the statement correct

Mark points

  • Include the ideas shown in the solution above.

Part 2(b)(ii) — solution

Any reference to BYREF // ‘by reference’ 1

Mark points

  • Include the ideas shown in the solution above.

Question 3

Paper page 6 for Q3
Original paper page 6

Part 3(a)(i) — solution

SP: 1 1 OnStack: 0 One mark for both correct values

Mark points

  • Include the ideas shown in the solution above.

Part 3(a)(ii) — solution

MP1 Unused values cannot be popped / taken off the stack // initialised 2 values would never be used / unused elements cannot be accessed MP2 ... until a value has first been pushed / written // overwrites previous value

Mark points

  • Include the ideas shown in the solution above.

Part 3(b) — solution

  1. IF OnStack = 60 / >59 // SP = 61 / SP > 60 //

Mark points

  • IF OnStack = 60 / >59 // SP = 61 / SP > 60 //

Question 4

Paper page 8 for Q4
Original paper page 8

Part 4 — solution

Answer: OR …

  1. Two separate loops – checking warning time then the final time,
  2. Single loop checking the final time with an IF statement to check
  3. Single loop with two IF statements checking the warning time and

Mark points

  • Two separate loops – checking warning time then the final time,
  • Single loop checking the final time with an IF statement to check
  • Single loop with two IF statements checking the warning time and

Question 5

Paper page 10 for Q5
Original paper page 10

Part 5(a) — solution

MP1 Count  INT(100 / Number) 3 Number could be zero (giving a divide by zero) MP2 Index  Data[Number] Potential error: Value Number could be outside the range of array indices MP3 ReturnValue  TO_UPPER(RIGHT(Label, Count)) Potential Error: Number to extract may be too big / negative / out of range for use in the RIGHT function // Label has insufficient characters MP4 RETURN RetVal Potential Error: There is no value to be returned // there is no variable named RetVal Mark as follows:

Mark points

  • Include the ideas shown in the solution above.

Part 5(b) — solution

MP1 Construct: A (pre/post) conditional loop 2 MP2 Explanation: The terminating condition is never satisfied

Mark points

  • Include the ideas shown in the solution above.

Part 5(c) — solution

  1. IF Index Mod 2 = 0 THEN

Mark points

  • IF Index Mod 2 = 0 THEN

Question 6

Paper page 12 for Q6
Original paper page 12

Part 6(a) — solution

Example solution: 7 PROCEDURE Special() DECLARE Index : INTEGER DECLARE Filling1, Filling2 : STRING REPEAT Index  INT(RAND(35)) + 1 UNTIL Filling[Index] <> "" Filling1  Filling[Index] REPEAT Index  INT(RAND(35)) + 1 UNTIL Filling[Index] <> "" AND Filling1 <> Filling[Index] Filling2  Filling[Index] REPEAT Index  INT(RAND(10) + 1) UNTIL Bread[Index] <> "" OUTPUT "The daily special is ", Filling1, " and ", __ Filling2, " on ", Bread[Index], " bread." ENDPROCEDURE Mark as follows: MP1 Loop for Filling 1, avoiding unused elements MP2 Loop for Filling 2 avoiding unused elements MP3 Check Filling 2 is different from Filling 1 – could correctly compare either the indices or the array contents MP4 Loop for Bread, avoiding unused elements MP5 Using RAND(10) / RAND(35) MP6 Completely correct use of RAND() - including INT()and +1 in all cases MP7 Correct output - once only – following a reasonable attempt at selection of filings and bread

Mark points

  • Include the ideas shown in the solution above.

Part 6(b) — solution

Answers include: 2 MP1 For each filling, create a list of acceptable / incompatible fillings/indexes MP2 When selecting the second filling, (as well as checking for an unused element) check that the filling / index is / is not on the list ALTERNATIVE: MP1 Create a list of ‘good’ combinations MP2 Randomly select from this list University Press & Assessment 2024 Page 9 of 12 9618/22 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2024

Mark points

  • Include the ideas shown in the solution above.

Question 7

Part 7(a) — solution

  1. Customer ID – to reference the other customer details 3
  2. Email address – to send the email
  3. Name – to personalise the email
  4. Date of last visit – to select which customers should receive an email
  5. Unique voucher code (or method of code generation) – to include in the

Mark points

  • Customer ID – to reference the other customer details 3
  • Email address – to send the email
  • Name – to personalise the email
  • Date of last visit – to select which customers should receive an email
  • Unique voucher code (or method of code generation) – to include in the

Part 7(b) — solution

Abstraction 1

Mark points

  • Include the ideas shown in the solution above.

Part 7(c) — solution

MP1 Data structures // data dictionary // identifier table(s) // validation rules 3 MP2 Data-flow diagram // state-transition diagram MP3 User interface // Format for the email MP4 Testing method / Test plan / Test data / Trace tables MP5 Choice of email protocol to be used // Programming language to be used // Development environment MP6 Use of library routines // program to send the email Max 3 marks

Mark points

  • Include the ideas shown in the solution above.

Part 7(d) — solution

Answer: 3

3 MP1 Three boxes correctly labelled and correct hierarchy MP2 Parameter and return values MP3 Iteration arrow University Press & Assessment 2024 Page 10 of 12 9618/22 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2024

Mark points

  • Correct result: 3

Question 8

Paper page 18 for Q8
Original paper page 18

Part 8(a) — solution

  1. WHILE Index < 46 AND Done = FALSE
  2. IF Character[Index].Player = 0 AND __
  3. Character[Index].Role = ThisRole THEN
  4. IF Done = TRUE THEN

Mark points

  • WHILE Index < 46 AND Done = FALSE
  • IF Character[Index].Player = 0 AND __
  • Character[Index].Role = ThisRole THEN
  • IF Done = TRUE THEN

Part 8(b) — solution

  1. CONSTANT SEP = '^'

Mark points

  • CONSTANT SEP = '^'

Part 8(c) — solution

MP1 Encode Status as a character / string 2 MP2 Append the ‘^’ separator and the character/string

Mark points

  • Include the ideas shown in the solution above.

Part 8(d) — solution

MP1 Method: 2 Create a filename suffix which is incremented for each file save MP2 Example: SaveFile01.txt, SaveFile02.txt University Press & Assessment 2024 Page 12 of 12

Mark points

  • Include the ideas shown in the solution above.