COMPUTER SCIENCE
9608/04
MAXIMUM MARK: 75
[Turn over
2
1
[1]
[1]
[1]
[1]
(ii) 6
[1]
(iii) 0
item not present in array
non zero
position of the item in the array
[1]
[1]
[1]
[1]
(d) BinarySearch(1,63)
[1]
)
)
)
)
)
)
)
)
[1]
[1]
[1]
[1]
[1]
[Total: 15]
UCLES 2012
9608/04/SM/15
3
(a)
Actions
Conditions
1 2
Group 1 tests
Y Y Y Y N N N N
Group 2 tests
Y Y N N Y Y N N
Group 3 tests
Y N Y N Y N Y N
Accepted
Repair
Y Y
Rejected
Y Y Y Y Y
correct column 1
correct columns 2 and 3
correct column 4
correct columns 58
[1]
[1]
[1]
[1]
Actions
Conditions
(b)
0
1 2
Group 1 tests
Y Y Y Y N
Group 2 tests
Y Y N N
Group 3 tests
Y N Y N
Accepted
Repair
Rejected
Y Y
Y Y
correct column 1
correct column 2
correct column 3
correct column 4
correct column 5
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[Total: 12]
UCLES 2012
9608/04/SM/15
[Turn over
4
3
(a)
Start
Jon
Kellie
Scarlett 0
Mark as follows:
Three correct items
Indication of correct order with start and termination
[1]
[1]
[1]
[1]
[1]
[1]
[1]
(d) (i)
NameList
HeadPointer
0
FreePointer
1
Name
Pointer
[1]
[2]
[3]
[4]
:
:
[49]
50
[50]
Mark as follows:
HeadPointer
FreePointer
Pointers[1] [49]
Pointer[50]
UCLES 2012
[1]
[1]
[1]
[1]
9608/04/SM/15
5
(ii) FOR Index 1 TO 49
NameList[Index].Pointer Index + 1
ENDFOR
NameList[50].Pointer 0
HeadPointer 0
FreePointer 1
Mark as follows:
Correct FOR loop
Correct setting of Pointer[50], HeadPointer and FreePointer
(e) (i) 01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[1]
[1]
PROCEDURE AddItem(NewItem)
//
NameList[FreePointer].Name NewItem
CurrentPointer HeadPointer
//
REPEAT
IF NameList[CurrentPointer].Name < NewItem
THEN
PreviousPointer CurrentPointer
CurrentPointer NameList[CurrentPointer].Pointer
ENDIF
UNTIL NameList[CurrentPointer].Name > NewItem
//
IF CurrentPointer = HeadPointer
THEN
NameList[FreePointer].Pointer HeadPointer
HeadPointer FreePointer
ELSE
NameList[FreePointer].Pointer
NameList[PreviousPointer].Pointer
NameList[PreviousPointer] FreePointer
ENDIF
FreePointer NameList[FreePointer].Pointer
ENDPROCEDURE
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[Total: 22]
UCLES 2012
9608/04/SM/15
[Turn over
6
4
(a)
2
D
C
6
3
5
[max 4]
[1]
(ii) 20
[1]
(c) (i) 8
[1]
(ii) 17
[1]
[Total: 8]
UCLES 2012
9608/04/SM/15
7
5
(a)
PassengerVehicle
regNo: STRING
noOfSeats: INTEGER
showRegNo()
showNoOfSeats()
Bus
Coach
maxStanding: INTEGER
seatBeltsFitted: BOOLEAN
constructor()
showMaxStanding()
constructor()
showSeatBeltsFitted()
Mark as follows:
noOfSeats declaration and associated show method in PassengerVehicle
inheritance arrows
constructor method in Coach
seatBeltsFitted declaration and associated show method in Coach
[1]
[1]
[1]
[1]
UCLES 2012
9608/04/SM/15
[1]
[1]
[1]
[1]
[1]
[Turn over
8
e.g. in Visual Basic:
MustInherit Class PassengerVehicle
Protected regNo As String
Protected noOfSeats As Integer
Public Sub showRegNo()
Console.WriteLine(regNo)
End Sub
Public Sub showNoOfSeats()
Console.WriteLine(noOfSeats)
End Sub
End Class
Mark as follows:
MustInherit
data declarations
protected
showRegNo function
showNoOfSeats function
[1]
[1]
[1]
[1]
[1]
UCLES 2012
[1]
[1]
[1]
[1]
[1]
9608/04/SM/15
9
e.g. in Visual Basic:
Class Bus
Inherits PassengerVehicle
Private maxStanding As Integer
Public Sub New(ByVal regNoValue As String, ByVal
noOfSeatsValue As Integer, ByVal
maxStandingValue As Integer)
regNo = regNoValue
noOfSeats= noOfSeatsValue
maxStanding = maxStandingValue
End Sub
Public Sub ShowMaxStanding ()
Console.WriteLine(maxStanding)
End Sub
End Class
Mark as follows:
inheritance
private
Public Sub New header
Initialisations in Sub New
ShowMaxStanding function
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[1]
[Total: 18]
UCLES 2012
9608/04/SM/15
10
BLANK PAGE
UCLES 2012
9608/04/SM/15