Computer Science (9608) · May/June 2018 · Mark scheme 42
Cambridge Computer Science (9608) mark scheme for paper 42, May/June 2018 — 9608/42/M/J/18, file 9608_s18_ms_42.pdf.
Text of this paper
www.dynamicpapers.com
Cambridge Assessment International Education
Cambridge International Advanced Subsidiary and Advanced Level
COMPUTER SCIENCE
9608/42
Paper 4 Written Paper
May/June 2018
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 2018 series for most
Cambridge IGCSE™, Cambridge International A and AS Level and Cambridge Pre-U components, and
some Cambridge O Level components.
IGCSE™ is a registered trademark.
This document consists of 21 printed pages.
© UCLES 2018
[Turn over
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Generic Marking Principles
May/June 2018
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 2018
Page 2 of 21
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
May/June 2018
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 2018
Page 3 of 21
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
1(a)
Answer
1 mark for each correctly completed pseudocode line to max 4
01
02
03
04
05
06
07
08
09
10
11
12
13
14
© UCLES 2018
REPEAT
CALL TakePhoto
CALL AddPhotoToCollection
OUTPUT "Do you want to take another photo?"
INPUT AddPhoto
UNTIL AddPhoto = "No"
REPEAT
CALL AddUser
OUTPUT "Do you want to add another user?"
INPUT NewUser
UNTIL NewUser = "No"
OUTPUT "Do you want to create another collection?"
INPUT NewCollection
UNTIL NewCollection = "No"
Page 4 of 21
May/June 2018
www.dynamicpapers.com
Marks
4
960
08/42
Question
1(b)
© UCLES 2018
Ca
ambridge Interna
ational AS/A Lev
vel – Mark Scheme
PUBLISHED
Answer
1 ma
ark per bullet:
• E
Edit a collection // Choose a colllection // Select a collection
• M
Manage photos
• D
Delete a collectio
on
• b
both add and rem
move a photo // add to collection
n, delete to colle
ection
• a
appropriate sele
ection and iteratio
on in all boxes
Page 5 of 21
May/June 2018
www.dynamicpapers.com
Marrks
5
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
2(a)
Answer
1 mark for each statement
15
16
2(b)
May/June 2018
www.dynamicpapers.com
Marks
2
is_a(gecko, lizard).
maxsize(gecko, 182).
1 mark for 2 results
2 marks for 3 correct results
2
green_iguana, cayman, smooth_iguana
2(c)
1 mark per bullet
•
•
2
is_a used with brackets ()
squamata, X in correct order
is_a(squamata, X).
2(d)
1 mark for each bullet to max 3
•
•
3
is_a(X, Z)
and // , has(Z, Y).
is_a(X, Z) AND has(Z, Y).
2(e)
© UCLES 2018
YES
1
Page 6 of 21
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
May/June 2018
www.dynamicpapers.com
Answer
Marks
3(a)
CardData is partially sorted/ordered // more items in order/sorted
1
3(b)
1 mark for each correct statement
7
01 ArraySize ← 10
02 FOR Pointer ← 2 TO ArraySize // 10
03
ValueToInsert ← CardData[Pointer]
04
HolePosition ← Pointer
05
WHILE(HolePosition>1 AND(CardData[HolePosition - 1] > ValueToInsert))
06
CardData[HolePosition] ← CardData[HolePosition – 1]
07
HolePosition ← HolePosition – 1
08
ENDWHILE
09
CardData[HolePosition] ← ValueToInsert
10 ENDFOR
3(c)(i)
1 mark per bullet to max 2
•
•
•
•
3(c)(ii)
It doesn’t check every value
The midpoint is the middle element, not the middle numerical value
When the higher/lower elements are discarded they will not be the higher/lower elements
It might discard the value you are looking for
1 mark per bullet to max 4. Max 2 marks if no relation to CardData values.
•
•
•
•
© UCLES 2018
2
Find mid-point and comparison // 25 is smaller than/compared to 52/56
Discard/ignore greater // change upper bound to 33/52/midpoint - 1 //e.g. right hand side // only use array elements
1 - 4/5
Find and compare to mid-point of new list e.g. 12/25
Value is the midpoint // Continue until value found
Page 7 of 21
4
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
3(d)
Answer
1 mark for each complete statement
Marks
4
PROCEDURE BinarySearch(CardData, SearchValue)
DECLARE Midpoint : INTEGER
First ← 1
Last ← ARRAYLENGTH(CardData)
Found ← FALSE
WHILE (First <= Last) AND NOT(Found)
Midpoint ← (First + Last) \ 2
IF CardData[Midpoint] = SearchValue
THEN
Found ← TRUE
ELSE
IF SearchValue < CardData[Midpoint]
THEN
Last ← Midpoint - 1
ELSE
First ← Midpoint + 1
ENDIF
ENDIF
ENDWHILE
ENDPROCEDURE
© UCLES 2018
May/June 2018
www.dynamicpapers.com
Page 8 of 21
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
4(a)
May/June 2018
www.dynamicpapers.com
Answer
Marks
1 mark per bullet:
• Team methods
• Official attributes
• Two inheritance arrows or containment
3
Member
Team
FirstName: STRING
TeamName: STRING
LastName: STRING
TeamList: ARRAY OF Member
DateOfBirth: DATE
Gender: STRING
Constructor()
Constructor()
Introduction()
AddMember()
DisplayFullnameAndDateOfBirth()
DeleteMember()
Competitor
Sport: STRING
Official
JobTitle: STRING
FirstAidTrained: BOOLEAN/STRING
© UCLES 2018
Constructor()
Constructor()
Introduction()
DisplayJobTitle()
Page 9 of 21
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
4(b)
Answer
1 mark per bullet to max 5
Marks
5
•
•
class declaration
FirstName, LastName, DateOfBirth and Gender all defined as private
•
•
constructor declaration
«all four attributes assigned values from parameters
•
•
(Public) method for Introduction
«outputs message with FirstName and LastName attributes
// returns FirstName and LastName
•
•
Public method for DisplayFullNameAndDateofbirth
« outputs message with FirstName, LastName and DateOfBirth
// returns FirstName, LastName, DateOfBirth
Python example code:
class Member:
def __init__(self, Fname, Lname, DOB, GenderVal):
self.__FirstName = Fname
self.__LastName = Lname
self.__DateOfBirth = DOB
self.__Gender = GenderVal
def Introduction(self):
return "Hello, I am ", self.__FirstName, " ",
self.LastName
def DisplayFullnameAndDateofbirth(self):
print self.__FirstName, self.__LastName,
self.__DateOfBirth
© UCLES 2018
May/June 2018
www.dynamicpapers.com
Page 10 of 21
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
4(b)
Answer
Visual Basic example code:
Class Member
Private Firstname As String
Private Lastname As String
Private DateOfBirth As Date
Private Gender As String
Public Sub New(ByVal Fname As String,ByVal Lname As String,
ByVal DOB As Date, ByVal GenderVal As String)
Firstname = Fname
Lastname = Lname
DateOfBirth = DOB
Gender = GenderVal
End Sub
Public Function Introduction() As String
Dim Message As String
Message = "Hello, I am " + Firstname + " " + Lastname + " " +
DateOfBirth
Return Message
End Function
Public Function DisplayFullNameAndDateOfBirth As String
DisplayFullNameAndDateOfBirth = Firstname + " " + Lastname +
" " + DateOfBirth
End Function
End Class
© UCLES 2018
Page 11 of 21
May/June 2018
www.dynamicpapers.com
Marks
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
4(b)
Answer
Pascal example code:
type
Member = class
private
Firstname : string;
Lastname : string;
DateOfBirth : date;
Gender : string;
public
constructor Create(Fname, Lname, Gend, DBirth : string);
function Introduction() : string;
function DisplayFullNameAndDateOfBirth() : string;
constructor Member.Create(Fname, Lname, Gend, DBirth : string);
begin
Firstname := Fname
LastName := Lname
Gender := Gend
DateOfBirth := DBirth
end;
function Member.Introduction() : String;
begin
Introduction := "Hello, I am " + Firstname + " " + Lastname
end;
function Member.DisplayFullNameAndDateOfBirth As String;
begin;
DisplayFullNameAndDateOfBirth = Firstname + " " + Lastname +
" " + DateOfBirth
end;
© UCLES 2018
Page 12 of 21
May/June 2018
www.dynamicpapers.com
Marks
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
4(c)
Answer
1 mark per bullet to max 5
•
•
•
•
•
•
•
Marks
5
Class declaration that inherits from Member
Constructor declaration taking all five parameters
«that inherits from Member
Declaration of Sport as private String
«. and assigning to parameter
Introduction method declaration (with polymorphism)
«returning/outputting message with FirstName, LastName and Sport variables
Python example code:
class Competitor(Member):
def __init__(self, Fname, Lname, DOB, GenderVal, MySport):
Member.__init__(self, Fname, Lname, DOB, GenderVal)
self.__Sport = MySport
def Introduction(self):
print "Hello, I am %s %s and my sport is %s" % (self.FirstName,
self.LastName, self.__Sport)
© UCLES 2018
May/June 2018
www.dynamicpapers.com
Page 13 of 21
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
4(c)
Answer
Visual Basic example code:
Class Competitor
Inherits Member
Private Sport As String
Public Sub New(ByVal Fname As String,ByVal Lname As String,
ByVal DOB As Date, ByVal GenderVal As String, ByVal
SportVal As String)
MyBase.New(Fname, Lname, DOB, GenderVal)
Sport = SportVal
End Sub
Public Overloads Function Introduction() As String
Dim Message As String
Message = "Hello, I am " + Firstname + " " + Lastname + " and my
sport is " + Sport
Return Message
End Function
End Class
© UCLES 2018
Page 14 of 21
May/June 2018
www.dynamicpapers.com
Marks
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
4 (c)
May/June 2018
www.dynamicpapers.com
Answer
Pascal example code:
type
Competitor = class(Member)
private
Sport : String;
public
Constructor init(Fname, Lname: String; DOB: Date; GenderVal,
Sport:String);
Function Introduction() : String;
end;
Constructor Competitor.initFname, Lname: String; DOB: Date; GenderVal, SportVal:String);
begin
inherited init(Fname, Lname, DOB, GenderVal);
Sport := SportVal;
end;
Function Competitor.Introduction();
begin
Result:= "Hello, I am " + Firstname + " " + Lastname + " and my sport
is " + Sport
end;
© UCLES 2018
Page 15 of 21
Marks
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
4(d)
May/June 2018
www.dynamicpapers.com
Answer
1 mark per bullet
•
•
•
3
variable BMXJudge assigned value
call Official
with all 6 parameters assigned correctly
Python example code:
BMXJudge = Official("Omar", "Ellaboudy", "17/03/1993", "Male", true, "Judge")
Visual Basic example code:
BMXJudge = New Official("Omar", "Ellaboudy", "17/03/1993", "Male, true, "Judge")
Pascal example code:
BMXJudge := Official("Omar", "Ellaboudy", "17/03/1993", "Male", true, "Judge")
© UCLES 2018
Marks
Page 16 of 21
960
08/42
Ca
ambridge Interna
ational AS/A Lev
vel – Mark Scheme
PUBLISHED
Question
5(a)
Answer
1 ma
ark per bullet
•
•
•
•
•
May/June 2018
www.dynamicpapers.com
Marrks
5
C
C/D/E in parallell starting after B, with correct du
urations.
F with dependen
ncy on C and co
orrect duration
G with dependen
ncy on D and E with correct durration
H with correct de
ependency on F and G
I with dependenc
cy on H
5(b)(i)
C, D,, E
1
5
5(b)(ii)
E, F
1
© UCLES 2018
Page 17 of 21
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
5(c)
Answer
1 mark per bullet to max 2
© UCLES 2018
Marks
2
For example:
•
•
•
•
•
•
•
•
•
•
•
•
•
•
May/June 2018
www.dynamicpapers.com
Check if the project is on track
«so the project manager can intervene if behind
lets you identify slack time to
«reallocate resources to support the process
find critical path
«to ensure activities are given correct priority
see when tasks end
...to plan the next tasks
see which tasks can run in parallel
set milestones/goals
check correct tasks are being carried out on current day
Calculate latest start time
Calculate earliest finish time
Calculate latest start time for a task
Page 18 of 21
960
08/42
Ca
ambridge Interna
ational AS/A Lev
vel – Mark Scheme
PUBLISHED
Question
6(a)
Answer
1 ma
ark per bullet
•
•
•
•
•
© UCLES 2018
May/June 2018
www.dynamicpapers.com
Marrks
5
B
Brown left and black
b
right from n
node 2
Y
Yellow left and Purple
P
right from
m node 1
P
Peach left come
es from 3
W
White left from 6 and Pink left frrom 7
G
Grey left from 9 and orange righ
ht from 9
Page 19 of 21
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
6(b)
Answer
1 mark for outputting all the leaf data values
•
Marks
8
Outputting BinaryTree[CurrentNode].DataValue only when both LeftPointer and RightPointer are -1
1 mark per bullet to max 7
•
•
Function declaration
«taking CurrentNode or equivalent as parameter
•
•
•
Check if BinaryTree[CurrentNode].LeftPointer is not -1 «
« recursive call «
«with left pointer value as parameter
•
•
•
Check if BinaryTree[CurrentNode].RightPointer is not -1«
« recursive call«
« with right pointer value as parameter
Python example code:
def FindLeaves(CurrentNode):
global BinaryTree
if(BinaryTree[CurrentNode].LeftPointer != -1):
FindLeaves(BinaryTree[CurrentNode].LeftPointer)
if(BinaryTree[CurrentNode].RightPointer != -1):
FindLeaves(BinaryTree[CurrentNode].RightPointer)
if((BinaryTree[CurrentNode].RightPointer == -1) and
(BinaryTree[CurrentNode].LeftPointer == -1)):
print BinaryTree[CurrentNode].DataValue
return
© UCLES 2018
May/June 2018
www.dynamicpapers.com
Page 20 of 21
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Question
6(b)
Answer
Visual Basic example code:
Procedure FindLeaves(CurrentNode):
if(BinaryTree[CurrentNode].LeftPointer <> -1) then
FindLeaves(BinaryTree[CurrentNode].LeftPointer)
End if
if(BinaryTree[CurrentNode].RightPointer <> -1) then
FindLeaves(BinaryTree[CurrentNode].RightPointer)
end if
if ((BinaryTree[CurrentNode].RightPointer = -1) and
(BinaryTree[CurrentNode].LeftPointer = -1)) then
Console.WriteLine(BinaryTree[CurrentNode].DataValue)
End if
End Procedure
Pascal example code:
Procedure FindLeaves(CurrentNode);
Begin
if(BinaryTree[CurrentNode].LeftPointer <> -1) then
FindLeaves(BinaryTree[CurrentNode].LeftPointer);
if(BinaryTree[CurrentNode].RightPointer <> -1):
FindLeaves(BinaryTree[CurrentNode].RightPointer);
if((BinaryTree[CurrentNode].RightPointer = -1) and
(BinaryTree[CurrentNode].LeftPointer = -1)) then
print (BinaryTree[CurrentNode].DataValue);
End;
© UCLES 2018
Page 21 of 21
May/June 2018
www.dynamicpapers.com
Marks