Computer Science (9618) · Oct/Nov 2021 · Mark scheme 23
Cambridge Computer Science (9618) mark scheme for paper 23, Oct/Nov 2021 — 9618/23/O/N/21, file 9618_w21_ms_23.pdf.
Text of this paper
Cambridge International AS & A Level
COMPUTER SCIENCE
9618/23
Paper 2 Problem Solving & Programming
October/November 2021
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 2021 series for most
Cambridge IGCSE™, Cambridge International A and AS Level components and some Cambridge O Level
components.
This document consists of 11 printed pages.
© UCLES 2021
[Turn over
9618/23
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
October/November
2021
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 2021
Page 2 of 11
9618/23
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
1(a)(i)
Answer
Marks
1
One from:
•
The program obeys the rules / grammar of the programming language
used
The program will run // it can be compiled / interpreted
Accept by example. e.g. 'no mis-spelt keywords' / 'all brackets match'
•
•
1(a)(ii)
October/November
2021
One mark for type plus one for corresponding description
2
Type of error: A logic error
Description:
• An error in the algorithm / design of the solution
• the program does not behave as expected / give the expected output.
• Accept by example e.g. wrong arithmetic operator used / wrong loop
count
OR
Type of error: Run-time error
Description:
• The program performs an illegal instruction / invalid operation
• Accept by example: divide by zero or endless loop or simply 'crashes' /
freezes
1(b)
Use of variable
Data type
The average mark in a class of 40 students
REAL
An email address
STRING
The number of students in the class
INTEGER
Indicate whether an email has been read
BOOLEAN
One mark per row
© UCLES 2021
Page 3 of 11
4
9618/23
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
October/November
2021
Answer
1(c)(i)
Information
Departure time
Essential
3
Aircraft type
Ticket price
Not essential
Flight Number
Departure airport
Marks
Number of seats in aircraft
One mark for two rows correct
Two mark for four rows correct
Three mark for all rows correct
1(c)(ii)
One mark for technique and one for benefit, Max 1 mark for 'Benefit'
2
Technique: Abstraction
Benefit:
• The solution is simplified so easier / quicker to design / implement
• The system is tailored to the need of the user
1(c)(iii)
Answers include:
•
•
•
•
•
2
Destination / arrival airport
Arrival time / flight duration
Date of flight
Seat number
Seat availability
Max 2 marks
Question
2(a)
Answer
6
One mark for reference to:
1
2
3
4
5
6
7
The use a variable as an index to the array
A loop to iterate through the array
An Inner loop (with a reducing range)
Test if current element is greater than next element
if so then swap elements
Description of swap
Attempt at efficient algorithm
Max 6 marks
© UCLES 2021
Marks
Page 4 of 11
9618/23
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
2(b)
October/November
2021
Answer
Count ← 1
Flag ← FALSE
WHILE Flag = FALSE AND Count <= 5
CALL ReBoot()
Count ← Count + 1
Flag ← Check()
ENDWHILE
Marks
6
IF Flag = FALSE THEN
CALL Alert(27)
ENDIF
One mark per point:
1
2
3
4
5
6
Initialisation of Count AND Flag
WHILE ... ENDWHILE // REPEAT ... UNTIL loop
... including both conditions
Call ReBoot() AND increment Count inside the loop
Assign return value from Check() to Flag inside the loop
Final test of Flag AND call to Alert(27) not in a loop
Question
3(a)(i)
Answer
One mark per point:
•
•
3(a)(ii)
One mark for each bullet
2
Value "Frog" // value pointed to by FoQ / location 0 is assigned to variable
AnimalName
FoQ pointer will move to point to location 1 / point to "Cat" // incremented
FoQ (by 1)
•
© UCLES 2021
2
EoQ pointer will move to point to location 4 // incremented EoQ (by 1)
Data value "Octopus" will be stored in location pointed to be EoQ /
location 4
•
3(a)(iii)
Marks
0
Frog
1
Cat
2
Fish
3
Elk
← Front of queue pointer
← End of queue pointer
There is only one data item in the queue
Page 5 of 11
1
9618/23
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
3(b)(i)
Answer
One mark for data values plus one mark for pointers
0
Frog
1
Cat
2
Fish
3
Elk
4
Wasp
5
Bee
6
Mouse
October/November
2021
Marks
3
← Front of queue pointer
← End of queue pointer
7
One mark for each pointer
One mark for three new data values
3(b)(ii)
0
Shark
1
(Cat)
2
(Fish)
3
(Elk)
4
Wasp
5
Bee
6
Mouse
7
Dolphin
← End of queue pointer
2
← Front of queue pointer
One mark for BOTH pointers
One mark for all data values as shown
3(c)
1
2
3
© UCLES 2021
3
One mark per point:
If incremented EoQ = FoQ then error condition: queue is full
Increment the EoQ
Manage wrap-around
Page 6 of 11
9618/23
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
October/November
2021
Answer
4(a)
Marks
Test
Test data value
Explanation
Expected Outcome
1
23
Normal Data
Data is accepted
2
0
Boundary Data
Data is accepted
3
40
Boundary Data
Data is accepted
4
>= 41
Abnormal Data
Data is rejected
5
<= −1
Abnormal Data
Data is rejected
4
One mark per row for rows 2 to 5.
4(b)
3
One mark for each label:
•
•
•
Temp < 10 (Heaters Off to Heaters On)
Temp > 20 (Heaters On to Heaters Off)
on BOTH loops (non-contradictory values)
Question
5(a)
5(b)
© UCLES 2021
Answer
One mark for the character and one for the corresponding reason.
•
Character: Any except alphabetic, numeric, ',' ':' or space
•
Reason: character doesn't occur in data to be recorded
Design
Marks
2
1
Page 7 of 11
9618/23
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
5(c)
October/November
2021
Answer
FUNCTION LogEvents(StudentID : STRING) RETURNS INTEGER
DECLARE FileData : STRING
DECLARE Index, Count : INTEGER
CONSTANT LogFile = "LogFile"
Count ← 0
OPENFILE LogFile FOR APPEND
FOR Index ← 1 TO 2000
FileData ← LogArray[Index]
IF LEFT(FileData, 6) = StudentID THEN
WRITEFILE (LogFile, FileData) //brackets optional
Count ← Count + 1
LogArray[Index] ← ""
// clear the element
ENDIF
NEXT Index
CLOSEFILE LogFile
RETURN Count
ENDFUNCTION
1 mark for each of the following:
1
2
3
4
5
6
7
© UCLES 2021
Function heading and ending including parameter and return type
OPEN file LogFile for APPEND and subsequent CLOSE
Loop for 2000 iterations
Extract first 6 characters from array element in a loop
Compare first 6 characters with parameter in a loop
If equal:
• write whole array element string to file and
• increment Count and
• clear array element in a loop
Return Count (must have been declared and initialised)
Page 8 of 11
Marks
7
9618/23
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
6(a)
Answer
PROCEDURE SetRow(Row, SkipNum, SetNum : INTEGER)
DECLARE Col : INTEGER
// array is 1280 x 800
FOR Col ← SkipNum + 1 TO SkipNum + SetNum
Screen[Row, Col] ← 1
NEXT Index
ENDPROCEDURE
ALTERNATIVE 1:
FOR Col ← 1 TO SetNum
Screen[Row, SkipNum + Col] ← 1
NEXT Col
ALTERNATIVE 2:
WHILE SetNum > 0
Screen[Row, SkipNum + SetNum] ← 1
SetNum ← SetNum - 1
ENDWHILE
Mark as follows:
1
2
3
4
5
© UCLES 2021
Procedure heading and ending including parameters
Declaration of local Integer for Col
Count-controlled loop with meaningful start number
correct stop number
Reference Screen Array element and set to 1 in a loop
Page 9 of 11
October/November
2021
Marks
5
9618/23
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
October/November
2021
Question
Answer
6(b)
FUNCTION SearchInRow(ThisRow, StartCol : INTEGER) RETURNS
INTEGER
DECLARE ThisCol, Step : INTEGER
DECLARE Found: BOOLEAN
// array is 1280 x 800
Found ← FALSE
ThisCol ← StartCol
// first decide which way to search
IF StartCol = 1 THEN
Step ← 1
EndCol ← 1281
ELSE
Step ← -1
EndCol ← 0
ENDIF
WHILE ThisCol <> EndCol AND Found = FALSE
IF Screen[ThisRow, ThisCol] <> 1 THEN
ThisCol ← ThisCol + Step
ELSE
Found ← TRUE
ENDIF
ENDWHILE
IF Found = FALSE THEN
ThisCol ← -1
ENDIF
RETURN ThisCol
ENDFUNCTION
Mark as follows:
1 Interpreting StartCol parameter to determine direction of search
2 An attempt at searching both up and down
3 Conditional Loop / Count-controlled loop with use of ThisCol index
4 Using correct values for StartCol, EndCol and Step
5
Reference a Screen element and compare with 1 in a loop
6
If equal save column or immediately Return column in a loop
7 Return column number or −1
Loop(s) terminate when element with value = 1 found
Max 7 marks if function heading, including return type, and ending is incorrect
or incomplete
© UCLES 2021
Page 10 of 11
Marks
8
9618/23
Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Question
6(c)
October/November
2021
Answer
FUNCTION GetCentreCol(ThisRow : INTEGER) RETURNS INTEGER
DECLARE StartCol, EndCol, CentreCol : INTEGER
StartCol ← SearchInRow(ThisRow, 1)
IF StartCol = -1 THEN
CentreCol ← StartCol
ELSE
EndCol ← SearchInRow(ThisRow, 1280)
CentreCol ← INT((StartCol + EndCol)/2)
ENDIF
RETURN CentreCol
ENDFUNCTION
Mark as follows:
1
2
3
4
5
6
Declaration of local INTEGER for return value
Use SearchInRow() with correct parameters and check for -1
Use SearchInRow(ThisRow, 1) and SearchInRow(ThisRow,
1280)
Calculate centre column
Use of INT() function // use of DIV
Return –1 or centre value
Max 5 marks if function heading, including return type, and ending is incorrect
or incomplete
© UCLES 2021
Page 11 of 11
Marks
6