Computer Science (9618) · May/June 2022 · Mark scheme 23

Cambridge Computer Science (9618) mark scheme for paper 23, May/June 2022 — 9618/23/M/J/22, file 9618_s22_ms_23.pdf.

Advertisement
Loading the paper…
Text of this paper

Cambridge International AS & A Level
COMPUTER SCIENCE

9618/23

Paper 23 Problem Solving & Programming

May/June 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 May/June 2022 series for most
Cambridge IGCSE, Cambridge International A and AS Level and Cambridge Pre-U components, and some
Cambridge O Level components.

This document consists of 11 printed pages.
© UCLES 2022

[Turn over

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

May/June 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 11

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
1(a)

May/June 2022

Answer

Marks

One mark per row

5

1(b)(i)

1 mark for any two rows correct
1 mark for all rows correct

2

1(b)(ii)

One mark from:

1



© UCLES 2022

To terminate a (conditional) loop when a value has been found
When the variable can take only one of two possible values
(Accept by example): When a variable is recording when an action has
been done e.g. Yes or No // light is on

Page 3 of 11

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
2

May/June 2022

Answer
Dependent marks
One mark for type; one mark for matching reason

Marks
4

Answers include:
Type:
Reason:

Adaptive
To accommodate a change in the requirement / technology /
legislation
e.g. a new HTML version is available

Type:
Reason:

Corrective
The program does not operate as expected / contains a bug
e.g. passwords are not hidden

Question
3(a)

Answer
One mark per point to show:

2

module relationships / hierarchy / selection / repetition // how a problem is
broken down
the parameters that are passed between the sub-tasks / modules //
whether a module is a function or a procedure
5

3(b)

One mark for each:
1
2
3
4
5

© UCLES 2022

Marks

Four boxes linked as shown correctly labelled (Order of lower 3 not
important)
Parameters to Sub1_A
Parameter to Sub1_B and return value
Parameters to Sub1_C
Selection diamond

Page 4 of 11

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
4

Answer

Marks
4

One mark per row 2 to 7 to Max 4
Type of
test data

Example
test value

Expected
return value

Explanation

Normal

153

"PASS"

Value within the acceptable
range

Abnormal

< 149

"FAIL"

Outside acceptable range /
too small

Abnormal /
Boundary

149

"FAIL"

Maximum unacceptable

Boundary /
Extreme /
Normal

150

"PASS"

Minimum acceptable

Boundary /
Extreme /
Normal

155

"PASS"

Maximum acceptable

Abnormal /
Boundary

156

"FAIL"

Minimum unacceptable

Abnormal

>156

"FAIL"

Question
5(a)(i)

May/June 2022

Outside acceptable range /
too large

Answer
TYPE Employee
DECLARE EmployeeNumber : INTEGER
DECLARE Name : STRING
DECLARE Department : STRING
DECLARE Born : DATE
DECLARE Attendance : REAL
ENDTYPE

Marks
4

One mark for each:
1.
2.
3.
4.
5(a)(ii)

TYPE Employee and ENDTYPE
Fields: EmployeeNumber and Name and Department
Field: Born
Field: Attendance

DECLARE Staff : ARRAY [1:500] OF Employee
One mark per underlined phrase

© UCLES 2022

Page 5 of 11

2

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
5(b)(i)

Answer

1

So that unused elements may be recognised when processing /
searching
Otherwise the element may contain old / unexpected data

Use of any 'impossible' field value, for example:



5(c)

Marks

Example answers to Max 1:

5(b)(ii)

1

An EmployeeNumber field. e.g. < 1
An empty string / impossible string e.g. "EMPTY" for name or department
DOB a long time ago...
Zero / Negative value for attendance

PROCEDURE Absentees()
DECLARE Index : INTEGER
FOR Index  1 TO 500
IF Staff[Index].EmployeeNumber <> −1 THEN
IF Staff[Index].Attendance <= 90 THEN
OUTPUT Staff[Index].EmployeeNumber
OUTPUT Staff[Index].Name
ENDIF
ENDIF
NEXT Index
ENDPROCEDURE

4
// not empty

Marks as follows to Max 4:
1
2
3
4
5

© UCLES 2022

May/June 2022

Procedure heading and ending and declaration of loop counter
loop through 500 elements
attempt to skip unused element
test Staff[Index].Attendance <= 90 in a loop
if so, output EmployeeNumber and Name fields in a loop

Page 6 of 11

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
6(a)

May/June 2022

Answer
FUNCTION Factorial(ThisNum : INTEGER) RETURNS INTEGER
DECLARE Value : INTEGER
IF ThisNum < 0 THEN
Value  -1
ELSE
Value  1
WHILE ThisNum <> 0
Value  Value * ThisNum
ThisNum  ThisNum – 1
ENDWHILE
ENDIF
RETURN Value
ENDFUNCTION
Marks as follows to Max 6:
1
2
3
4
5
6
7

Function heading and ending including parameter and return value
Declaration and initialisation (to 1) of local Integer Value for result
Check for illegal value (< 0)
(Conditional) loop while ThisNum not zero // loop for ThisNum iterations
Attempt to form answer by successive multiplication
Completely correct MP5
Return INTEGER value correctly in both cases: ThisNum < 0 and >= 0

ALTERNATIVE RECURSIVE SOLUTION:
FUNCTION Factorial(ThisNum : INTEGER) RETURNS INTEGER
IF ThisNum > 1 THEN
RETURN ThisNum * Factorial(ThisNum – 1)
ELSE
IF ThisNum = 1 OR ThisNum = 0 THEN
RETURN 1
ELSE
RETURN -1
ENDIF
ENDIF
ENDFUNCTION
Marks as follows:
1
2
3
4
5
6

© UCLES 2022

Function heading and ending including parameter and return value
Test for ThisNum > 1
and if so return product of Thisnum and Factorial(ThisNum-1)
Check for special case...
...return 1 for 0 and 1 and return −1 for negative values
Return INTEGER value (correctly in all cases)

Page 7 of 11

Marks
6

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
6(b)

May/June 2022

Answer
One mark for:
 Rows A, B AND C
 Each of rows D, E and F
Label

Question

Marks
4

Text

A

Is Num > 9?

B

YES

C

NO

D

Set <Identifier> to Factorial(Num)

E

OUTPUT "Factorial of ", Num, " is ", <Identifier>

F

Set Num to Num + 1 // Increment Num

Answer

Marks

7(a)(i)

The lines are output in an incorrect sequence / in the wrong order / not as
they appear in the file

1

7(a)(ii)

Description of error: (Max 2 marks)

4

If the final line of the file is not written into array element 3

then outputting the elements in the sequence 1 to 3 will give the error.

Explanation of error correction: (Max 2 marks)


Attempt at description of 'shuffle'
Copy Buffer[2] to Buffer[1] AND copy Buffer[3] to Buffer[2]
Read a line from the file and write it to Buffer[3]

OR


Store the index of the last element written to buffer (the last line of the
file)
Replace the FOR loop with something that starts at index
and then wraps around (MOD 3)

OR (two-loop solution, not using an array)
 Loop to read file to end to get number of lines
 close and re-open file
 read (and discard) lines to number of lines - 3, then loop to read and
output last 3 lines
7(b)

© UCLES 2022

If the number of lines in the text file is a multiple of three

Page 8 of 11

1

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
7(c)

May/June 2022

Answer
Correct answers include:
LineNum  (LineNum MOD 3) + 1 // ((LineNum + 3) MOD 3)
+ 1

Marks
2

One mark for assignment to LineNum making any use of MOD
One for completely correct statement
Question

Answer

8(a)

Marks
3

One mark for:
1
2
3
8(b)

(at least) three intermediate shapes with at least one valid stage names
Up and Down arrows between each pair of shapes
Design – Coding – Testing labels in correct sequence

Downward arrows: result from one stage is input / passed to the next

2

Upward arrows: more work is required at a previous stage to complete the
current stage
8(c)

For example:

1

Iterative / Rapid Application Development (RAD)

© UCLES 2022

Page 9 of 11

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
9(a)

May/June 2022

Answer
FUNCTION Generate() RETURNS STRING
DECLARE Password, Group : STRING
DECLARE NextChar : CHAR
DECLARE ACount, BCount : INTEGER
CONSTANT HYPHEN = '-'
Password  ""
FOR ACount  1 TO 3
Group  ""
FOR BCount  1 TO 4
REPEAT
NextChar  RandomChar()
UNTIL Exists(Group, NextChar) = FALSE
Group  Group & NextChar
NEXT BCount
Password  Password & Group & HYPHEN
NEXT ACount
Password  LEFT(Password, 14) // remove final hyphen
RETURN Password
ENDFUNCTION
Marks as follows to Max 7:
1
2
3
4
5
6
7
8

© UCLES 2022

Declaration and initialisation of Password as STRING
Outer loop for three groups / until password is complete // three group
loops
Attempt to use of both RandomChar() and Exists()in a loop
(Inner) loop for 4 characters in a group // note every 4 chars in a
loop
Conditional loop until char is unique
Concatenating unique character to Group in a loop
Concatenate Group / random character to Password in a loop
(Attempt to) insert hyphens between groups (or removing later) and
Return Password

Page 10 of 11

Marks
7

9618/23

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
9(b)

May/June 2022

Answer
FUNCTION AddPassword(Name, Password : STRING)
RETURNS BOOLEAN
DECLARE Index : INTEGER
DECLARE Added : BOOLEAN

Marks
6

Added  FALSE
Index  1
IF FindPassword(Name) = "" THEN // Domain name not in
// array
WHILE Added = FALSE AND Index <= 500
IF Secret[Index, 1] = "" THEN
Secret[Index, 1]  Name
Secret[Index, 2]  Encrypt(Password)
Added  TRUE
ELSE
Index  Index + 1
ENDIF
ENDWHILE
ENDIF
RETURN Added
ENDFUNCTION
Marks as follows:
1
2
3
4
5
6
9(c)

Check that the website domain name isn't already in array using
FindPassword() / linear search, otherwise:
(Conditional) loop while not added and not end of array
Check for unused element by testing value in column 1 in a loop
If unused, write parameter values to column 1 and 2 and set flag /
variable
...having used Encrypt() on the password
Return BOOLEAN value (correctly in all cases)

One mark per point to Max 3.

3

Solution based on field length:


Convert the length of the website domain name (either field) …
… to a string of fixed length
Form a string by concatenate this string with the other two (and write as
one line of the file)

Solution based on use of separator character:


© UCLES 2022

Select a (separator) character that cannot occur in the domain name (e.g.
space)
Create a string from the domain name followed by the separator
...Concatenate the encrypted password (and write as one line of the file)

Page 11 of 11

Advertisement