Professional Documents
Culture Documents
Evidence
Evidence
Screenshots or program listings must be copied into appropriate cells in the following table.
Save this evidence document as evidence_ followed by your centre number_ candidate number,
for example, evidence_ zz999_9999 and insert your name, centre number and candidate number
into the header above.
Examiners must be able to read the contents including any screenshots without the use of a
magnifying glass. Answers that are not readable or are missing will not be awarded any marks.
Save this evidence document at regular intervals, for example every 10 minutes.
Question 1
Part 1(a)(i)
#DECLARE DataArray : ARRAY[0:24] OF INTEGER
DataArray = []
Part 1(a)(ii)
file = open("Data.txt", "r")
Part 1(b)(i)
def PrintArray(IntArray):
Output = ""
for Count in range(len(IntArray)):
Output = Output + str(IntArray[Count]) + " "
print(Output)
Part 1(b)(ii)
PrintArray(DataArray)
Part 1(b)(iii)
1
9618 Paper 43 – AS & A Level Computer Science evidence document
Part 1(c)
def LinearSearch(Array, Search):
found = 0
return found
Part 1(d)(i)
InputVal = int(input("Input number between 0 and 100 "))
NumTimes = LinearSearch(DataArray,InputVal)
Part 1(d)(ii)
Question 2
Part 2(a)(i)
class Vehicle():
#PRIVATE ID : STRING
#PRIVATE MaxSpeed : INTEGER
#PRIVATE CurrentSpeed : INTEGER
#PRIVATE IncreaseAmount : INTEGER
#PRIVATE HorizontalPosition : INTEGER
2
9618 Paper 43 – AS & A Level Computer Science evidence document
Part 2(a)(ii)
def GetCurrentSpeed(Self):
return Self.__CurrentSpeed
def GetMaxSpeed(Self):
return Self.__MaxSpeed
def GetIncreaseAmount(Self):
return Self.__IncreaseAmount
def GetHorizontalPosition(Self):
return Self.__HorizontalPosition
Part 2(a)(iii)
def SetCurrentSpeed(Self, SetVal):
Self.__CurrentSpeed = SetVal
Part 2(a)(iv)
def IncreaseSpeed(Self):
Self.__CurrentSpeed = Self.__CurrentSpeed + Self.__IncreaseAmount
Part 2(b)(i)
class Helicopter(Vehicle):
#PRIVATE VerticalPosition : INTEGER
#PRIVATE VerticalChange : INTEGER
#PRIVATE MaxHeight : INTEGER
Part 2(b)(ii)
3
9618 Paper 43 – AS & A Level Computer Science evidence document
def IncreaseSpeed(Self):
Self.__VerticalPosition = Self.__VerticalPosition + Self.__VerticalChange
Vehicle.SetCurrentSpeed(Self, (Vehicle.GetCurrentSpeed(Self) +
Vehicle.GetIncreaseAmount(Self)))
Vehicle.SetHorizontalPosition(Self, (Vehicle.GetCurrentSpeed(Self) +
Vehicle.GetHorizontalPosition(Self)))
Part 2(c)
def Output(Self):
print("Horizontal Position is", Self.__HorizontalPosition)
print("Speed is", Self.__CurrentSpeed)
def Output(Self):
print("Horizontal Position is", Vehicle.GetHorizontalPosition(Self))
print("Speed is", Vehicle.GetCurrentSpeed(Self))
print("Vertical Position is", Self.__VerticalPosition)
Part 2(d)(i)
Car = Vehicle("Tiger", 100, 20)
Car.IncreaseSpeed()
Car.IncreaseSpeed()
Car.Output()
Part 2(d)(ii)
4
9618 Paper 43 – AS & A Level Computer Science evidence document
Question 3
Part 3(a)
#DECLARE Animal : ARRAY[0:19] OF STRING
#DECLARE Colour : ARRAY[0:9] OF STRING
global Animal
global Colour
Animal = []
Colour = []
AnimalTopPointer = 0
ColourTopPointer = 0
Part 3(b)(i)
def PushAnimal(DataToPush):
global Animal
global AnimalTopPointer
Part 3(b)(ii)
def PopAnimal():
global Animal
global AnimalTopPointer
if AnimalTopPointer == 0:
return ""
else:
ReturnData = Animal[AnimalTopPointer - 1]
AnimalTopPointer = AnimalTopPointer - 1
return ReturnData
Part 3(b)(iii)
def ReadData():
try:
5
9618 Paper 43 – AS & A Level Computer Science evidence document
except IOError:
print("File not found")
Part 3(b)(iv)
def PushColour(DataToPush):
global Colour
global ColourTopPointer
if ColourTopPointer > 9:
return False
else:
Colour.append(DataToPush)
ColourTopPointer = ColourTopPointer + 1
return True
def PopColour():
global Colour
global ColourTopPointer
if ColourTopPointer == 0:
return ""
else:
ReturnData = Colour[ColourTopPointer - 1]
ColourTopPointer = ColourTopPointer - 1
return ReturnData
Part 3(b)(v)
def ReadData():
try:
fileAnimal = open("AnimalData.txt", "r")
for line in fileAnimal:
temp = line.strip()
PushAnimal(temp)
fileAnimal.close()
6
9618 Paper 43 – AS & A Level Computer Science evidence document
except IOError:
print("File not found")
Part 3(c)
def OutputItem():
TempAnimal = PopAnimal()
TempColour = PopColour()
print(TempColour, TempAnimal)
if TempColour == "":
PushAnimal(TempAnimal)
print("No colour")
if TempAnimal == "":
PushColour(TempColour)
print("No animal")
Part 3(d)(i)
ReadData()
for count in range(4):
OutputItem()
Part 3(d)(ii)