Computer Science (9618) · May/June 2023 · Mark scheme 21
Cambridge Computer Science (9618) mark scheme for paper 21, May/June 2023 — 9618/21/M/J/23, file 9618_s23_ms_21.pdf.
Text of this paper
Cambridge International AS & A Level
COMPUTER SCIENCE
9618/21
Paper 2 Fundamental Problem-solving and Programming Skills
May/June 2023
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 2023 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 2023
[Turn over
9618/21
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
May/June 2023
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 2023
Page 2 of 11
9618/21
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
1(a)
May/June 2023
Answer
Marks
For example:
4
Could set a breakpoint to stop the program at a particular point / instruction
then the value of variables could be checked using a report/watch window
while single stepping can be used to execute one statement/line at a time.
Marks available as follows:
One mark for each underlined term
One mark for an explanation of each term
Note: max 4 marks
1(b)
3
One mark for correct description of:
Error 1: Brackets mismatch // 2/value should be added after
brackets/function // Addition between a string and a number is not valid //
STR_TO_NUM / the function needs to be passed a string / not an integer
Error 2: No Error
Error 3: MONTH() returns an integer and this is being compared with a
character/string // Integer cannot be compared to a string // 6 should not be
in quotes
2
1(c)(i)
Expression
Evaluation
1
(Points > 99) OR Active
TRUE
2
(Points MOD 2 = 0) OR Exempt
FALSE
3
(Points <= 75) AND (Active OR Exempt)
TRUE
4
(Active OR NOT Active) AND NOT Exempt
TRUE
One mark for any two rows correct
Two marks for all rows correct
1(c)(ii)
© UCLES 2023
NOT Exempt
1
Page 3 of 11
9618/21
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
May/June 2023
Answer
Marks
4
2(a)
One mark per point:
1
2
3
4
5
Both prompts
Both inputs using correct identifiers as given in question, MyChar and
MyCount
Initialise MyString to empty string and subsequent output after loop
Loop MyCount iterations including decrement MyCount
Use of Concatenate or equivalent pseudocode statement inside loop
Max 4 Marks
2(b)
One mark for declaration:
3
DECLARE StartDate : DATE
One mark for each underlined part of assignment:
StartDate
© UCLES 2023
SETDATE (15, 11, 2005)
Page 4 of 11
9618/21
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
3(a)(i)
May/June 2023
Answer
One mark for structure
Marks
4
Structure: Record
One mark for each point
Advantage:
A set of data / all data related to one customer
of different types
is held under a single identifier/entity
3(a)(ii)
A (1D) array of records // An array of the given type could be used
2
One mark per underlined word
3(b)
5
One mark for reference to each:
1
2
3
4
5
6
Reference to the use of constants or variables for the two threshold
values of 10 and 100 // Input amount spent (by customer and store in a
numeric variable)
Work out one band that amount maps to
Work out all bands that amount maps to
Calculate rounded value of amount / whole number part of amount
Calculate the points by multiplying the (rounded) amount by the
appropriate value for appropriate band /all bands
Output the number of points
Note: Max 5 from available points
© UCLES 2023
Page 5 of 11
9618/21
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
May/June 2023
Question
Answer
4
Function Replace(OldString : STRING, Char1, Char2 :
CHAR) __ RETURNS : STRING
DECLARE NewString : STRING
DECLARE ThisChar : CHAR
DECLARE Index : INTEGER
Marks
6
NewString ""
FOR Index 1 TO LENGTH(OldString)
ThisChar MID(OldString, Index, 1)
IF ThisChar = Char1 THEN
ThisChar Char2
ENDIF
NewString NewString & ThisChar
NEXT Index
RETURN NewString
ENDFUNCTION
Mark as follows:
1 Function heading and ending, including parameters and return type
2 Declaration of local variables used including loop counter
3 Loop for length of OldString
4
Extract char and test in a loop
5
Use of concatenate to build NewString replace char if necessary,
in a loop
6 Return NewString after reasonable attempt
Question
Answer
5(a)(i)
Reasons include:
1 No working software until late in the life cycle so slower to market than
competitors // Does not allow the creation of early versions/prototypes
(which can be updated later)
2 More difficult/slower to cope with changes to the requirements //
website slower to be updated to reflect new requirements
3 Needs high involvement/feedback of the stake holders /customer / client
Marks
2
One mark per point
Max 2 marks
5(a)(ii)
© UCLES 2023
Iterative / Rapid Application Development / RAD
Page 6 of 11
1
9618/21
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
5(b)
May/June 2023
Answer
Marks
3
One mark for Stage
Stage: Beta testing
Max 2 marks for Description
Description:
1 Testing carried out by a small group of (potential) users
2 Users will check that the website/software works as required / works in
the real world //User will identify errors in the website/software
3 Users will feedback (problems) / suggestions for improvement
4 Problems / suggestions identified are addressed (before the program is
sold)
Question
6
Answer
PROCEDURE Mix()
DECLARE Count, Total ThisNum : INTEGER
DECLARE ThisUser, ThisSample : INTEGER
FOR ThisSample 1 TO 128
Count 0
Total 0
FOR ThisUser 1 TO 6
IF Sample[ThisUser, ThisSample] > 10 THEN
Count Count + 1
Total Total + Sample[ThisUser, ThisSample]
ENDIF
NEXT ThisUser
Result[ThisSample] INT(Total / Count)
NEXT ThisSample
ENDPROCEDURE
Mark as follows:
1
2
3
4
5
6
7
Declaration and initialisation before inner loop of Count and Total
Outer Loop for 128 iterations
Inner loop for six iterations
Test for sample > 10 in a loop
and if true sum Total and increment Count
Calculate average value and assign to Result array after inner loop
and within outer loop
Use of INT()/ DIV to convert average to integer
Max 6 Marks
© UCLES 2023
Page 7 of 11
Marks
6
9618/21
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
7(a)
Answer
May/June 2023
Marks
3
Examples include:
Module: GetOverdueLoan()
Use: Identifies an overdue book
Module: IdentifyStudent()
Use: Identifies a student (with an overdue book)1
Module: GetStudentEmail()
Use: Gets the email address of a student with an overdue book
Module: CreateEmail()
Use: Generates an email to a student with an overdue book
Module: SendEmail()
Use: Sends an email to a student with an overdue book
One mark for name and use
Note: Max 3 marks
7(b)(i)
One mark per point:
Module-A calls the other three modules
The process is repeated
3
7(b)(ii)
One mark per bullet point:
All rectangles correctly labelled and interconnected
All and only parameters as shown
Selection diamond
© UCLES 2023
2
Page 8 of 11
9618/21
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
8(a)
May/June 2023
Answer
FUNCTION IsNewSupp(ThisString : STRING) RETURNS BOOLEAN
DECLARE Index : INTEGER
DECLARE ThisChar : CHAR
IF LENGTH(ThisString) <> 5 THEN
RETURN FALSE
// invalid SupplierCode length
ENDIF
IF SuppExists(ThisString) THEN
RETURN FALSE
// SupplierCode already exists
ENDIF
FOR Index 1 TO 5
ThisChar TO_LOWER(MID(ThisString, Index, 1))
IF ThisChar < 'a' OR ThisChar > 'z'THEN
RETURN FALSE
ENDIF
NEXT Index
RETURN TRUE
ENDFUNCTION
Mark as follows:
1
2
3
4
5
6
7
© UCLES 2023
Check ThisString is exactly 5 characters in length
Use of SuppExists() with a string of 5 characters as a parameter
Loop for 5 iterations // loops for length of string parameter
Extract a character in a loop
Test if char is alphabetic in a loop
…catering for both upper and lower case
Return Boolean following a reasonable attempt
Page 9 of 11
Marks
7
9618/21
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
8(b)
May/June 2023
Answer
FUNCTION CheckNewItem(NewLine : STRING) RETURNS BOOLEAN
DECLARE NotFound : BOOLEAN
DECLARE NewItemNum, ThisItemNum, ThisLine : STRING
Marks
7
NotFound TRUE
OPENFILE "Stock.txt" FOR READ
NewItemNum LEFT(NewLine, 4)
ThisItemNum "0000" //rogue initial value
WHILE NOT EOF("Stock.txt") AND NotFound = TRUE AND__
ThisItemNum < NewItemNum
READFILE("Stock.txt", ThisLine) //brackets optional
ThisItemNum LEFT(ThisLine, 4)
IF ThisItemNum = NewItemNum THEN
NotFound FALSE
ENDIF
ENDWHILE
CLOSEFILE "Stock.txt"
RETURN NotFound
ENDFUNCTION
Mark as follows:
1
2
3
4
5
6
7
8
Open Stock.txt in READ mode and subsequently close
Extract NewItemNum from parameter
Conditional loop until EOF("Stock.txt")
... OR NewItemNum found
... OR when ThisItemNum < NewItemNum
Read a line from Stock.txt AND extract ThisItemNum in a
loop
If ThisItemNum = NewItemNum then terminate loop / set flag in
a loop
Return Boolean after reasonable attempt
Max 7 marks
Max 6 if function wrapper (heading and ending) missing or incorrect
8(c)(i)
Integration testing
1
8(c)(ii)
Two marks for the description:
2
8(d)
© UCLES 2023
A dummy/simple module is written to replace the module that does not
work properly
The dummy/simple module will return an expected value // will output a
message to show it has been called
Append
1
Page 10 of 11
9618/21
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
8(e)
Answer
One mark for each part:
© UCLES 2023
May/June 2023
Marks
3
The algorithm / search / iteration can stop /only iterates
if the current value read from the file // current line in file
is greater than the value being searched for
Page 11 of 11