Computer Science (9608) · Oct/Nov 2020 · Mark scheme 22

Cambridge Computer Science (9608) mark scheme for paper 22, Oct/Nov 2020 — 9608/22/O/N/20, file 9608_w20_ms_22.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge International AS & A Level
COMPUTER SCIENCE

9608/22

Paper 2 Written Paper

October/November 2020

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 2020 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 24 printed pages.
© UCLES 2020

[Turn over

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Generic Marking Principles

October/November 2020
www.dynamicpapers.com

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.

© UCLES 2020

Page 2 of 24

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

October/November 2020
www.dynamicpapers.com

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 2020

Page 3 of 24

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
1(a)

Answer
One mark for both answers:
•
•

October/November 2020
www.dynamicpapers.com

Marks
1

Process
Output

Order not important.
1(b)

One mark per bullet point (or equivalent)

2

They all represent:
•
•
1(c)

A solution to a problem / a way to perform a task
Expressed as a sequence / series of steps / stages / instructions
4

1 mark per row to max 4 marks
Example answers:
Data type

Example data value

BOOLEAN

FALSE

STRING

"Happy"

INTEGER

18

REAL

31234.56

CHAR

'H'

DATE

10/01/2019

Each row must be a different data type together with an appropriate value

© UCLES 2020

Page 4 of 24

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
1(d)

© UCLES 2020

Answer
Max 3 marks, one mark for each correct line

October/November 2020
www.dynamicpapers.com
Marks
3

Page 5 of 24

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
1(e)

Answer
1 mark for two rows correct, 2 marks for all rows correct.
Expression

© UCLES 2020

October/November 2020
www.dynamicpapers.com
Marks
2

Evaluates to

NOT FlagB AND FlagC

TRUE

NOT (FlagB OR FlagC)

FALSE

(FlagA AND FlagB) OR FlagC

TRUE

NOT (FlagA AND FlagB) OR NOT FlagC

TRUE

Page 6 of 24

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
2(a)

Answer

Marks
6

DECLARE A, B, C : INTEGER
DECLARE Average : REAL
INPUT A
REPEAT
INPUT B
UNTIL B <> A
REPEAT
INPUT C
UNTIL C <> A AND C <> B
Average ← (A + B + C) / 3
OUTPUT Average
IF A > B AND A > C
THEN
OUTPUT A
ELSE
IF B > A AND B > C
THEN
OUTPUT B
ELSE
OUTPUT C
ENDIF
ENDIF
Mark as follows:
1 Declaration of all variables used (at least A, B and C)
2 Uniqueness test on A, B and C
3 Loop(s) to repeat until three unique values have been entered
4 Calculation of average value
5 Determine the largest value
6 Output of average value and largest value

© UCLES 2020

October/November 2020
www.dynamicpapers.com

Page 7 of 24

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
2(b)

Answer

5
Evaluates to

"ALARM: " & RIGHT("Time: 1202",4)

"ALARM: 1202"
"wise"

MID("Stepwise.",5, 4)
1.5 * LENGTH("OnePointFive")

18
"27.5"

NUM_TO_STRING(27.5)
DIV(9, 4)

2

3

One mark per point, example points:
1
2
3

© UCLES 2020

Marks

One mark per correct row
(Completed parts shown in bold)
Expression

2(c)

October/November 2020
www.dynamicpapers.com

Subtasks make the solution more manageable // make the algorithm easier to follow
A subtask makes the problem easier to solve / design / program than the whole task
A subtask is useful when a part of the algorithm is repeated

Page 8 of 24

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
3(a)

October/November 2020
www.dynamicpapers.com

Answer
'Pseudocode' solution included here for development and clarification of mark scheme.
Programming language example solutions appear in the Appendix.
FUNCTION CheckSkid() RETURNS BOOLEAN
DECLARE Rot : ARRAY[1:4] OF INTEGER
DECLARE Average : REAL
DECLARE ThisRot : INTEGER
DECLARE Danger : BOOLEAN
FOR Index ← 1 TO 4
REPEAT
OUTPUT "Input Rotation speed for wheel ",Index
INPUT ThisRot
UNTIL ThisRot >= 0 AND ThisRot <= 1000
Rot[Index] ← ThisRot
ENDFOR
Average ← (Rot[1] + Rot[2] + Rot[3] + Rot[4]) / 4
Danger ← FALSE
FOR Index ← 1 TO 4
IF Rot[Index] > (Average * 1.1) OR Rot[Index] < (Average * 0.9)
THEN
Danger ← TRUE
ENDIF
ENDFOR
IF Danger = TRUE
THEN
OUTPUT "Skid Danger"
ENDIF
RETURN Danger
ENDFUNCTION

© UCLES 2020

Page 9 of 24

Marks
8

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
3(a)

Answer

Function heading and ending
Declare local integers for 4 rotation values and a real for the average / tolerance
Prompt and input four rotation values
Validate each input value in a loop
Calculate average rotation AND calculate acceptable max and min (or single tolerance, or alternative method)
Compare rotational value of each wheel
Test if rotational value of (each) wheel is within the acceptable range
Output a warning message and return the correct value in all cases
2

Example answers:
Test1 – No Skid detected
Value 1

Value2

Value 3

Value 4

100

100

100

100

One of:
Test2 – Skid detected (one wheel too fast)
Value 1

Value2

Value 3

Value 4

100

100

100

160

Test2 – Skid detected (one wheel too slow)
Value 1

Value2

Value 3

Value 4

100

100

100

40

Independent marks: one mark each for Test1 and Test 2
© UCLES 2020

Marks

1 mark for each of the following:
1
2
3
4
5
6
7
8

3(b)

October/November 2020
www.dynamicpapers.com

Page 10 of 24

9608/22
Question

Cambridge International AS & A Level – Mark Scheme
PUBLISHED
Answer

Marks
7

4(a)
Mark as follows:
• One mark for START and END
• One mark per area outlined

Outputs from conditional diamond must have at least one label

© UCLES 2020

October/November 2020
www.dynamicpapers.com

Page 11 of 24

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
4(b)(i)

Answer

Marks
5

One mark per region as indicated.
Strin
g1

String
2

Len1

RetFl
ag

X

"SUB"

"BUS"

3

TRUE

1

Len
2

NextCh
ar

New

3

'S'

""

y

"B"

1

"BU"

2
3

"BU"

2
2

'U'

""
1
"B"

"B"

2

3
1

'B'

""
1

""

© UCLES 2020

October/November 2020
www.dynamicpapers.com

Page 12 of 24

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question

October/November 2020
www.dynamicpapers.com

Answer

Marks

4(b)(ii)

TRUE

1

4(b)(iii)

One mark for explanation of problem, one mark for test strings

2

Problem:
•

The inner FOR loop removes ALL characters from String2 that match the current character from String1 and not just
one instance

Test Strings:
•

‘SAME’ and ‘MASS’ (for example)

4(b)(iv)

The inner FOR loop should only remove one instance of the character from String2

1

4(b)(v)

•

1

4(b)(vi)

Max 2 marks, features include:
•
•
•
•

© UCLES 2020

Dry run // White-box testing

2

Single stepping
Breakpoints
Variable and expressions report window
Syntax error highlighting

Page 13 of 24

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
5(a)

Answer

DECLARE Index : INTEGER
FOR Index ← 1 TO 10000
TagString[Index] ← ""
TagCount[Index] ← 0
ENDFOR
ENDPROCEDURE
1 mark for each of the following:

© UCLES 2020

Marks
4

PROCEDURE InitArrays()

1
2
3
4

October/November 2020
www.dynamicpapers.com

Procedure heading and ending (as shown)
Declaration of Index (e.g.) as integer
Loop for 10000 iterations
Initialise TagString element to ""

Page 14 of 24

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
5(b)

October/November 2020
www.dynamicpapers.com

Answer

8

FUNCTION SaveArrays() RETURNS INTEGER
DECLARE Index, NumUnused : INTEGER
DECLARE FileString : STRING
CONSTANT COMMA = ','
NumUnused ← 0
OPEN "Backup.txt" FOR WRITE
FOR Index ← 1 to 10000
IF TagString[Index] <> ""
THEN
FileString ← TagString[Index] & COMMA & NUM_TO_STRING(TagCount[Index])
WRITEFILE "Backup.txt", FileString
ELSE
NumUnused ← NumUnused + 1
ENDIF
ENDFOR
CLOSEFILE "Backup.txt"
RETURN NumUnused
ENDFUNCTION
1 mark for each of the following:
1
2
3
4
5
6
7
8

© UCLES 2020

Marks

Function heading and ending
Open the file Backup.txt in write mode and close file
Loop through 10000 elements
Test if TagString[Index] is "" in a loop
If not then form FileString from array elements with separator and using NUM_TO_STRING()in a loop
Write string to file in a loop
Count the number of unused elements
Return NumUnused not in a loop

Page 15 of 24

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
5(c)

October/November 2020
www.dynamicpapers.com

Answer
‘Pseudocode’ solution included here for development and clarification of mark scheme.
Programming language example solutions appear in the Appendix.
Max 8 marks from 9 available mark points
FUNCTION LoadArrrays() RETURNS INTEGER
DECLARE ArrayIndex, Index, CountLen, Count : INTEGER
DECLARE FileString, HashTag : STRING
CONSTANT COMMA = ','
ArrayIndex ← 0

//

first element

OPEN "Backup.txt" FOR READ
WHILE NOT EOF("Backup.txt")
READFILE "Backup.txt", FileString
Index ← 1
HashTag ← ""
WHILE MID(FileString, Index, 1) <> COMMA
// hashtag
HashTag ← HashTag & MID(FileString, Index, 1)
Index ← Index + 1
ENDWHILE
TagString[ArrayIndex] ← HashTag
CountLen ← LENGTH(FileString) - LENGTH(HashTag) - 1
Count ← STR_TO_NUM(RIGHT(FileString, CountLen))
// count
TagCount[ArrayIndex] ← Count
ArrayIndex ← ArrayIndex + 1
ENDWHILE
CLOSE "Backup.txt"
RETURN ArrayIndex
ENDFUNCTION

© UCLES 2020

Page 16 of 24

Marks
8

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Question
5(c)

Answer
1 mark for each of the following:
1
2
3
4
5
6
7
8
9

Function heading and ending
Declare and initialise ArrayIndex (or equivalent name)
Open the file Backup.txt in read mode and close the file
Loop until end of the Backup.txt file // string read is null
Read a line from the file in a loop
Extract hashtag and count in a loop
Store hashtag in TagString array and count in TagCount array after type conversion
Increment ArrayIndex in a loop
Return number of array elements

*** End of Mark Scheme – example program code solutions follow ***

© UCLES 2020

October/November 2020
www.dynamicpapers.com

Page 17 of 24

Marks

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Appendix: Program Code Example Solutions
Q3 (a): Visual Basic
Function CheckSkid() As Boolean
Dim
Dim
Dim
Dim

Rot(3) As Integer
Average As Double
ThisRot As Integer
Danger As Boolean

For Index = 0 To 3
Do
Console.Writeline("Enter Wheel Rotation Speed: "
ThisRot = Console.Readline()
Loop Until ThisRot >= 0 And ThisRot <= 1000
Rot(Index) = ThisRot
Next
Average = (Rot(0) + Rot(1) + Rot(2) + Rot(3)) / 4
Danger = FALSE
For Index = 0 TO 3
If Rot(Index) > (Average * 1.1) OR Rot(Index) < (Average * 0.9) Then
Danger = TRUE
End If
Next

If Danger = TRUE Then
Console.Writeline("Skid Danger")
Else
Console.Writeline("No Skid Danger")
End if
RETURN Danger
End Function
© UCLES 2020

Page 18 of 24

October/November 2020
www.dynamicpapers.com

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Q3 (a): Pascal
Function CheckSkid() : Boolean;
var
Rot : array [1..4] of integer;
Average : Real;
ThisRot : Integer;
Index : Integer;
Danger : Boolean;
For Index := 1 to 4 do
begin
repeat
write('Enter rotation speed : ');
readln(ThisRot);
until (ThisRot >= 0) And (ThisRot <= 1000);
Rot[Index] := ThisRot;
end;
Average := (Rot[1] + Rot[2] + Rot[3] + Rot[4]) / 4;
Danger := FALSE;
For Index := 1 to 4 do
begin
If (Rot[Index] > (Average * 1.1)) OR (Rot[Index] < (Average * 0.9)) then
Danger := TRUE;
end;

If Danger = TRUE then
writeln('Skid Danger')
Else
writeln('No Skid Danger');
CheckSkid := Danger;
end;

© UCLES 2020

Page 19 of 24

October/November 2020
www.dynamicpapers.com

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Q3 (a): Python
def CheckSkid():
#
#
#
#

Rot[3] As Integer
Average As Real
ThisRot As Integer
Danger As Boolean

Rot = [0, 0, 0, 0]
for Index in range(0, 4):
while True:
ThisRot = float(input("Enter the rotation speed of the wheel: "))
if ThisRot >= 0 and ThisRot <= 1000:
break
Rot[Index] = ThisRot
Next
Average = (Rot[0] + Rot[1] + Rot[2] + Rot[3]) / 4
Danger = False
for Index in range(0, 4):
if Rot[Index] > (Average * 1.1) or Rot[Index] < (Average * 0.9):
Danger = True

If Danger == True:
print("Skid Danger")
else:
print("No Skid Danger")
return Danger

© UCLES 2020

Page 20 of 24

October/November 2020
www.dynamicpapers.com

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Q5 (c): Visual Basic
Function LoadArrrays () As Integer
Dim ArrayIndex, Index, CountLen, Count As Integer
Dim FileString, HashTag As String
Dim File As New StreamReader("Backup.txt")
Const COMMA = ','
ArrayIndex = 0 ' First element
Do While File.Peek <> -1
FileString = File.ReadLine()
Index = 1
HashTag = ""
Do While Mid(FileString, Index, 1) <> COMMA
HashTag = HashTag & MID(FileString, Index, 1)
Index = Index + 1
Loop
TagString(arrayIndex) = HashTag
CountLen = Len(fileString) – Len(HashTag) – 1
Count = CInt(Right(FileString, CountLen))
TagCount(ArrayIndex) = Count
ArrayIndex = ArrayIndex + 1
Loop

' the count

File.Close
Return ArrayIndex
End Function

© UCLES 2020

' the hashtag

Page 21 of 24

October/November 2020
www.dynamicpapers.com

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Q5 (c): Pascal
Function LoadArrrays () : Integer;
var
ArrayIndex, Index, CountLen, Count : Integer;
FileData, HashTag : String;
Backup : Textfile;
const
COMMA = ',';
begin
assignfile(Backup, 'Backup.txt');
reset(File);

ArrayIndex := 0; //First element
while not EOF(File) do
begin
readln(Backup, FileData);
Index := 1;
HashTag := "";
while midstr(FileData, Index, 1) <> COMMA do
begin
HashTag := HashTag + midstr(FileData, Index, 1);
Index := Index + 1;
end;
TagString[ArrayIndex] := HashTag;
CountLen := length(FileData) – length(HashTag) – 1;
Count := strtoint(RightStr(FileData, CountLen));
TagCount[ArrayIndex] := Count;
ArrayIndex := ArrayIndex + 1;
end;
closefile(File);

© UCLES 2020

Page 22 of 24

// the hashtag

// the count

October/November 2020
www.dynamicpapers.com

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

LoadArrays := ArrayIndex;
end;

© UCLES 2020

Page 23 of 24

October/November 2020
www.dynamicpapers.com

9608/22

Cambridge International AS & A Level – Mark Scheme
PUBLISHED

Q5 (c): Python
def LoadArrays ():
# ArrayIndex, Index, CountLen, Count As Integer
# FileString, HashTag As String
# File As StreamReader("Backup.txt")
COMMA = ','
File = open("Backup.txt", "r")
ArrayIndex = 0 #First element
for FileString in File:
Index = 0
HashTag = ""
while FileString[Index] != COMMA:
HashTag = HashTag + FileString[Index]
Index = Index + 1
TagString[ArrayIndex] = HashTag
Count = int(FileString[Index+1:])
TagCount[ArrayIndex] = Count
ArrayIndex = ArrayIndex + 1

# the hashtag

# the count

File.close()
return ArrayIndex

© UCLES 2020

Page 24 of 24

October/November 2020
www.dynamicpapers.com

Advertisement