Computer Science (9608) · Oct/Nov 2017 · Mark scheme 23

Cambridge Computer Science (9608) mark scheme for paper 23, Oct/Nov 2017 — 9608/23/O/N/17, file 9608_w17_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

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 12 printed pages.
© UCLES 2017

[Turn over

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
October/November
2017
PUBLISHED

9608/23

Question

Answer

1(a)(i)

Marks
6

Data value
27

Data type
INTEGER

"27"

STRING

"27.3"

STRING

TRUE

BOOLEAN

27/3/2015
27.3

DATE // DATETIME
REAL

One mark for each data type
Mark first data type given in each case
1(a)(ii)

1D Array // 1DList

2

1(a)(iii)

•
•

Each character is represented by an unique / corresponding
binary code / integer / value

2

1(b)

•
•
•
•
•

When a section of code would be repeated
When a piece of code is needed to perform a specific task
To support modular programming / step wise refinement
Easier to debug / maintain
Built-in / library routines are tried and tested

Max 2

One mark per answer
1(c)

CASE OF MyVar
1: CALL Proc1()
2: CALL Proc2()
3: CALL Proc3()
OTHERWISE OUTPUT "Error"
ENDCASE

4

One mark for:
•
•
•
•

© UCLES 2017

First line and ENDCASE
All clauses for 1, 2 and 3
'OTHERWISE' clause
OUTPUT statement

Page 2 of 12

Cambridg
ge Internatio
onal AS/A Level
L www.dynamicpapers.com
– Mark Scheme
Octobe
er/Novembe
er
201
17
P
PUBLISHED
D

9608/23
9

Ques
stion
1((d)

Answerr
Ability to recog
gnise:
• selection statement
• iteration statement
s
ent statemen
nts
• assignme
arations / sttructures / d
data types / use of variables or obj
bjects
• data decla
s
/ fu
unctions / p
procedures / subroutine
es
• modular structure
e paramete
ers
• subroutine
• Specific tyypes of stattement, e.g.. Input, Output, File operations
mat
• Code form
• Operatorss

M
Marks
M 2
Max

ws:
Mark as follow
Anyy two from above,
a
or va
alid alternattive
Acccept by example

Ques
stion

Answerr

2((a)

M
Marks
3

One
e mark for correct
c
Num
mber column
n
One
e mark for correct
c
Rem
mainder colu
umn
One
e mark for correct
c
Outp
put
2((b)

Mark as follow
ws:
en) range of
o values
• For a (give
e number of
o times one
e number (numerator) is an exact ddivisor of th
he
• Counts the
other
ator (only)
• Outputs each numera
he count
• Outputs th
Acccept by example
No mark for:
e the remainder
• ...calculate
e to NumberFound
• ...add one

© UCLES 2017

Page 3 of 12

3

9608/23
9

Ques
stion

Cambridg
ge Internatio
onal AS/A Level
L www.dynamicpapers.com
– Mark Scheme
Octobe
er/Novembe
er
201
17
P
PUBLISHED
D
Answerr

2((c)

© UCLES 2017

M
Marks
10

Page 4 of 12

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
October/November
2017
PUBLISHED

9608/23

Question
2(c)

Answer
Mark as follows:
•
•
•

One mark for START and STOP / END
One mark for bracketed pair
One mark for each of other labelled boxes (shape must be correct for decision
box)

Decision box outputs must have two outputs and at least one label (Yes / No)
Different statement categories should not appear in the same symbol (e.g. assignment
and I/O)
No mark for symbol (or pair) if parent missing or logically incorrect (except for
START/END)
Full marks should be awarded for functionally equivalent solutions.

© UCLES 2017

Page 5 of 12

Marks

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
October/November
2017
PUBLISHED

9608/23

Question
3(a)

Answer
PROCEDURE
DECLARE
DECLARE
DECLARE
DECLARE
Declare

BubbleSort
Temp : STRING
FirstID, SecondID : INTEGER
NoSwaps : BOOLEAN
Boundary : INTEGER
J : INTEGER

Boundary ← 99
REPEAT
NoSwaps ← TRUE
FOR J ← 1 TO Boundary
FirstID ← UserNameArray[J]
SecondID ← UserNameArray[J + 1]
IF FirstID > SecondID
THEN
Temp ← UserNameArray[J]
UserNameArray[J] ← UserNameArray[J + 1]
UserNameArray[J + 1] ← Temp
NoSwaps ← FALSE
ENDIF
ENDFOR
Boundary ← Boundary - 1
UNTIL NoSwaps = TRUE
ENDPROCEDURE

Mark as follows:
1. Procedure heading and ending (allow array as input parameter)
2.

Variable declaration for counter / index (integer) or temp (string)

3.

Outer working loop

4.

Inner loop with suitable range

5.

Correct comparison in a loop

6.

Correct swap of complete array element in a loop

7.

Set flag to indicate swap in inner loop and resetting in outer loop

8.

Reducing Boundary in a loop

© UCLES 2017

Page 6 of 12

Marks
8

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
October/November
2017
PUBLISHED

9608/23

Question
3(b)

Answer
Pseudocode solution included here for development and clarification of mark scheme.
Programming language example solutions appear in the Appendix.
PROCEDURE FindRepeats
DECLARE i, RepeatCount: INTEGER
DECLARE FirstID, SecondID: STRING
RepeatCount ← 0
FOR i ← 2 TO 100
FirstID ← LEFT(UserNameArray[i – 1],6)
SecondID ← LEFT(UserNameArray[i],6)
IF FirstID = SecondID
THEN
RepeatCount ← RepeatCount + 1
OUTPUT(UserNameArray[i])
ENDIF
ENDFOR
IF RepeatCount = 0
THEN
OUTPUT "The array contains no repeated UserIDs"
ELSE
OUTPUT "There are " & RepeatCount & " repeated userIDs"
ENDIF
ENDPROCEDURE

Mark as follows (all must be correct syntax for chosen language):
1.

Procedure heading and ending

2.

Variable declaration for INTEGER (comment in Python) and initialisation for
RepeatCount (or equivalent name)

3.

Loop

4.

Extraction of UserID in a loop

5.

Correct comparison of consecutive elements« in a loop

6.

...output correct array element (NOT original, only duplicates) in a loop

7.

increment RepeatCount following a comparison in a loop

8.

Correct conditional statement checking RepeatCount (or equivalent) and then ...
... two correct final OUTPUT statements

© UCLES 2017

Page 7 of 12

Marks
Max 8

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
October/November
2017
PUBLISHED

9608/23

Question

Answer

Marks

3(c)(i)

•
•
•
•
•
•
•

3(c)(ii)

Integrated Development Environment or a suitable description

3(c)(iii)

Examples include:
•
•
•
•
•
•
•
•
•
•

3(c)(iv)

3

Problem definition
Design
Coding / programming
Testing
Documentation
Implementation
Maintenance

1
Max 2

context sensitive prompts
(dynamic) syntax checking
use of colours to highlight key words / pretty printing
Formatting
Single-stepping
Breakpoints
Report / watch window
(UML) modelling
Compiler/interpreter
Text editor
1

Run-time

Question

Answer

Marks

4(a)

2
Value

Formatted String

1327.5

"□ 1327.50"

1234

"□ 1234.00"

7.456

"□ □ □ 07.45"

Leading spaces must be present
4(b)

3
Value

Required output

Mask

1234.00

"1,234.00"

"0,000.00"

3445.66

"£3,445.66"

"£0,000.00"

10345.56

"$□ □10,345"

"$##00,000"

Currency and ‘punctuation’ symbols must be as shown

© UCLES 2017

Page 8 of 12

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
October/November
2017
PUBLISHED

9608/23

Question
5(a)

Answer
PROCEDURE MakeNewfile
DECLARE OldFileLine : STRING
DECLARE NewFileLine : STRING

Marks
8

OPENFILE "EmailDetails" FOR READ
OPENFILE "NewEmailDetails" FOR WRITE
WHILE NOT EOF("EmailDetails")
READFILE "EmailDetails", OldFileLine
NewFileLine ← "00" & OldFileLine
WRITEFILE "NewEmailDetails", NewFileLine
ENDWHILE
CLOSEFILE "EmailDetails"
CLOSEFILE "NewEmailDetails"
ENDPROCEDURE
Mark as follows:
1. Variable declaration of STRING for OldFileLine (or equivalent)
2.

Open EmailDetails for READ

3.

Open NewEmailDetails for WRITE

4.

Correct loop checking for EOF(EmailDetails)

5.

Reading a line from EmailDetails in a loop

6.

Correct concatenation in a loop

7.

Writing a line to NewEmailDetails in a loop

Closing both files
5(b)

6

Invalid string examples:
A string with nothing before ‘@’
A string with nothing after ‘@’
A string with 1 or 2 characters after ‘@’
A string with no ‘@’symbol
A string with more than one ‘@’ symbol
Explanation
Sensible explanation mapping each given string to an individual rule
One mark for string
One mark for explanation
Each rule should be tested once only

© UCLES 2017

Page 9 of 12

9608/23

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
October/November
2017
PUBLISHED

Programming Example Solutions
Q3(b): Visual Basic
Sub FindRepeats()
Dim Repeats As Integer
Dim i As Integer
Dim FirstID As String
Dim SecondID As String
Repeats = 0
For i = 1 To 99
FirstID = Left(UserNameArray(i), 6)
SecondID = Left(UserNameArray(i + 1), 6)
If FirstID = SecondID Then
Console.WriteLine(UserNameArray(i + 1))
Repeats = Repeats + 1
End If
Next i
If Repeats = 0 Then
Console.WriteLine(“The array contains no repeated UserIDs")
Else
Console.WriteLine(“There are “ & Repeats & " repeated UserIDs")
End If
End Sub
Alternative:
Sub FindRepeats ()
Dim RepeatCount, i As Integer
Dim FirstID, SecondID As String
RepeatCount = 0
For i = 1 to 99
FirstID = Left(UserNameArray(i-1),6)
SecondID = Left(UserNameArray(i),6)
If FirstID = SecondID then
Console.WriteLine (UserNameArray(i))
RepeatCount = RepeatCount + 1
End If
Next i
If RepeatCount = 0 then
Console.WriteLine ("The array contains no repeated UserIDs")
Else
Console.WriteLine ("There are "& RepeatCount & " repeated UserIDs")
End If
End Sub

© UCLES 2017

Page 10 of 12

9608/23

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
October/November
2017
PUBLISHED

Q3(b): Pascal
procedure FindRepeats ();
var
RepeatCount, i : integer;
FirstID, SecondID : string;
begin
RepeatCount := 0;
for i := 1 to 99 do
begin
FirstID := Copy(UserNameArray[i-1],1,6);
SecondID := Copy(UserNameArray[i],1,6);
if FirstID = SecondID then
begin
writeln (UserNameArray[i]);
RepeatCount := RepeatCount + 1;
end;
end;
if RepeatCount = 0 then
writeln ('The array contains no repeated UserIDs')
else
writeln ('There are ', RepeatCount,' repeated UserIDs')
end;

© UCLES 2017

Page 11 of 12

9608/23

Cambridge International AS/A Levelwww.dynamicpapers.com
– Mark Scheme
October/November
2017
PUBLISHED

Q3(b): Python
def FindRepeats():
#Repeats, i Integer
#FirstID, SecondID string
Repeats = 0
for i in range(0, len(UserNameArray)-1):
FirstID = (UserNameArray[i])[:6]
SecondID = (UserNameArray[i+1])[:6]
if FirstID == SecondID:
print(UserNameArray[i+1])
Repeats = Repeats + 1
if Repeats == 0:
print("The array contains no repeated UserIDs")
else:
print(“There are “, Repeats, " repeated UserIDs")
Alternative:
def FindRepeats ():
RepeatCount = 0

## Defined as an integer

for i in range (1,100):
lines(0,99) (2,101)
FirstID = UserNameArray[i-1]
SecondID = UserNameArray[i]
if FirstID[0:6] == SecondID[0:6]:
print (UserNameArray[i])
RepeatCount += 1

## depending on next two
## Defined as string
## Defined as string
## Using split

if repeatCount == 0:
print ('The array contains no repeated UserIDs')
else:
print ('There are ', RepeatCount,' repeated UserIDs')

© UCLES 2017

Page 12 of 12

Advertisement