Professional Documents
Culture Documents
O LEVEL
COMPUTER
SCIENCE
2210
PRACTICE PAPER OF
PRE-RELEASED MATERIAL 2015
You are advised to spend no longer than 40 minutes answering this section.
Here is a copy of the pre-release material.
DO NOT attempt Tasks 1, 2 and 3 now.
Use the pre-release material and your experience from attempting the tasks before the
examination to answer Section A Question 1.
TASK 1
A school keeps records of the weights of each pupil. The weight, in kilograms, of each pupil is
recorded on the first day of term. Input and store the weights and names recorded for a class of
30 pupils.
You must store the weights in a one-dimensional array and the names in another onedimensional array.
All the weights must be validated on entry and any invalid weights rejected. You must decide
your own validation rules. You may assume that the pupils names are unique. Ouput the names
and weights of the pupils in the class.
TASK 2
The weight, in kilograms, of each pupil is recorded again on the last day of term. Calculate and
store the difference in weight for each pupil.
TASK 3
For those pupils who have a difference in weight of more than 2.5 kilograms, output, with a
suitable message, the pupils name, the difference in weight and whether this is a rise or fall.
Page
Your program must include appropriate prompts for the entry of data. Error messages and other
outputs need to be set out clearly and understandably. All variables, constants and other
identifiers must have meaningful names. Each task must be fully tested.
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
Page
21. End If
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
Equation is used to calculate Weight Difference between First Day & Last Day
27. WeightDifference = WeightLastDay (PupilCount) WeightCountFirstDay (PupilCount)
28. WeightDifferenceCount (PupilCount) = WeightDifference
Data Validation For Weight Difference if more than 2.5 Kilogram
29. If WeightDifferenceCount (PupilCount) > 2.5 Then
Display appropriate message along with Name & Weight Difference if Weight Difference is
found more than 2.5 Kilogram on last day
30. Print NameCount (PupilCount), WeightDifferenceCount (PupilCount), Rise in Weight
31. Else if WeightCountLastDay(PupilCount) < WeightCountFirstDay (PupilCount)
32. Print NameCount (PupilCount), WeightDifferenceCount (PupilCount), Fall in Weight
Page
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
SOLUTION:
Programming Language (Visual Basic 6.0)
Declaration of Variables
Dim StudentName(1 To 3) As String
Dim StudentWeight(1 To 3) As Single
Dim WeightDifference(1 To 3) As Single
Dim STName As String
Dim count, Weight, Difference, PreviousWeight As Single
Initialization of Variables
STName = ""
count = 0
Weight = 0
Difference = 0
PreviousWeight = 0
Input Students Name and Weight in One Dimensional Array on First Day of the Term for 30
Students
For count = 1 To 30
STName = InputBox("Enter Student Name", "First day of the term")
StudentName(count) = STName
Weight = InputBox("Enter Student Weight in KG", "First day of the term")
Validation check to restrict invalid Weight
If Weight > 10 And Weight <= 100 Then
StudentWeight(count) = Weight
Else
MsgBox "Invalid Weight "
Weight = InputBox("Enter Valid Student Weight in KG", "First day of the term")
StudentWeight(count) = Weight
End If
Next count
Output all students Name and Weight from First Day of the Term
Page
For count = 1 To 30
MsgBox StudentName(count) & " " & StudentWeight(count), , "First day of the term"
Next count
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
Calculate Difference between Fist Day Weight and Last Day Weight of the Term
Difference = Val(StudentWeight(count)) - Val(PreviousWeight)
WeightDifference(count) = Difference
Page
MsgBox StudentName(count) & " has lost " & WeightDifference(count) * -1 & "KG", , "Last day of the
term"
End If
Next count
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
1. (a) All variables, constants and other identifiers should have meaningful names.
(i) Declare the array to store the students names.
For
Examiners
Use
...............................................................................................................................
(ii) Declare the arrays to store each students weight and weight difference.
...............................................................................................................................
...............................................................................................................................
(b) (i) Show the design of your algorithm to complete Task 1 and Task 2 using
pseudocode, programming statements or a flowchart. Do not include any of the
validation checks in your algorithm.
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
Page
[8]
....................................................................................................................................
....................................................................................................................................
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
(c) Show two different sets of student data that you could use to check the validation
used in Task 1. Explain why you chose each data set.
Set 1.............................................................................................................................
Reason for choice.........................................................................................................
....................................................................................................................................
....................................................................................................................................
Set 2.............................................................................................................................
Reason for choice.........................................................................................................
....................................................................................................................................
Page
....................................................................................................................................
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
(d) (i) Explain how you select the student with the Weight rise or Weight fall (Task 3).
You may include pseudocode or programming statements to help illustrate your
explanation.
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
....................................................................................................................................
(ii) How does your program work when there is weight of a student having no change?
Explain using your method given in part (d)(i).
....................................................................................................................................
....................................................................................................................................
Page
....................................................................................................................................
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
2. A golf course charges $10 for each game of two people. Each additional person incurs a
further charge of $2 per game. If they book two or more games in advance, they get a
10% discount on the total charge.
The following program has been written in pseudocode to calculate the charges for a
game.
1 extracost = 0
2 input numberpeople, numbergames
3 charge = 10 * numbergames
4 extrapeople = numberpeople 2
5 if numberpeople < 2 then extracost = 2 * extrapeople * numbergames
6 charge = extracost
7 if numbergames > 1 then charge = charge * 0.1
8 print charge
There are three errors in the program. Locate these errors and suggest a correct piece
of coding.
Error 1..........................................................................................................................
....................................................................................................................................
Correction 1..................................................................................................................
....................................................................................................................................
Error 2..........................................................................................................................
....................................................................................................................................
Correction 2..................................................................................................................
....................................................................................................................................
Error 2..........................................................................................................................
....................................................................................................................................
Correction 2..................................................................................................................
....................................................................................................................................
Page
....................................................................................................................................
(b) What type of validation check is being carried in line number 5 and 7?
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
count = 1
repeat
count = count + 1
(i)
Describe why the loop only inputs 999 dates instead of 1000.
.....................................................................................................................
.....................................................................................................................
.................................................................................................................. [1]
(ii)
What needs to be changed or added to the above code to make sure 1000
dates are input?
.....................................................................................................................
.....................................................................................................................
.................................................................................................................. [1]
(b) Errors in code can be found using test data.
Name three different types of test data. Using month from the pseudocode above,
give an example of each type of test data.
test data type 1....
example .....
.....
test data type 2....
example .....
.....
... [6]
Page
example .....
10
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
4. A piece of pseudocode was written to input 1000 positive numbers and then output the
highest and lowest numbers.
10 highest = 0
20 lowest = 0
30 for count = 1 to 100
40
input number
50
60
70
count = count + 1
80 next count
90 print highest, lowest
.
.
Correction.
.
.
Error 2..
.
.
Correction.
Error 3..
Page
11
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
.
.
Correction.
.
.
Error 4..
.
.
Correction.
Page
12
[8]
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
5. The following flowchart inputs ten temperatures and outputs the average (mean)
Page
13
temperature and the number of temperatures which were negative (i.e. < 0).
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
(a) Complete the trace table for this flowchart using the following test data:
5, 11, 16, -4, -10, 8, 10, -3, 17, 10
(b) What values are outputs from the flowchart using the above test data?
Page
14
..[1]
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
Page
15
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
Complete the set of instructions to draw the shape shown on the left:
1 PENDOWN
2 LEFT 90
3 REPEAT 2
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Page
16
[6]
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
7. A shop keeps its stock file on a computer system. Part of the file is shown in the diagram
below:
2. ..
.[2]
(c) State the data type that should be used for the WEIGHT (KG) data.
................................................................................................................................................[1]
(d) State one advantage of using fixed-length records for storing the data.
...............................................................................................................................................[1]
(COLOUR NOT B) AND (WEIGHT (KG) < 2.0)
......................................................................................................................................................[2]
Page
17
(e) Which STOCK NO data will be listed if the following search condition is input?
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
(f) Write down a search condition that will search for all the items with less than 16 in
stock and the price is more than $100.
..................................................................................................................................................... [3]
(g) State which field should be used to link this stock file to a supplier file. Give a reason
for your choice of field.
Field..................................................................................................................................................
Reason.............................................................................................................................................
Page
18
......................................................................................................................................................[2]
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887
VERY IMPORTANT:
Students are strongly advised to follow instructions written below.
1. Practice on each section of the algorithm of page 2 of this Pre-released materials
Practice Question Paper
2. Practice on topic Program flowchart of Past Papers (2011 2014 all May and October
papers) from previous syllabus Computer Studies 7010.
3. Practice on topic Logo Programming of Past Papers (2011 2014 all May and October
papers) from previous syllabus Computer Studies 7010.
4. Practice on topic Database of Past Papers (2011 2014 all May and October papers)
from previous syllabus Computer Studies 7010.
Your valued & precious feedback and suggestions are always appreciated.
GOOD LUCK!
Page
19
Website: sirtanviriqbalkhan.tk
Facebook: www.facebook.com/tanvirik
Email: tanviriqbalkhan@gmail.com
PHONE: +923212490887