9618/22 · October/November 2022 · 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. When a task which is repeated / reused / performed in several places
  2. When a part of an algorithm performs a specific task
  3. Reduces complexity of program / program is simplified // subroutine
  4. Testing / debugging / maintenance is easier

Mark points

  • When a task which is repeated / reused / performed in several places
  • When a part of an algorithm performs a specific task
  • Reduces complexity of program / program is simplified // subroutine
  • Testing / debugging / maintenance is easier

Part 1(a)(ii) — solution

One mark for each part: 2 Term: Parameter(s) Use: to pass values / arguments to the procedure

Mark points

  • Include the ideas shown in the solution above.

Part 1(b) — solution

One mark for test stage, one mark for each description point 4 (Max 3 for Description) Test stage: Beta testing Description:

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Testing carried out by a small group of (potential) users

Mark points

  • Include the ideas shown in the solution above.

Part 1(c) — solution

  1. (Count >= 99) AND (DAY(FlagDay) > 23) FALSE

Mark points

  • (Count >= 99) AND (DAY(FlagDay) > 23) FALSE

Part 1 — solution

Open file in APPEND mode (and subsequent Close)

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Each queue element contains one data item

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Each node contains data and a pointer to the next node

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Declare a (1D) array of data type STRING

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Data 'After Group 1' (as shown, including blank cells)

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Input UserID and use of GetAverage()and assignment

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Input UserID and use of GetAverage()and assignment

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

IF A AND B AND C THEN CALL Sub1() ENDIF

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Function heading and ending including parameter and return type

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Function heading and ending including parameter and return type

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Non-numeric but not "End" // contains space or other non-numeric characters

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Procedure heading and ending including parameters

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Array of records can store mixed data types / multiple data types under a single identifer

Mark points

  • Include the ideas shown in the solution above.

Question 2

Paper page 3 for Q2
Original paper page 3

Part 2 — solution

Users will check that the software works as required / works in the real world / does not contain errors

Mark points

  • Include the ideas shown in the solution above.

Part 2(a)(i) — solution

One mark per step (or equivalent): 5

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Prompt and Input a student name and mark

Mark points

  • Include the ideas shown in the solution above.

Part 2(a)(ii) — solution

Data in a file is saved after the computer is switched off / stored 1 permanently // no need to re-enter the data when the program is re-run

Mark points

  • Include the ideas shown in the solution above.

Part 2(a)(iii) — solution

Example answer: 1 So that existing file data is not overwritten.

Mark points

  • Include the ideas shown in the solution above.

Part 2(b) — solution

  1. Input-A Output-X S2
  2. Input-A (none) S2
  3. Input-B Output-W S3
  4. Input-A Output-W S4

Mark points

  • Input-A Output-X S2
  • Input-A (none) S2
  • Input-B Output-W S3
  • Input-A Output-W S4

Part 2 — solution

A Pointer to the front / start of the queue

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

The number of elements in that array corresponds to the size of the required stack

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Data 'After Group 2' (as shown, including blank cells)

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Initialisation of Total to zero and Index to 4

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

IF (A AND B) AND NOT C THEN CALL Sub2() ENDIF

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Declaration and initialisation of local Num

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Declaration of local Integer value for Num and Try

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Conditional loop containing incrementing Index...

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Tighter / closer association between ErrCode and ErrText // simpler code as fields may be referenced together // values cannot get out of step as with two arrays

Mark points

  • Include the ideas shown in the solution above.

Question 3

Paper page 5 for Q3
Original paper page 5

Part 3 — solution

Users will feedback problems / suggestions for improvement

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

If mark greater than or equal to 20 jump to step 5

Mark points

  • Include the ideas shown in the solution above.

Part 3(a) — solution

One mark for name, Max two for features (Max 3 in total) 3 Name: Queue Features:

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

A Pointer to the back / end of the queue

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Last node in the list has a null pointer

Mark points

  • Include the ideas shown in the solution above.

Part 3(b) — solution

One mark per point (Max 5): 5

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Declare an integer / variable for StackPointer 4. Declare an integer / variable for the size of the stack // for the max value of StackPointer

Mark points

  • Include the ideas shown in the solution above.

Part 3(c) — solution

One mark for each: 5

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Data 'After Group 3' (as shown, including blank cells)

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

IF (NOT A) AND (NOT C) THEN CALL Sub3() ENDIF

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Count-controlled Loop from 1 to ThisValue

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Program easier to design / write / debug / test / maintain / understand One mark per point Note: Max 2 marks

Mark points

  • Include the ideas shown in the solution above.

Question 4

Paper page 8 for Q4
Original paper page 8

Part 4 — solution

Problems / suggestions identified are addressed (before the program is sold)

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Data is added at back / end and removed from front / start // works on a FIFO basis

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Data may be added / removed by manipulating pointers (not moving data)

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

SP 'After Group 1' pointing to location 955

Mark points

  • Include the ideas shown in the solution above.

Part 4(a) — solution

One mark per point: 6

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Assignment of Last from element SameMonth[Index] in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Assignment of Last from array SameMonth in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 4(b) — solution

Pre-condition (loop) / count-controlled (loop) 1

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Conditional loop until ThisValue found or Try out of range

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

...terminating when ErrCode[Index] > ErrNum (i.e. ErrNum not found)

Mark points

  • Include the ideas shown in the solution above.

Question 5

Paper page 10 for Q5
Original paper page 10

Part 5 — solution

Repeat from Step 2 for 35 times / the number of students

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

May be circular ALTERNATIVE: Name: Linked List Features:

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Nodes are traversed in a specific sequence

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Use the StackPointer as an index to the array

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Structure: IF...THEN...ELSE...ENDIF in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Comparison IF...THEN...ELSE...ENDIF in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

One mark per IF...THEN...ENDIF clause: 4

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Correct word but wrong case e.g. "end" rather than "End" Input Reason for choice "Aardvark" Non-numeric (and not "End") "27.3" Numeric but not an integer "-3" // "0" A non-positive integer "" An empty string 2022 Page 10 of 13 9618/22 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2022

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Comparison (element J with J+1) in a loop

Mark points

  • Include the ideas shown in the solution above.

Question 6

Paper page 12 for Q6
Original paper page 12

Part 6 — solution

Unused nodes are stored on a free list // a free-list pointer to the Free List

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

Pointers and variables initialised to indicate empty stack

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

  1. ENDWHILE // UNTIL Index = 7

Mark points

  • ENDWHILE // UNTIL Index = 7

Part 6 — solution

Appropriate assignments in a loop AND final call to Update()after the loop INPUT UserID Average  GetAverage(UserID) Total  0 FOR Index  4 TO 6 Last  SameMonth[Index] IF Average > Last THEN Total  Total + Average ELSE Total  Total + Last ENDIF NEXT Index CALL Update(UserID, Total) 2022 Page 7 of 13 9618/22 Cambridge International AS & A Level – Mark Scheme October/November PUBLISHED 2022

Mark points

  • Include the ideas shown in the solution above.

Part 6(a) — solution

Example by repeated multiplication: 7 Mark as follows (multiplication solution), (Max 7):

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

Compare Try with ThisValue and set termination if the same in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 6(a) — solution

Alternative FOR LOOP solution. Mark as follows:

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

...Immediate return of Num if they are the same in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 6(b) — solution

One mark per row. 4 Examples of invalid strings:

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

Test if found and OUTPUT 'Found' message

Mark points

  • Include the ideas shown in the solution above.

Question 7

Paper page 16 for Q7
Original paper page 16

Part 7 — solution

Store each item on the stack as one array element / Each stack item maps to one array element

Mark points

  • Include the ideas shown in the solution above.

Part 7 — solution

  1. IF Try = ThisValue THEN //BaseNumber found

Mark points

  • IF Try = ThisValue THEN //BaseNumber found

Part 7(a) — solution

One mark per point (Max 6): 6

Mark points

  • Include the ideas shown in the solution above.

Part 7 — solution

  1. UNTIL ErrCode[Index] >= ErrNum OR Index = 500
  2. IF ErrCode[Index] = ErrNum THEN

Mark points

  • UNTIL ErrCode[Index] >= ErrNum OR Index = 500
  • IF ErrCode[Index] = ErrNum THEN

Part 7(b) — solution

One mark per point (Max 8): 8

Mark points

  • Include the ideas shown in the solution above.

Part 7 — solution

  1. Conditional outer loop including flag reset
  2. Flag set in inner loop to indicate swap

Mark points

  • Conditional outer loop including flag reset
  • Flag set in inner loop to indicate swap

Part 7(c)(ii) — solution

Benefits include: 2

Mark points

  • Include the ideas shown in the solution above.

Part 7(c)(iii) — solution

DECLARE Error : ARRAY[1:500] OF ErrorRec 1 2022 Page 13 of 13

Mark points

  • Include the ideas shown in the solution above.

Question 8

Part 8 — solution

Attempt to describe Push and Pop operations

Mark points

  • Include the ideas shown in the solution above.

Part 8 — solution

  1. WHILE Try <= ThisValue AND Found = FALSE
  2. IF Try = ThisValue THEN //BaseNumber found
  3. IF Found = TRUE THEN

Mark points

  • WHILE Try <= ThisValue AND Found = FALSE
  • IF Try = ThisValue THEN //BaseNumber found
  • IF Found = TRUE THEN

Part 8 — solution

  1. Efficiency (this scenario): terminate inner loop when ErrCode = 999

Mark points

  • Efficiency (this scenario): terminate inner loop when ErrCode = 999

Question 9

Part 9 — solution

  1. UNTIL NoSwaps = TRUE

Mark points

  • UNTIL NoSwaps = TRUE