Cambridge Assessment International Education: Computer Science 9608/23 May/June 2018
Cambridge Assessment International Education: Computer Science 9608/23 May/June 2018
Cambridge Assessment International Education: Computer Science 9608/23 May/June 2018
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.
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.
• 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.
Marks awarded are always whole marks (not half marks, or other fractions).
• 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.
Rules must be applied consistently e.g. in situations where candidates have not followed
instructions or in the application of generic level descriptors.
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).
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.
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
Items 1 and 2 must have suitable prefix/suffix (i.e. not just ‘temperature’)
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
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
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
3(a) Paramete
ers 1
Accept arguments
3(b) 4
Mark as follows:
f
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
5(a)(i) 1 1
5(a)(ii) Information is saved after the program ends // after the computer is switched 1
off
• Indentation
• Colour-coding of keywords /comments
• Expansion / collapsing of complex data structures
5(c) ‘Pseudocode’ solution included here for development and clarification of Max 10
mark scheme.
Programming language solutions appear in the Appendix.
CLOSEFILE("ScoreDetails.txt")
RETURN(AverageScore)
ENDFUNCTION
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
RETURN FALSE
ENDFUNCTION
*** End of Mark Scheme – program code example solutions follow ***
Appendix
End Function
Q5(c): Pascal
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;
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()
End Function
Q7: Pascal
begin
if Num2 <> 0 then
begin
if Num1 MOD Num2 = 0 then
Return True;
end;
Return False;
end;
Q7: Python