Computer Science (9608) · Oct/Nov 2017 · Mark scheme 42
Cambridge Computer Science (9608) mark scheme for paper 42, Oct/Nov 2017 — 9608/42/O/N/17, file 9608_w17_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
October/November 2017
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 2017 series for most
®
Cambridge IGCSE , Cambridge International A and AS Level components and some Cambridge O Level
components.
® IGCSE is a registered trademark.
This document consists of 16 printed pages.
© UCLES 2017
[Turn over
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Answer
Question
1(a)
1 mark per shaded group
Conditions
Actions
2017
Marks
4
Column
© UCLES 2017
October/November
www.dynamicpapers.com
1
2
3
4
5
6
7
8
Grade C in
Computer
Science
Y
Y
Y
Y
N
N
N
N
Grade C in
Maths
Y
Y
N
N
Y
Y
N
N
Grade C in
Science
Y
N
Y
N
Y
N
Y
N
Take Computer
Science
Y
Y
Y
Y
Y
Y
Take Maths
Y
Y
Y
Y
Take Physics
Y
Y
Page 2 of 16
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Answer
Question
1(b)
October/November
www.dynamicpapers.com
2017
Marks
1 mark per column
3
Actions
Conditions
Column
S
T
U
Grade C in
Computer
Science
Y
–
–
Grade C in
Maths
–
Y
Y
Grade C in
Science
–
–
Y
Take Computer
Science
Y
Y
Take Maths
Take Physics
1(c)
© UCLES 2017
V
W
X
Y
Z
Y
Y
For example:
• (Column S) combining 1,2,3,4«
• « because they only need CS to take CS // Maths and Science do not matter
• (Column T) combining 1,2,5,6«
• « because CS does not matter if it is Y/N
• (Column U) combining 1,5«
•
«because CS does not matter if it is Y/N
Page 3 of 16
3
960
08/42
Ca
ambridge Interna
ational AS/A Lev
vel – Mark Scheme
PUBLISHED
Answer
Q
Question
October/Novem
mber
www.dynamicpapers.com
2017
Mark
ks
2(a)
1 ma
ark for each corrrect line, duratio
on and activity.
7
2(b)
•
1
© UCLES 2017
Dummy activity
Page 4 of 16
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Answer
Question
October/November
www.dynamicpapers.com
2017
Marks
3(a)
1 mark per clause
• room(corridor).
• furniture(table).
• furniture(lamp).
• located(table, corridor).
• located(lamp, corridor).
5
3(b)
•
•
2
master_bedroom
spare_bedroom
3(c)(i)
1 mark per bullet to max 2
• The first clause only says the nursery is next to the master bedroom
• « but not that the master bedroom is next to the nursery
• The second clause only says the master bedroom is next to the nursery
• « but not that the nursery is next to the master bedroom
• Goal to find rooms adjacent to master bedroom would not return nursery
• « Example. FindNextTo(X, master_bedroom)
• It is a two-way relationship
2
3(c)(ii)
1 mark per bullet
• room(main_bathroom).
• nextTo(corridor, main_bathroom).
• nextTo(main_bathroom, corridor).
3
© UCLES 2017
Page 5 of 16
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Answer
Question
3(d)
1 mark per bullet
• canBeMovedTo(B,A)
• Furniture(B)
• Room(A)
• AND / ,
• AND NOT / , NOT
• Located(B,A)
2017
Marks
6
Example:
canBeMovedTo(B,A)
IF furniture(B) AND room(A)
AND NOT(located(B,A)).
© UCLES 2017
October/November
www.dynamicpapers.com
Page 6 of 16
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Answer
Question
4(a)
October/November
www.dynamicpapers.com
1 mark per item in bold
2017
Marks
4
FOR Pointer ← 1 TO (Max − 1)
ItemToInsert ← Numbers[Pointer]
CurrentItem ← Pointer
WHILE (CurrentItem > 0) AND (Numbers[CurrentItem − 1] > ItemToInsert)
Numbers[CurrentItem] ← Numbers[CurrentItem − 1]
CurrentItem ← CurrentItem – 1
ENDWHILE
Numbers[CurrentItem] ← ItemToInsert
ENDFOR
4(b)
© UCLES 2017
•
•
2
The size of the array // value of Max
How ordered the items already are
Page 7 of 16
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Marks
Max 10
10
Label
START:
LOOP:
NOTFOUND:
ENDP:
Op code
LDR
LDX
Operand
#0
LETTERS
Comment
// initialise Index Register
Marks
// load LETTERS
1
CMP
LETTERTOFIND
// is LETTERS = LETTERTOFIND ?
1
JPN
NOTFOUND
// if not, go to NOTFOUND
1
LDD
FOUND
INC
ACC
STO
FOUND
LDD
COUNT
INC
ACC
STO
COUNT
CMP
1
// increment FOUND
1
1
//increment COUNT
1
#6
// is COUNT = 6 ?
1
JPE
ENDP
// if yes, end
1
INC
IX
// increment Index Register
1
JMP
LOOP
// go back to beginning of loop
1
END
// end program
LETTERTOFIND:
'x'
LETTERS:
'd'
'u'
'p'
'l'
'e'
'x'
© UCLES 2017
2017
Answer
Question
5(a)
October/November
www.dynamicpapers.com
COUNT:
0
FOUND:
0
Page 8 of 16
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
October/November
www.dynamicpapers.com
2017
Answer
Question
Marks
5(b)
10
Label
Op Code
Operand
Comment
START:
LDR
#0
// initialise the Index Register
LOOP:
LDX
VALUES
// load the value from VALUES
LSR
#3
// divide by 8
STX
VALUES
// store the new value in VALUES
1
INC
IX
// increment the Index Register
1
LDD
REPS
INC
ACC
// increment REPS
1
STO
REPS
CMP
#6
// is REPS = 6 ?
1
JPN
LOOP
// repeat for next value
1
VALUES:
0
22
13
5
46
12
33
© UCLES 2017
1(loop) +
1(LDX
Values)
1 (LSR) + 1
(#3)
END
REPS:
1
Page 9 of 16
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Answer
Question
6(a)
1 mark per bullet
• Inheritance correctly shown from CurrentAccount and SavingsAccount to Account
• Level and cost methods, get and set functions in CurrentAccount
• Get and set Amount and constructor in SavingsAccount
Account
AccountNumber: STRING
Balance: CURRENCY
GetAccountNumber()
GetBalance()
SetAccountNumber()
SetBalance()
CurrentAccount
Level: STRING
Cost: CURRENCY
PaymentInterval : INTEGER
Amount : CURRENCY
Constructor()
Constructor()
GetAmount()
SetAmount()
GetLevel()
GetCost()
SetLevel()
SetCost()
© UCLES 2017
SavingsAccount
GetPaymentInterval()
SetPaymentInverval()
Page 10 of 16
October/November
www.dynamicpapers.com
2017
Marks
3
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Answer
Question
6(b)
1 mark per bullet to max 5
• Class heading and ending
• Identifying inheritance
• Declaring AccountNumber, Balance
• Use of private/protected for AccountNumber and Balance
• One Correct Get Method
• One Correct Set Method
• Second correct Get and Set Methods
Example VB
MustInherit Class Account
Private AccountNumber As String
Private Balance As Decimal
Sub SetAccountNumber(AccNumP As String)
AccountNumber = AccNumP
End Sub
Function GetAccountNumber() As String
return AccountNumber
End Function
Sub SetBalance (BalanceP As Decimal)
Balance = BalanceP
End Sub
Function GetBalance() As Decimal
return Balance
End Function
End Class
or
MustInherit Class Account
Private AccountNumber As String
© UCLES 2017
Page 11 of 16
October/November
www.dynamicpapers.com
2017
Marks
5
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Answer
Question
6(b)
Protected AccountNumber As String
Get
return _AccountNumber
End Get
Set (ByValue AccountNumberV As String)
_AccountNumber = AccountNumberV
End Set
Private _Balance As Decimal
Protected Balance As Decimal
Get
return _Balance
End Get
Set (ByValue BalanceV As Integer)
_Balance = BalanceV
End Set
End Class
Example Python
class Account:
def__init__(self, accountNumber, balance):
self.__accountNumber = accountNumber
self.__balance = balance
def getAccountNumber(self):
return self.__accountNumber:
def setAccountNumber(self, AccountNumber):
self AccountNumber = AcountNumber
def getBalance(self):
return self._balance:
def setBalance(self, Balance):
self Balance = Balance
© UCLES 2017
Page 12 of 16
October/November
www.dynamicpapers.com
2017
Marks
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Answer
Question
6(b)
Example Pascal
type
Account := class
private
AccountNumber, Balance,;
public
constructor Create(AccountNumber, Balance);
procedure setAccountNumber(AccountN: String);
function getAccountNumber() : String;
procedure setBalance(BalanceV: Real);
function getBalance() : Real;
constructor Account.init(Account, Bal);
begin
AccountNumber := Account;
Balance := Bal;
end;
procedure SetAccountNumber(AccountN: String);
begin
AccountNumber := AccountN;
end;
procedure GetAccountNumber() : String;
begin
GetAccountNumber := AccountNumber
end;
procedure SetBalance(Bal: String);
begin
Balance := Bal;
end;
procedure GetBalance() : String;
begin
© UCLES 2017
Page 13 of 16
October/November
www.dynamicpapers.com
2017
Marks
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
October/November
www.dynamicpapers.com
Answer
Question
6(b)
2017
Marks
GetBalance := Balance
end;
end;
6(c)
1 mark per bullet to max 5
• Class declaration and end
• Declaration of inheritance
• Amount and PaymentInterval as Private/protected with appropriate data types
Constructor:
• Override / Overriding in constructor
• Constructor heading and end
• «taking values as parameters
• Constructor setting all values using base class
• Initialisations of new attributes in the constructor
• « all set to the parameters
Example VB
Class SavingsAccount
Inherits Account
Private Amount As Decimal
Private PaymentInterval As Integer
Public Overrides Sub New(ByVal AccountNumberValue As
String, ByVal BalanceValue As Decimal, ByVal AmountValue As Decimal,
ByVal PaymentValue As Integer)
Amount = PaymentValue
PaymentInterval = PaymentValue
End Sub
End Class
© UCLES 2017
Page 14 of 16
5
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Answer
Question
6(c)
October/November
www.dynamicpapers.com
or
Class SavingsAccount
Inherits Account
Private Amount As Decimal
Private PaymentInterval As Integer
Public Sub New(AccountNumberValue As String, BalanceValue As Decimal, PayInterval As
Integer, payAmount As Decimal)
MyBase.New(AccountNumberValue, BalanceValue)
AccountNumber = AccountNumberValue
Balance = BalanceValue
Amount = payAmount
PaymentInterval = PayInterval
End Sub
etc.
Example Python
class SavingsAccount(Account):
def_init_(self, AccountNumber, Balance, PayInt, AmountP):
super().__init__(AccountNumber, Balance)
self.__PaymentInterval = PayInt
self.__Amount = AmountP
Example Pascal
type
SavingsAccount = class(Account);
private
PaymentInterval : integer;
Amount : currency;
public
constructor Create(AcountNum : String, Bal : Currency, PayInt : Integer, AmountP :
Currency);
end;
constructor SavingsAccount.Create(); override;
© UCLES 2017
Page 15 of 16
2017
Marks
9608/42
Cambridge International AS/A Level – Mark Scheme
PUBLISHED
Answer
Question
6(c)
© UCLES 2017
begin
inherited Create(AccountNum, Bal)
PaymentInterval := PayInt;
Amount := AmountP;
end;
Page 16 of 16
October/November
www.dynamicpapers.com
2017
Marks