Computer Science (9618) · Oct/Nov 2022 · Mark scheme 21

Cambridge Computer Science (9618) mark scheme for paper 21, Oct/Nov 2022 — 9618/21/O/N/22, file 9618_w22_ms_21.pdf.

Advertisement
Loading the paper…
Text of this paper

Cambridge International AS & A Level
COMPUTER SCIENCE

9618/21

Paper 2 Problem Solving & Programming

October/November 2022

MARK SCHEME
Maximum Mark: 75

Published

This mark scheme is published as an aid to teachers and candidates, to indicate the requirements of the
examination. It shows the basis on which Examiners were instructed to award marks. It does not indicate the
details of the discussions that took place at an Examiners’ meeting before marking began, which would have
considered the acceptability of alternative answers.
Mark schemes should be read in conjunction with the question paper and the Principal Examiner Report for
Teachers.
Cambridge International will not enter into discussions about these mark schemes.
Cambridge International is publishing the mark schemes for the October/November 2022 series for most
Cambridge IGCSE™, Cambridge International A and AS Level components and some Cambridge O Level
components.

This document consists of 10 printed pages.
© UCLES 2022

[Turn over

9618/21

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

October/November
2022

Generic Marking Principles
These general marking principles must be applied by all examiners when marking candidate answers.
They should be applied alongside the specific content of the mark scheme or generic level descriptors
for a question. Each question paper and mark scheme will also comply with these marking principles.
GENERIC MARKING PRINCIPLE 1:
Marks must be awarded in line with:
•
•
•

the specific content of the mark scheme or the generic level descriptors for the question
the specific skills defined in the mark scheme or in the generic level descriptors for the question
the standard of response required by a candidate as exemplified by the standardisation scripts.

GENERIC MARKING PRINCIPLE 2:
Marks awarded are always whole marks (not half marks, or other fractions).
GENERIC MARKING PRINCIPLE 3:
Marks must be awarded positively:
•
•
•
•
•

marks are awarded for correct/valid answers, as defined in the mark scheme. However, credit
is given for valid answers which go beyond the scope of the syllabus and mark scheme,
referring to your Team Leader as appropriate
marks are awarded when candidates clearly demonstrate what they know and can do
marks are not deducted for errors
marks are not deducted for omissions
answers should only be judged on the quality of spelling, punctuation and grammar when these
features are specifically assessed by the question as indicated by the mark scheme. The
meaning, however, should be unambiguous.

GENERIC MARKING PRINCIPLE 4:
Rules must be applied consistently, e.g. in situations where candidates have not followed
instructions or in the application of generic level descriptors.
GENERIC MARKING PRINCIPLE 5:
Marks should be awarded using the full range of marks defined in the mark scheme for the question
(however; the use of the full mark range may be limited according to the quality of the candidate
responses seen).
GENERIC MARKING PRINCIPLE 6:
Marks awarded are based solely on the requirements as defined in the mark scheme. Marks should
not be awarded with grade thresholds or grade descriptors in mind.

© UCLES 2022

Page 2 of 10

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question
1(a)

Answer

3

3

They are tried and tested so free from errors
They perform a function that you may not be able to program yourself
(for example encryption)
They are readily available / speed up development time

One mark per point:
1

2
3

1(b)(ii)

Marks

One mark per point:
1
2

1(b)(i)

October/November
2022

3

Algorithm to process / search / organise the data is easier to implement
// Values may be accessed via a loop-controlled variable / iterated
through using index
Makes the program easier to design / code / test / understand
Multiple instances referenced via a single identifier / so fewer identifiers
needed // Easier to amend the program when the number of students
increases

One mark per point:

2

Purpose: It identifies / references an individual array element // provides the
index to the array
Data type: Integer
1(c)

© UCLES 2022

One mark per row:

4

Statement

Error

IF EMPTY  "" THEN

Should be "=" not 

Status  IS_NUM(-23.4)

Parameter should be a string (or
char) // should not be a real

X  STR_TO_NUM("37") + 5

NO ERROR

Y  STR_TO_NUM("37" + "5")

Wrong operator – should be & or
Parameter is not a string

Page 3 of 10

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question
2(a)

October/November
2022

Answer
One mark for Explanation:
•

Marks
3

Abstraction is used to filter out information / data that is not necessary
for the task

Or the opposite:
•

To keep only information / data that is necessary for the task

One mark for each TWO data items (not dependent on 'Explanation'):
Items include:
•
•
•
•
•
2(b)

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

One mark for each (Max 2)

2

Examples include:
1
2
3
4
5
6
7
8

Input customer details
Input car details
Input payment details
Create hire / start hire
Return car / end hire
Change / check car status (hired / available / written-off)
Cancel hire
Process payment / calculate hire cost

Question
3

Answer
One mark per point (Max 5):
1
2
3
4
5
6
7

© UCLES 2022

Marks
5

Declare a variable / an integer Max
Assign value of first / any element to Max
Set up a loop to repeat 200 times / from start to end of array
Use the loop counter as the array index
If value of current element is greater than Max...
...then assign value to Max
After the loop, Output Max

Page 4 of 10

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question
4(a)(i)

Answer
One mark for each:
1
2
3
4

4(a)(ii)

2

4(b)

Data A and K stored in new / existing nodes
Start pointer points to Node A
Node A points to Node C and Node C points to Node K
Node K contains Null Pointer

2

Pointers determine the ordering of data // only the pointers need to be
changed when data changed
Easier to add / delete data (to maintain correct sequence) in a linked list
// description of moving data to maintain correct sequence when array
used

One mark per point:
1
2

2

Need to store pointers as well as data
More complex (to setup / implement)

One mark per point (Max 4):
1
2
3
4
5
6
7

4

Declare two (1D) arrays
One for data, one for pointers
Elements from same index represent one node
Declare an integer / variable for StartPointer // explain its use
Define appropriate value for null pointer // explain its use
Declare an integer / variable for FreeList pointer // explain its use
Routines are needed to add / delete / search

Alternative MP1, 2 and 3 for record-based implementation:
1
2
3

© UCLES 2022

Marks
4

One mark per point:
1

4(a)(iii)

October/November
2022

Define a record type with fields for data and pointer
Declare one (1D) array
...of the defined record type

Page 5 of 10

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question
5

October/November
2022

Answer
Mark as follows (Max 5):
1
2
3
4
5
6

Marks
5

Procedure heading and ending and declaration of both indexes
Loop to process all elements from Array1
Sum (any) three consecutive values from Array1 and divide by 3
in a loop
Convert result to Integer
Assign value to correct element of Array2 in a loop
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

Question
6(a)

Answer
One mark for any part correct (accept equivalent wording) (Max 1):
•

Condition evaluates to TRUE if bracket contents evaluate to FALSE:

•

Bracket contents evaluate to FALSE if:

•

Dots:
zero / less than one
or
Ats: not equal to one
or
Others: less than nine

•
•

© UCLES 2022

Page 6 of 10

Marks
1

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question
6(b)(i)

Answer

6(b)(ii)

© UCLES 2022

Marks

One mark for each area as outlined:

Index

NextChar

October/November
2022

5
Dots

Ats

Others

Valid

0

0

0

TRUE

1

'L'

1

2

'i'

2

3

'z'

3

4

'.'

5

'1'

4

6

'2'

5

7

'3'

6

8

'@'

9

'b'

7

10

'i'

8

11

'g'

9

12

'@'

1

1

2

FALSE

FALSE

1

Page 7 of 10

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question
7(a)(i)

October/November
2022

Answer

Marks

One mark per point (Max 7) as follows:
1
2
3
4
5
6.
7
8

7

Declaration of local variables for Par1 Par2 and Par3
Loop to end of (parameter) string // until operator is found
Extract a character in a loop...
Attempt at extraction of three parts of expression using substring
functions
Completely correct extraction of all three parts of expression
Convert string to Integer using STR_TO_NUM(<something
sensible>)
Attempt to interpret at least two operators (Par2): + - * /
Corresponding correct calculation (all operators) and final Output of
result

PROCEDURE Calculate(Expression : STRING)
DECLARE Val1, Val2, Index : INTEGER
DECLARE Result : REAL
DECLARE Par1, Par2, Par3 : STRING
CONSTANT
CONSTANT
CONSTANT
CONSTANT

PLUS = '+'
MINUS = '-'
MULTIPLY = '*'
DIVIDE = '/'

FOR Index  1 TO LENGTH(Expression) //search for
operator
ThisChar  MID(Expression, Index, 1)
IF IS_NUM(ThisChar) = FALSE THEN
Par1  LEFT(Expression, Index – 1)
Par2  ThisChar
Par3  RIGHT(Expression, LENGTH(Expression) –
Index)
ENDIF
NEXT Index
Val1  STR_TO_NUM(Par1)
Val2  STR_TO_NUM(Par3)
CASE OF Par2
PLUS
:
MINUS
:
MULTIPLY :
DIVIDE
:
ENDCASE

Result
Result
Result
Result




Val1
Val1
Val1
Val1

+
*
/

Val2
Val2
Val2
Val2

OUTPUT Result
ENDPROCEDURE

7(a)(ii)

© UCLES 2022

FUNCTION Calculate(Expression : STRING) RETURNS REAL

Page 8 of 10

1

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

9618/21

Question
7(b)

October/November
2022

Answer
Example string: "23/0" (Any divide by zero example)

Marks
2

Reason: The result is infinity / cannot be represented / is undefined // will
cause the program to crash

Answer

Question
8(a)

One mark for each point (Max 7) as follows:
1 Function heading and ending including parameter and return type
2 Declaration and initialisation of local Integer for Count
3 OPEN in READ mode and CLOSE
4 Conditional loop until EOF()
5
Read a line in a loop
6
If non-blank, increment count in a loop
7
Terminate loop when 10 non-blank lines have been read
8 Return Boolean in both cases

Marks
7

FUNCTION CheckFile(Thisfile : STRING) RETURNS BOOLEAN
DECLARE Valid : BOOLEAN
DECLARE ThisLine : STRING
DECLARE Count : INTEGER
Count  0
Valid  FALSE
OPEN ThisFile FOR READ
WHILE NOT EOF(ThisFile) AND Valid = FALSE
READFILE ThisFile, ThisLine
IF ThisLine <> "" THEN
Count  Count + 1
IF Count > 9 THEN
Valid  TRUE
ENDIF
ENDIF
ENDWHILE
CLOSEFILE ThisFile
RETURN Valid
ENDFUNCTION

8(b)

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

© UCLES 2022

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

Page 9 of 10

2

9618/21

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
8(c)

October/November
2022

Answer
Mark as follows:
1 Procedure heading and ending including parameters
2 Declaration and initialisation of local Integer value for ErrCount
3 Use of CheckFile(), output message and terminate if it returns
FALSE
4 Conditional loop until EOF()
5 ...or ErrCount > MaxErrors
6
Read line and use as parameter to CheckLine()in a loop
7
Test return value and increment ErrCount if non-zero in a loop
8 Output either message once only as appropriate

Marks
8

PROCEDURE CountErrors(ThisFile : STRING, MaxErrors :
INTEGER)
DECLARE ErrCount, ThisError : INTEGER
DECLARE ThisLine : STRING
ErrCount  0
IF CheckFile(ThisFile) = FALSE THEN
OUTPUT "That program file is not valid"
ELSE
OPEN ThisFile FOR READ
REPEAT
READFILE, ThisFile, ThisLine
ThisError  CheckLine(ThisLine)
IF ThisError <> 0 THEN
ErrCount  ErrCount + 1
ENDIF
UNTIL ErrCount > MaxErrors OR EOF(ThisFile)
IF EOF(ThisFile) = FALSE THEN
OUTPUT "Check terminated – too many errors"
ELSE
OUTPUT "There were ", ErrCount, " errors."
ENDIF
CLOSEFILE ThisFile
ENDIF
ENDPROCEDURE

8(d)

One mark for each (Max 2):

2

Examples:
1 Incorrect block structure. Missing keyword denoting part of block (for
example ENDPROCEDURE, ENDFUNCTION, ENDTYPE)
2 Data type errors, for example, assigning an integer value to a string
3 Identifier used before it is declared
4 Incorrect parameter use

© UCLES 2022

Page 10 of 10

Advertisement