Computer Science (9618) · Oct/Nov 2023 · Mark scheme 21
Cambridge Computer Science (9618) mark scheme for paper 21, Oct/Nov 2023 — 9618/21/O/N/23, file 9618_w23_ms_21.pdf.
Text of this paper
www.dynamicpapers.com
Cambridge International AS & A Level
COMPUTER SCIENCE
9618/21
Paper 2 Fundamental Problem-solving and Programming Skills
October/November 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 October/November 2023 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 2023
[Turn over
9618/21
Cambridge International AS & A Level – Mark
Scheme
October/November
www.dynamicpapers.com
PUBLISHED
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 10
9618/21
Cambridge International AS & A Level – Mark
Scheme
October/November
www.dynamicpapers.com
PUBLISHED
2023
Mark scheme abbreviations
/ separates alternative words / phrases within a marking point
// separates alternative answers within a marking point
underline actual word given must be used by the candidate (grammatical variants accepted)
max indicates the maximum number of marks that can be awarded
( ) the word / phrase in brackets is not required but sets the context
© UCLES 2023
Page 3 of 10
Cambridge International AS & A Level – Mark
Scheme
October/November
www.dynamicpapers.com
PUBLISHED
2023
9618/21
Question
1(a)
Answer
Marks
One mark per row:
4
Answer
The value assigned to Level when ThisValue is 40
"Medium"
The value assigned to Check when ThisValue is 36
12
The value assigned to Level when ThisValue is 18
"Low"
The number of elements in array Data that may be
incremented
1(b)
11
One mark for identifying assignment:
MP1 Level
3
"Very Low" // the level is assigned value “very low”
Explanation points:
MP2 because CASE clauses are checked in sequence // because of the order
of the clauses
MP3 a value < 30 satisfies the first clause // Clause '< 20' will never be tested
1(c)
MP1 all of the possible values are addressed via all / four / three / the other
clauses // there are no other possible values to map to OTHERWISE
1
1(d)
One mark per point:
3
•
•
•
© UCLES 2023
ThisValue: INTEGER
Check:
REAL
Level:
STRING
Page 4 of 10
Cambridge International AS & A Level – Mark
Scheme
October/November
www.dynamicpapers.com
PUBLISHED
2023
9618/21
Question
2(a)
Answer
Max 5 marks
MP1
MP2
MP3
MP4
MP5
MP6
2(b)
Question
Marks
5
Set total to zero
Input a number
Check if number greater than 29 and less than 71
… if check is true - add number to total
Repeat from step 2 99 times // for a total of 100 iterations
Output the total
MP1 An iterative construct // a (count-controlled) loop
MP2 A selection construct // an IF statement
Answer
3(a)
2
Marks
3
MP1 all values in the order and location shown
MP2 TopOfStack value is index of element containing D1
MP3 BottomOfStack value is index of element containing D2
3(b)
MP1 If TopOfStack = 8 // (stack) full then return FALSE
MP2 Otherwise, increment TopOfStack
MP3 Use TopOfStack as an index to the Array
MP4 Set the element at this index / location / position to the value / data /
item being added
MP5 Return TRUE
© UCLES 2023
Page 5 of 10
5
Cambridge International AS & A Level – Mark
Scheme
October/November
www.dynamicpapers.com
PUBLISHED
2023
9618/21
Question
Answer
Marks
4(a)
FUNCTION TooMany(Search : STRING, Max : INTEGER) RETURNS
BOOLEAN
DECLARE Count, Index : INTEGER
6
Count 0
FOR Index 1 TO 150
IF Data[Index] = Search THEN
Count Count + 1
ENDIF
NEXT Index
IF Count > Max THEN
RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ENDFUNCTION
MP1
MP2
MP3
MP4
MP5
Function heading, ending and return type
Declare Count and Index as integers
Initialise Count
Loop (any type) for 150 iterations
Compare Data element with parameter - if equal, increment Count in a
loop
MP6 Compare Count with Max and return Boolean in both cases outside the
loop
4(b)
MP1 Test for row being even number
MP2 Test for either column value equal to Search
IF Row MOD 2 = 0 AND __
(Data[Row, 1] = Search OR Data[Row, 2] = Search) THEN
ALTERNATIVE using nested IFs:
IF Row MOD 2 = 0 THEN
IF Data[Row, 1] = Search OR Data[Row, 2] = Search THEN
MP3 Selection structure is either:
• Single IF statement using AND, or
• Two nested IFs using AND, or
• Single IF and the use of a two-iteration loop
Either of these structures correctly formed scores the mark
ALTERNATIVE SOLUTION: A FOR loop using ‘STEP 2’
FOR Row 2 TO 150 / NEXT Row
STEP 2
Data[Row, 1] = Search OR Data[Row, 2] = Search) THEN
© UCLES 2023
Page 6 of 10
3
9618/21
Cambridge International AS & A Level – Mark
Scheme
October/November
www.dynamicpapers.com
PUBLISHED
2023
Question
Answer
Marks
MP1 Num > Min should be Num < Min
MP2 Count & 1 should be Count + 1
MP3 NextInput "END" should be NextInput = "END"
3
5(b)(i)
MP1 If all the numeric input values are greater than 999 // If there are no
numeric values in the sequence
MP2 then the minimum will be given as 999 (and not one of the input values)
2
5(b)(ii)
Many possible correct answers, for example:
2
5(a)
MP1
Mixture non-numeric and numeric with 3 or 4 values - with all numerics
greater than 999
Examples:
1325, DOG, 7868, 7615
// SNAKE, 3478, SPIDER
MP2 Final value: END
Question
6(a)
Answer
PROCEDURE MyOutput(NewString : STRING, EOL : BOOLEAN)
IF LENGTH(MyString) + LENGTH(NewString) > 255 THEN
OUTPUT MyString // Resulting string would be too
long
MyString NewString
ELSE
MyString MyString & NewString // Concat with
MyString
IF EOL = TRUE THEN
OUTPUT MyString
MyString ""
ENDIF
ENDIF
ENDPROCEDURE
MP1 Procedure heading, including parameters, and ending
MP2 Produce concatenated string
MP3 … Check whether resulting string would be too long
MP4 If so, then output old MyString
MP5 … and assign NewString to MyString
MP6 Else concatenate NewString to MyString
MP7 (test for length < 255) Test EOL – If TRUE then Output
MP8 … and reset MyString to empty string
© UCLES 2023
Page 7 of 10
Marks
7
Cambridge International AS & A Level – Mark
Scheme
October/November
www.dynamicpapers.com
PUBLISHED
2023
9618/21
Question
6(b)
Answer
MP1 A new (instance of) variable MyString is created each time the
procedure is called / executed
MP2 So the previous contents are lost
Question
Answer
7
2
Marks
5
MP1
MP2
MP3
MP4
MP5
© UCLES 2023
Marks
S2 labelled
S3, S4 and S5 added
Line from S1 to S3
All three lines between S2 and S5 (including S5 to S5)
Line from S5 to S3 AND from S3 to S4
Page 8 of 10
9618/21
Cambridge International AS & A Level – Mark
Scheme
October/November
www.dynamicpapers.com
PUBLISHED
2023
Question
Answer
8(a)
PROCEDURE SendFile(FileName, DestID : STRING, Port :
INTEGER)
DECLARE FileData : STRING
Marks
7
CONSTANT STX = CHR(02)
CONSTANT ETX = CHR(03)
OPENFILE FileName FOR READ
WHILE NOT EOF(FileName)
READFILE FileName, FileData
FileData STX & DestID & MyID & FileData & ETX
CALL Transmit(FileData, Port)
ENDWHILE
CLOSEFILE FileName
CALL Transmit(STX & DestID & MyID & "****" & ETX,
Port)
ENDPROCEDURE
Mark as follows:
MP1 OPEN file in READ mode – using parameter - and subsequently CLOSE
MP2 Conditional loop to EOF()
MP3 Use of READFILE to get a line from the file
MP4 ‘Attempt’ to form a message (minimum is DestID, MyID, FileData)
MP5 Message formed is completely correct
MP6 Call Transmit() with correct MP4 string in a loop
MP7 Transmit the "****" message (all parts present) after the loop
8(b)
Max 2 marks
2
MP1 Indicates that all the lines of the file have been sent // it is the end of the
transmission / file transfer
MP2 So that the receiving program can stop waiting for further data
MP3 The file can be closed / saved
8(c)(i)
MP1 A message cannot contain a zero-length data field
MP2 … so a blank line cannot be sent // there is no way to send a blank line
2
8(c)(ii)
MP1 Append a (special) character to the start of the message text
MP2 interpret the new field data as a blank line
2
ALTERNATIVE
MP1 Change the message protocol and use an additional field to act as an
indicator
MP2 Interpret the new field data
© UCLES 2023
Page 9 of 10
Cambridge International AS & A Level – Mark
Scheme
October/November
www.dynamicpapers.com
PUBLISHED
2023
9618/21
Question
Answer
8(d)
FUNCTION GetField(Msg : STRING, FieldNo : INTEGER)
RETURNS STRING
DECLARE RetString : STRING
CASE OF FieldNo
1 : RetString MID(Msg, 2, 3)
2 : RetString MID(Msg, 5, 3)
3 : RetString MID(Msg, 8, LENGTH(Msg) - 8)
OTHERWISE : RetString ""
ENDCASE
RETURN RetString
ENDFUNCTION
Use of CASE ... ENDCASE or IF ... THEN ... ENDIF
Field 1 and Field 2 extracted correctly
Calculate a length of field 3
Field 3 extracted correctly
Return empty string in case of invalid parameter (via OTHERWISE or
initialisation)
MP6 Final RETURN, after a reasonable attempt
MP1
MP2
MP3
MP4
MP5
© UCLES 2023
Page 10 of 10
Marks
6