9618/21 · 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) — solution

One mark per point: 3

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

They are tried and tested so free from errors

Mark points

  • Include the ideas shown in the solution above.

Part 1(b)(i) — solution

One mark per point: 3

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Algorithm to process / search / organise the data is easier to implement // Values may be accessed via a loop-controlled variable / iterated through using index

Mark points

  • Include the ideas shown in the solution above.

Part 1(b)(ii) — solution

One mark per point: 2 Purpose: It identifies / references an individual array element // provides the index to the array Data type: Integer

Mark points

  • Include the ideas shown in the solution above.

Part 1(c) — solution

  1. IF EMPTY  "" THEN Should be "=" not 

Mark points

  • IF EMPTY  "" THEN Should be "=" not 

Part 1 — solution

Data A and K stored in new / existing nodes

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Pointers determine the ordering of data // only the pointers need to be changed when data changed

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Define a record type with fields for data and pointer

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Procedure heading and ending and declaration of both indexes

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

Declaration of local variables for Par1 Par2 and Par3

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

Module name, at least one parameter in brackets and one parameter correct

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

Incorrect block structure. Missing keyword denoting part of block (for example ENDPROCEDURE, ENDFUNCTION, ENDTYPE)

Mark points

  • Include the ideas shown in the solution above.

Question 2

Paper page 4 for Q2
Original paper page 4

Part 2 — solution

They perform a function that you may not be able to program yourself (for example encryption)

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Makes the program easier to design / code / test / understand

Mark points

  • Include the ideas shown in the solution above.

Part 2(a) — solution

  1. Abstraction is used to filter out information / data that is not necessary
  2. To keep only information / data that is necessary for the task
  3. Car details: ID, Car Registration, car type etc
  4. Customer details: ID, name, address, licence details etc
  5. Start date (of hire)
  6. Return date / Number of days (of hire)
  7. Cost of hire

Mark points

  • Abstraction is used to filter out information / data that is not necessary
  • To keep only information / data that is necessary for the task
  • Car details: ID, Car Registration, car type etc
  • Customer details: ID, name, address, licence details etc
  • Start date (of hire)
  • Return date / Number of days (of hire)
  • Cost of hire

Part 2(b) — solution

One mark for each (Max 2) 2 Examples include:

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Assign value of first / any element to Max

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Easier to add / delete data (to maintain correct sequence) in a linked list // description of moving data to maintain correct sequence when array used

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Loop to process all elements from Array1

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Loop to end of (parameter) string // until operator is found

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Declaration and initialisation of local Integer for Count

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Declaration and initialisation of local Integer value for ErrCount

Mark points

  • Include the ideas shown in the solution above.

Part 2 — solution

Data type errors, for example, assigning an integer value to a string

Mark points

  • Include the ideas shown in the solution above.

Question 3

Paper page 5 for Q3
Original paper page 5

Part 3 — solution

They are readily available / speed up development time

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Multiple instances referenced via a single identifier / so fewer identifiers needed // Easier to amend the program when the number of students increases

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

One mark per point (Max 5): 5

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Set up a loop to repeat 200 times / from start to end of array

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Node A points to Node C and Node C points to Node K

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Elements from same index represent one node

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Sum (any) three consecutive values from Array1 and divide by 3 in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 3 — solution

Use of CheckFile(), output message and terminate if it returns FALSE

Mark points

  • Include the ideas shown in the solution above.

Question 4

Paper page 6 for Q4
Original paper page 6

Part 4(a)(i) — solution

One mark for each: 4

Mark points

  • Include the ideas shown in the solution above.

Part 4(a)(ii) — solution

One mark per point: 2

Mark points

  • Include the ideas shown in the solution above.

Part 4(a)(iii) — solution

One mark per point: 2

Mark points

  • Include the ideas shown in the solution above.

Part 4(b) — solution

One mark per point (Max 4): 4

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Declare an integer / variable for StartPointer // explain its use

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Attempt at extraction of three parts of expression using substring functions

Mark points

  • Include the ideas shown in the solution above.

Part 4 — solution

Incorrect parameter use 2022 Page 10 of 10

Mark points

  • Include the ideas shown in the solution above.

Question 5

Paper page 8 for Q5
Original paper page 8

Part 5 — solution

If value of current element is greater than Max...

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Define appropriate value for null pointer // explain its use

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Mark as follows (Max 5): 5

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Assign value to correct element of Array2 in a loop

Mark points

  • Include the ideas shown in the solution above.

Part 5 — solution

Completely correct extraction of all three parts of expression 6. Convert string to Integer using STR_TO_NUM(<something sensible>)

Mark points

  • Include the ideas shown in the solution above.

Question 6

Paper page 10 for Q6
Original paper page 10

Part 6 — solution

Change / check car status (hired / available / written-off)

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

Declare an integer / variable for FreeList pointer // explain its use

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

Increment Array2 index in a loop PROCEDURE Summarise() DECLARE Value : REAL DECLARE IxA, IxB : INTEGER // Index variables IxB  1 FOR IxA  1 TO 598 STEP 3 Value  Array1[IxA] + Array1[IxA + 1] + Array1[IxA + 2] Value  Value / 3 Array2[IxB]  INT(Value) IxB  IxB + 1 NEXT IxA ENDPROCEDURE

Mark points

  • Include the ideas shown in the solution above.

Part 6(a) — solution

  1. Condition evaluates to TRUE if bracket contents evaluate to FALSE:
  2. Bracket contents evaluate to FALSE if:
  3. Dots: zero / less than one
  4. Ats: not equal to one
  5. Others: less than nine

Mark points

  • Condition evaluates to TRUE if bracket contents evaluate to FALSE:
  • Bracket contents evaluate to FALSE if:
  • Dots: zero / less than one
  • Ats: not equal to one
  • Others: less than nine

Part 6(b)(i) — solution

One mark for each area as outlined: 5 Index NextChar Dots Ats Others Valid

Mark points

  • Include the ideas shown in the solution above.

Part 6 — solution

Read line and use as parameter to CheckLine()in a loop

Mark points

  • Include the ideas shown in the solution above.

Question 7

Paper page 12 for Q7
Original paper page 12

Part 7 — solution

Routines are needed to add / delete / search Alternative MP1, 2 and 3 for record-based implementation:

Mark points

  • Include the ideas shown in the solution above.

Part 7(a)(i) — solution

One mark per point (Max 7) as follows: 7

Mark points

  • Include the ideas shown in the solution above.

Part 7 — solution

Attempt to interpret at least two operators (Par2): + - * /

Mark points

  • Include the ideas shown in the solution above.

Part 7(b) — solution

Example string: "23/0" (Any divide by zero example) 2 Reason: The result is infinity / cannot be represented / is undefined // will cause the program to crash

Mark points

  • Include the ideas shown in the solution above.

Part 7 — solution

Terminate loop when 10 non-blank lines have been read

Mark points

  • Include the ideas shown in the solution above.

Part 7 — solution

Test return value and increment ErrCount if non-zero in a loop

Mark points

  • Include the ideas shown in the solution above.

Question 8

Paper page 14 for Q8
Original paper page 14

Part 8 — solution

Process payment / calculate hire cost

Mark points

  • Include the ideas shown in the solution above.

Part 8 — solution

  1. CONSTANT PLUS = '+'
  2. CONSTANT MINUS = '-'
  3. CONSTANT MULTIPLY = '*'
  4. CONSTANT DIVIDE = '/'
  5. IF IS_NUM(ThisChar) = FALSE THEN

Mark points

  • CONSTANT PLUS = '+'
  • CONSTANT MINUS = '-'
  • CONSTANT MULTIPLY = '*'
  • CONSTANT DIVIDE = '/'
  • IF IS_NUM(ThisChar) = FALSE THEN

Part 8(a) — solution

One mark for each point (Max 7) as follows: 7

Mark points

  • Include the ideas shown in the solution above.

Part 8 — solution

  1. WHILE NOT EOF(ThisFile) AND Valid = FALSE

Mark points

  • WHILE NOT EOF(ThisFile) AND Valid = FALSE

Part 8(b) — solution

CALL CountErrors("Jim01Prog.txt", 20) 2 One mark for each:

Mark points

  • Include the ideas shown in the solution above.

Part 8(c) — solution

Mark as follows: 8

Mark points

  • Include the ideas shown in the solution above.

Part 8 — solution

  1. IF CheckFile(ThisFile) = FALSE THEN
  2. IF EOF(ThisFile) = FALSE THEN

Mark points

  • IF CheckFile(ThisFile) = FALSE THEN
  • IF EOF(ThisFile) = FALSE THEN

Part 8(d) — solution

One mark for each (Max 2): 2 Examples:

Mark points

  • Include the ideas shown in the solution above.

Question 12

Part 12 — solution

'@' 2 FALSE

Mark points

  • Include the ideas shown in the solution above.