Beruflich Dokumente
Kultur Dokumente
Upper 6
Computer Science
Paper 2
Time: 2hrs
Name: _____________________
Class: ________________
Examiner: __________________
Throughout the paper you will be asked to write either pseudocode or program code.
Complete the statement to say which high-level programming language you will use.
Programming language used: ............................................
Page 1 of 13
Question 1
A program is to be written to enter and display the first five riders on a mountain top in a
stage of a multiple stage of the Tour De France bike racing competition.
The first rider gets a 30 points bonus.
The second rider gets a 15 points bonus.
The third rider gets a 10 points bonus.
The fourth rider gets a 5 points bonus.
The fifth rider gets a 3 points bonus.
The structured English description of the problem is shown here:
01 Input surname of each rider
02 Input other names of each rider
03 Input position of each rider
04 Input team of player
05 Calculate the bonus points for each rider
06 Store the points in a provisionary table (which will later be added to the
mountains classification table)
07 Repeat step 01 until all 5 riders have been input
Typical output is shown:
Rank
Rider Name
Points
Froome
Christopher
Sky
30
Pantani
Marco
Carrera
15
Contador
Alberto
Garmin
10
Virenque
Richard
FDJ
Jalabert
Laurent
Once
Page 2 of 13
a)
i. Study the structured english and complete the identifiers table below:
Identifier
Data type
Description
RiderSurname
String
[5]
ii.
__________________________________________________________________
_______________________________________________________________[1]
iii. Suggest another acceptable way you could have written the identifier
__________________________________________________________________
_______________________________________________________________[1]
b) A record should be used to store details for riders. Write a piece of code in a
programming language for the declaring the record structure.
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
_______________________________________________________________ [5]
Page 3 of 13
Page 4 of 13
d) Line 05 in the structured English does not give sufficient details to write program
code from this statement.
Use Stepwise refinement to give detail for line 05.
[5]
Page 5 of 13
Question 2
The rider with the lowest aggregate time is the leader of the race and is on top of general
classification table. At the end of each stage, the time for that stage is added to the table.
The table needs to be sorted again
a)
[5]
b)
Page 6 of 13
Question 3
The record needs to be stored in a file.
a)
Explain why we need to store data in a file.
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
_____________________________________________________________________[1]
(b) Write program code that will store the record of 200 riders in a file call riders.dat.
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
_____________________________________________________________________[9]
Page 7 of 13
Question 4
There are different types of riders. The trainer may use the Body Mass Index (BMI) to
determine what category suits mosts to a rider
Among the categories there are
Climbing specialist
puncheur
Sprinter
The formula below is used to get the BMI of a rider
Page 8 of 13
Question 5
A student is experimenting with String manipulation. He testes the following functions in
a program.
Substr
Onechar
CharactercountConcat
Page 9 of 13
CHRASC
The figure below show part of the standard ASCII character codes:
Page 10 of 13
Page 11 of 13
c)
____________________________________________________________[2]
Page 12 of 13
Quesition 6
The students is now experimenting with maths expression. Besides the normal +, -, *
and / expressions he also works with the following:
The expression 17 DIV 7 evaluates to 2
The expression 17 MOD 3 evaluates to 3
The expression ROUND(4.6) evaluates to 5
The expression ROUND(4.2) evaluates to 4
The expression FLOOR(4.6) evaluates to 4
The expression CEILING(4.6) evaluates to 5
Write expressions to find the
a) The sum of 5 and 10
_______________________________________________________________[1]
b) the remainder when 13 is divided by 3
_______________________________________________________________[1]
c) the integreal part of 10.5
_______________________________________________________________[1]
d) 10.8 rounded to the nearest integer
_______________________________________________________________[1]
e) the quotient when 13 is divided by 3
_______________________________________________________________[1]
f) the nearest intgeger greater than 10.2
_______________________________________________________________[1]
Page 13 of 13