Computer Science (9608) · May/June 2019 · Mark scheme 23

Cambridge Computer Science (9608) mark scheme for paper 23, May/June 2019 — 9608/23/M/J/19, file 9608_s19_ms_23.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge Assessment International Education
Cambridge International Advanced Subsidiary and Advanced Level

COMPUTER SCIENCE

9608/23

Paper 2 Written Paper

May/June 2019

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 2019 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 13 printed pages.
© UCLES 2019

[Turn over

9608/23

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
May/June 2019
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 2019

Page 2 of 13

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
May/June 2019
PUBLISHED

9608/23

Question

Answer

1(a)

6

Mark as follows:
•
•

© UCLES 2019

Marks

One mark per area outlined, in correct place
Decision must be diamond symbol and have two outputs with at least one
label (YES / NO)

Page 3 of 13

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
May/June 2019
PUBLISHED

9608/23

Question

Answer

1(b)(i)

Marks

Expression

Evaluates to

STRING_TO_NUM(MID(ProductID, 3, 2)) + 4

5

31.0 / 31

INT(MeltingPoint / 2)

90

Soluble AND Attempt > 3

FALSE

LENGTH(ProductID & NUM_TO_STRING(MeltingPoint))
RIGHT(ProductName, 4) & MID(ProductName, 5, 4)

11
"postroom"

Quotes for row 5 only
1(b)(ii)

Variable

Data type

MeltingPoint

REAL

Soluble

BOOLEAN

Attempt

INTEGER

Version

CHAR

ProductID

STRING

5

One mark per data type

Question
2(a)

Answer
One mark for each point:
•
•
•
•
•

2(b)

© UCLES 2019

5

Initialise a count to zero
loop 100 times // loop through all of the array
compare an element with "Empty" in a loop
increment the count if equal in a loop
Output a message together with the count not inside a loop

One mark for each point:
•
•
•

Marks

3

The breaking down of an algorithm / task / problem
to a level of (sufficient) detail // into smaller parts / sub-tasks
from which it can be programmed // which are easier to program

Page 4 of 13

9608/23

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
May/June 2019
PUBLISHED

Question
2(c)

Answer
Mode: READ
Description: Used to read data from a file // input data from a file to the program
// only allows you to read data from the file / can't change the data

Marks
4

Mode: APPEND
Description: Used to add data // write to the end of the text file // output data from
the program to the end of a file (without changing / deleting anything)
One mark for mode; one mark for corresponding description
2(d)

Write:
Use an editor to write the source code / program / high-level language code.
Or by example of feature:
An editor provides (features such as) context-sensitive prompts / dynamic syntax
checking / PrettyPrint / auto-indentation etc.
Translate:
A translator (compiler) will convert the source code / program / high-level
language code into object code / machine code / an executable file
A translator (interpreter) is used to translate the source code / program / high-level
language code line by line // Or by example: identify syntax errors
Or by example of feature:
A translator will identify errors
Test:
A debugger is used to find / (help to) correct errors.
Or by example of feature:
e.g. single-step, break-points, watch-window«
One mark per category (Write, Translate, Test) for each reference to a specific
‘feature’.

© UCLES 2019

Page 5 of 13

3

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
May/June 2019
PUBLISHED

9608/23

Question

Answer

3(a)

Marks
6

Mark as follows:

3(b)

•

One mark for four boxes connected as shown (search, allocate and enable in
the correct order)

•

One mark for each of:
• Arrows labelled AA, BB and CC with correct symbols
• Return parameter from Search with correct symbol
• Return boolean from Allocate with correct symbol
• Double-headed arrow for DD

•

One mark for repetition arrow (either direction)

•
•

He would use his transferrable skills to understand the new program
He could recognise (or equivalent phrase) basic control structures in the
language / by example of a program construct (loops, conditional,
declaration...)
He could read the comments / meaningful variable names

•

One mark for each bullet point

© UCLES 2019

Page 6 of 13

2

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
May/June 2019
PUBLISHED

9608/23

Question

Answer

4(a)

DECLARE Name : ARRAY [1:40] OF STRING
DECLARE Index : INTEGER

Marks
4

FOR Index ← 1 TO 40
OUTPUT "Input the name for student ", Index
INPUT Name[Index]
ENDFOR
One mark for each of the following:

4(b)

1.
2.
3.
4.

Declaration of array and index
Loop for 40 elements
Prompt (as above, including student number) and input for name in a loop
Assign the name to an array element in a loop

•
•

Program code easier to read / modify / debug
Easier to access individual elements of / search for a vaue in the ‘data set’ //
single identifier used

Question
5(a)(i)

Answer
To test every path through the code / algorithm

1

Marks
1

Accept phrase with equivalent meaning
5(a)(ii)

A trace table

1

5(b)(i)

String:
• three possible formats for string containg two words:
"Cat∇∇Dog" // "Cat∇Dog∇" // "∇Cat∇Dog"

3

Explanation:
• When a space character is encountered
• NumWords is incremented by 1
OR:
• The algorithm counts the spaces
• and not the words
1 mark for a string that would give the correct result
2 marks for explanation

© UCLES 2019

Page 7 of 13

9608/23

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
May/June 2019
PUBLISHED

Question
5(b)(ii)

Answer
String 1:
• Output: Number of words : 2
Description 1:
• Check character at end of string
• If not a character, increment variable NumTotal
OR:
• Add a space at the beginning / end of string
• At the start of the algorithm
OR:
• Change Initialisation of NumWords
•
to 1
OR:
• After the loop
• Add 1 to NumWords
String 2:
• Output: Number of words : 5
Description 2:
• Detect a space followed by a space
• Count as a single space / only increment variable NumTotal once
OR:
• Replace all double spaces with a single space
• Before the loop
OR:
• After the loop
• Subtract 2 from NumWords
Many possible solutions.
One mark for each correct output
One marks for each description bullet point

© UCLES 2019

Page 8 of 13

Marks
6

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
May/June 2019
PUBLISHED

9608/23

Question
6(a)

Answer
‘Pseudocode’ solution included here for development and clarification of mark
scheme.
Programming language example solutions appear in the Appendix.
FUNCTION SearchFile (SearchString : STRING) RETURNS STRING
DECLARE FileData : STRING
DECLARE Found : BOOLEAN
DECLARE SearchLength : INTEGER
Found ← FALSE
SearchLength ← LENGTH(SearchString)
OPENFILE "StudentContact.txt" FOR READ
WHILE NOT EOF("StudentContact.txt") AND NOT Found
READFILE "StudentContact.txt", FileData
IF SearchString = LEFT(FileData, SearchLength)
THEN
Found ← TRUE
ENDIF
ENDWHILE
CLOSEFILE "StudentContact.txt"
IF NOT FOUND
THEN
RETURN ""
ELSE
RETURN FileData
ENDIF
ENDFUNCTION
One mark for each of the following:
1.
2.
3.
4.
5.
6.
7.
8.

© UCLES 2019

Function header and end (where appropriate). Parameter optional but if
present must be of type STRING
Calculate length of string from parameter // extract substring from file line
File OPEN() in READ mode and subsequent CLOSE()
WHILE loop repeating until EOF()
read a line from the file in a loop
compare name from file with SearchString in a loop
exit loop if SearchString found
Return the line from the file if SearchString found or an empty string if not
found

Page 9 of 13

Marks
8

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
May/June 2019
PUBLISHED

9608/23

Question
6(b)

Answer
FUNCTION ProcessArray() RETURNS INTEGER
DECLARE
DECLARE
DECLARE
DECLARE

Marks
9

NoTelNumber : INTEGER
Index : INTEGER
ThisName : STRING
StudentData : STRING

NoTelNumber ← 0
FOR Index ← 1 to 40
ThisName ← ClassList[Index]
IF ThisName <> "" //Skip blanks
THEN
StudentData ← SearchFile(ThisName)
IF StudentData = "" //Student not found
THEN
StudentData ← ThisName & "*No number"
NoTelNumber ← NoTelNumber + 1
ENDIF
CALL AddToFile(StudentData, "ClassContact.txt")
ENDIF
ENDFOR
RETURN NoTelNumber
ENDFUNCTION
One mark for each of the following:
1.
2.
3.
4.
5.
6.
7.
8.
9.
6(c)

Function header and end, including return parameter
Declaration and initialisation of local count variable (NoTelNumber)
FOR loop for 40 array elements «
skip empty elements in a loop
use SearchFile(ThisName) and save return value in a loop
if Searchfile() returns an empty string, add "*No number" to
SearchString …
... and increment count
call AddToFile with both parameters as above in a loop
Return count outside the loop

‘Pseudocode’ solution included here for development and clarification of mark
scheme.
Programming language example solutions appear in the Appendix.
FUNCTION ProcessArray (ClassList : ARRAY, ClassContact :
STRING)
RETURNS : INTEGER
One mark per underlined section.

*** End of Mark Scheme – example program code solutions follow ***
© UCLES 2019

Page 10 of 13

3

9608/23

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
May/June 2019
PUBLISHED

Program Code Example Solutions
Q6 (a): Visual Basic
Function SearchFile(SearchString As String) As String
Dim FileData As String
Dim Found As Boolean
Dim SearchLength As Integer
Dim FileName As String
Found = False
SearchLength = Len(SearchString)
FileName = "StudentContact.txt"
FileOpen(1, FileName, OpenMode.Input)
While Not EOF(1) And NOT Found
FileData = LineInput(1)
If SearchString = Left(FileData, SearchLength) Then
Found = True
End If
End While
FileClose(1)
If Not Found Then
Return ""
Else
Return FileData
End If
End Function
Alternative:
Function SearchFile (SearchString As String) As String
Dim FileData As String
Dim Found As Boolean
Dim SearchLength As Integer
Dim MyFile As System.IO.StreamReader
MyFile = My.Computer.FileSystem.OpenTextFileReader("StudentContact.txt")
Found = False
SearchLength = Len(SearchString)
Do While MyFile.Peek <> -1
FileData = MyFile.Readline()
If SearchString = LEFT(FileData, SearchLength) Then
Found = True
return(FileData)
End If
Loop
MyFile.Close
If NOT Found then
return ("")
End If
End Function

© UCLES 2019

Page 11 of 13

9608/23

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
May/June 2019
PUBLISHED

Q6 (a): Pascal
function SearchFile(var SearchString: string):string;
var Found : Boolean;
SearchLength : integer;
FileData : string;
MyFile : text;
begin
Found := False;
SearchLength := Length(SearchString);
Assign(MyFile, 'StudentContact.txt');
Reset(MyFile);
While NOT EOF(MyFile) AND Found = False do
Begin
Readln(MyFile, FileData);
If SearchString = LeftStr(FileData,SearchLength) then
Found := True;
End;
Close(MyFile);
If NOT Found then
SearchFile := ''
else
SearchFile := FileData;
End;
Q6 (a): Python
def searchFile(searchString):
##Declare filedata : string, found : boolean, searchLength : integer
##returns a string value
found = False
searchLength = len(searchString)
myFile = open("StudentContact.txt", 'r')
fileData = myFile.readline()
while found == False:
fileData = myFile.readline()
if not fileData.strip(): #check if no data/end of file
break
else:
if searchString == fileData[0:searchLength]:
found = True
print(searchString)
myFile.close
if found == False:
return("")
else:
return(fileData)

© UCLES 2019

Page 12 of 13

9608/23

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
May/June 2019
PUBLISHED

Q6 (c): Visual Basic
Function ProcessArray (ClassList() As String, ClassContact As String) As
Integer
OR
Function ProcessArray (ClassList As String(), ClassContact As String) As
Integer
Q6 (c): Pascal
function ProcessArray (var ClassList:CList; ClassContact:string) :integer;
CList is user-defined type – could be any name that’s not a keyword
Q6 (c): Python
def ProcessArray (ClassList, ClassContact) :

© UCLES 2019

Page 13 of 13

Advertisement