Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Cambridge Assessment International Education: Computer Science 9608/23 May/June 2018

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Cambridge Assessment International Education

Cambridge International Advanced Subsidiary and Advanced Level

COMPUTER SCIENCE 9608/23


Paper 2 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 13 printed pages.

© UCLES 2018 [Turn over


9608/23 Cambridge International AS/A Level – Mark Scheme May/June 2018
PUBLISHED

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 2018 Page 2 of 13


9608/23 Cambridge International AS/A Level – Mark Scheme May/June 2018
PUBLISHED

Question Answer Marks

1(a) 4
Description of data item Suitable identifier name
The temperature inside the house InsideTemperature
The temperature outside the house OutsideTemperature
The wind speed WindSpeed
Whether it was raining or not WasRaining

The above are examples only.


Names must be meaningful and unambiguous

Items 1 and 2 must have suitable prefix/suffix (i.e. not just ‘temperature’)

Reject single letter names

1(b)(i) 5
Expression Evaluates to
MID(MyName, 4, 4) & "ol" "phenol"
QualityConfirmed AND (Factor >= 6.5) TRUE
20 + ASC(Quality) 88
QualityConfirmed + 3 ERROR
MOD(Factor * 2, 9) 4

1(b)(ii) 5
Variable Data type
QualityConfirmed BOOLEAN
DayNumber INTEGER
Factor REAL
Quality CHAR
MyName STRING

One mark per answer

© UCLES 2018 Page 3 of 13


9608/23 Cambridge International AS/A Level – Mark Scheme May/June 2018
PUBLISHED

Question Answer Marks

2(a) Comments: 2
Explain the functionality of the code // Easier for other people to
understand // Easier to maintain / debug / modify

Indentation:
Easier to identify structure / blocks // identify blocks of code

2(b) 9
Feature Answer
A line number containing an example of an 8, 9, 10,12, 17,
integer assignment statement 34, 45
A line number containing the start of a
14, 19, 23
selection structure
A line number containing the end of a
28, 29, 30
selection structure
The upper bound of the Mark array 100
The number of dimensions of the Mark array 1
The name for the type of loop structure used ‘post condition’
A line number containing an unnecessary
10
assignment statement
The number of times that OUTPUT is called 100
The number of local variables 4

2(c)(i) Either: 2
• Mistake: function header specifies return of an INTEGER but line 37
returns a STRING // pseudocode returns Grade but should have
returned DGradeCount
• Correction: RETURN DGradeCount (as per code pseudocode
comment)

Or:
• Mistake: Statement on line 32 uses ‘&’ operator which concatenates
STRINGs, but variable n is an INTEGER
• Correction: Convert n to a STRING before concatenating

© UCLES 2018 Page 4 of 13


9608/23
9 Cambridg
ge Internatio
onal AS/A Level
L – Mark Scheme Ma
ay/June 201
18
P
PUBLISHED D

Question Answerr Marks

2(c)(ii) CASE OF
F ThisMar
rk 4
> 74: Grade ← "Distincction"
ount ← DG
DGradeCo GradeCoun
nt + 1
60 TO 74: Grade ← "Merit"
40 TO 59: Grade ← "Pass"
HERWISE Grade ← "Fail"
OTH
ENDCASE
E

One marrk for each of:


o

1 CASEE OF This sMark ... . ENDCASE E


2 Thre
ee grade ran
nges with co
orrespondinng assignment of Gradde
3 DGraadeCount increment w within CASE
E clause
4 OTHE ourth grade range with correct ass
ERWISE / fo signment off Grade

Question Answerr Marks

3(a) Paramete
ers 1

Accept arguments

3(b) 4

Mark as follows:
f

• One mark for all four modu


ules
• One mark for ea
ach set of in
nterface parameters

© UCLES 2018 Page 5 of 13


9608/23
9 Cambridg
ge Internatio
onal AS/A Level
L – Mark Scheme Ma
ay/June 201
18
P
PUBLISHED D

Question Answerr Marks

4 9

This is on
ne possible solution – sselection sttructure may differ
One marrk for:
1 STAR RT and END D // STOP P
2 Initia
alisation of an
a Index vvariable and d initialisatio
on of a Counnt variable
e
3 Deciision box / boxes
b to che
eck temperrature within n acceptablee range
4 Corrrect increme ent of Coun t variable
5 Deciision box co omparing Inndex to 100
6 Corrrect increme ent of Inde x
7 Deciision box co omparing Co ount > 20
8 Assig gning both TRUE and F FALSE
9 Retu urning the Boolean
B valu
ue
For soluttions where Boolean va
ariable not used:
u
8 Retu
urn TRUE
9 R
Return FALS
SE

© UCLES 2018 Page 6 of 13


9608/23 Cambridge International AS/A Level – Mark Scheme May/June 2018
PUBLISHED

Question Answer Marks

5(a)(i) 1 1

5(a)(ii) Information is saved after the program ends // after the computer is switched 1
off

5(b) Two from these examples: Max 2

• Indentation
• Colour-coding of keywords /comments
• Expansion / collapsing of complex data structures

© UCLES 2018 Page 7 of 13


9608/23 Cambridge International AS/A Level – Mark Scheme May/June 2018
PUBLISHED

Question Answer Marks

5(c) ‘Pseudocode’ solution included here for development and clarification of Max 10
mark scheme.
Programming language solutions appear in the Appendix.

FUNCTION GetAverageScore(MembershipNumber : STRING)


RETURNS INTEGER

DECLARE FileData, FileMembershipNumber : STRING


DECLARE NumberOfScores, TotalScore, AverageScore :
INTEGER
OPENFILE "ScoreDetails.txt" FOR READ
NumberOfScores ← 0
TotalScore ← 0

WHILE NOT EOF("ScoreDetails.txt")


READFILE("ScoreDetails.txt", FileData)
FileMembershipNumber ← LEFT(FileData, 4)
IF FileMembershipNumber = MembershipNumber
THEN
NumberOfScores ← NumberOfScores + 1
TotalScore ← TotalScore +
INT(RIGHT(FileData, 2))
ENDIF
ENDWHILE

AverageScore ← INT(TotalScore / NumberOfScores)

CLOSEFILE("ScoreDetails.txt")

RETURN(AverageScore)

ENDFUNCTION

1 mark for each of the following:

1 Function heading and ending including Input and return parameter


2 Declare variables to store NumberOfScores and TotalScore as
INTEGERs (commented in Python) (variable names may be different)
3 Initialisation of NumberOfScores and TotalScore to 0
4 Open file in READ mode
5 Loop until EOF()
6 Read a line from the file in a loop
7 Use of substring function to extract at least one data item
8 Compare the membership number
9 Convert score to an integer
10 Increment NumberOfScores and sum TotalScore
11 Calculate the average outside the loop
12 Close the file
13 Return the parameter

© UCLES 2018 Page 8 of 13


9608/23 Cambridge International AS/A Level – Mark Scheme May/June 2018
PUBLISHED

Question Answer Marks


6(a) Subscript / index 1
6(b) FUNCTION Clip(MaxVal : INTEGER) RETURNS BOOLEAN 9
DECLARE i : INTEGER
DECLARE j : INTEGER
DECLARE ClipFlag : BOOLEAN

ClipFlag ← FALSE

FOR i ← 1 TO 8
FOR j ← 1 TO 8
IF Picture[i, j] > MaxVal
THEN
Picture[i, j] ← MaxVal
ClipFlag ← TRUE
ENDIF
ENDFOR
ENDFOR

RETURN ClipFlag

ENDFUNCTION

1 mark for each of the following:

1 Correct Function heading (must have MaxVal and return a BOOLEAN)


and ending
2 Declare and initialise local variable for return BOOLEAN to FALSE / other
mechanism to record pixel being clipped
3 Declare local variables for loop counters
4 Nested loops with correct number of iterations
5 Accessing correct element from Picture array
6 Comparing element with MaxVal
7 Changing value of element if necessary
8 Setting flag to TRUE / other mechanism if element is changed
9 Returning BOOLEAN after loop (following conversion if other
mechanism used)

© UCLES 2018 Page 9 of 13


9608/23 Cambridge International AS/A Level – Mark Scheme May/June 2018
PUBLISHED

Question Answer Marks


7 ‘Pseudocode’ solution included here for development and clarification of 6
mark scheme.
Programming language solutions appear in the Appendix.

FUNCTION IsFactor(Num1: INTEGER, Num2: INTEGER)


RETURNS BOOLEAN
IF Num2 <> 0
THEN
IF MOD(Num1, Num2) = 0
THEN
RETURN TRUE
ENDIF
ENDIF

RETURN FALSE

ENDFUNCTION

1 mark for each of the following:

1 Correct Function heading (including parameters) and ending


2 Check that Num2 is not zero
3 Mechanism to ensure no call to MOD (or equivalent) if Num2 is zero
4 Use of MOD function or alternative
5 Check value of remainder
6 Return Boolean value

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

© UCLES 2018 Page 10 of 13


9608/23 Cambridge International AS/A Level – Mark Scheme May/June 2018
PUBLISHED

Appendix

Program Code Example Solutions

Q5(c): Visual Basic

Function GetAverageScore(ByVal MembershipNumber As String) As Integer

Dim FileData As String


Dim FileMembershipNumber As String
Dim NumberOfScores As Integer
Dim TotalScore As Integer
Dim AverageScore As Integer
Dim ObjReader As IO.StreamReader

ObjReader = New IO.StreamReader("ScoreDetails.txt")


NumberOfScores = 0
TotalScore = 0

Do While ObjReader.Peek <> -1


FileData = ObjReader.ReadLine()
FileMembershipNumber = LEFT(FileData, 4)
If FileMembershipNumber = MembershipNumber Then
NumberOfScores = NumberOfScores + 1
TotalScore = TotalScore + INT(RIGHT(FileData, 2))
End If
Loop

AverageScore = INT(TotalScore / NumberOfScores)


ObjReader.Close()
Return (AverageScore)

End Function

Q5(c): Pascal

function GetAverageScore(MembershipNumber : string):integer;

var
FileData, FileMembershipNumber: string;
NumberOfScores, TotalScore, AverageScore : integer;
ScoreFile : textFile;
begin
NumberOfScores := 0;
TotalScore := 0;
assignFile(ScoreFile, ‘ScoreDetails.txt’);
reset(ScoreFile);
while not eof(ScoreFile) do
begin
readln(ScoreFile, FileData);
FileMembershipNumber := copy(FileData, 1, 4);
if FileMembershipNumber = MembershipNumber then
begin
NumberOfScores := NumberOfScores + 1
TotalScore := TotalScore + StrToInt(RightStr(FileData, 2));
end;
end;

© UCLES 2018 Page 11 of 13


9608/23 Cambridge International AS/A Level – Mark Scheme May/June 2018
PUBLISHED

AverageScore := StrToInt(TotalScore / NumberOfScores);


GetAverageScore := AverageScore;
CloseFile (ScoreFile);
end;

Q5(c): Python

# FileData AS STRING
# FileMembershipNumber AS STRING
# NumberOfScores AS INTEGER
# TotalScore AS INTEGER
# AverageScore AS INTEGER

def GetAverageScore(MembershipNumber):
FileHandle = open("ScoreDetails.txt", "r")
NumberOfScores = 0
TotalScore = 0
FileData = FileHandle.readline()
while len(FileData) > 0:
FileMembershipNumber = FileData[0:4]
if FileMembershipNumber == MembershipNumber:
NumberOfScores = NumberOfScores + 1
TotalScore = TotalScore + int(FileData[-2])
FileData = FileHandle.readline()
AverageScore = int(TotalScore / NumberOfScores)
Return (AverageScore)
FileHandle.close()

© UCLES 2018 Page 12 of 13


9608/23 Cambridge International AS/A Level – Mark Scheme May/June 2018
PUBLISHED

Q7: Visual Basic

Function IsFactor(Num1 As Integer, Num2 As Integer) As Boolean

If Num2 <> 0 Then


If Num1 Mod Num2 = 0 Then
Return True
End If
End if
Return False

End Function

Q7: Pascal

function IsFactor(Num1,Num2 : integer) : boolean;

begin
if Num2 <> 0 then
begin
if Num1 MOD Num2 = 0 then
Return True;
end;
Return False;

end;

Q7: Python

def IsFactor (Num1, Num2):


if Num2 != 0:
if Num1 % Num2 == 0:
Return True
Return False

© UCLES 2018 Page 13 of 13

You might also like