Meaningful Variable Naming Guide
Meaningful Variable Naming Guide
&+$37(5
3$*(
3$*(
1 (a) All variables, constants and other identifiers must have meaningful names.
(i) State one array you used for Task 1. State the data type and purpose of this array.
Array ..................................................................................................................................
Purpose .............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
[3]
(ii) State one variable you used for Task 2 and one variable you used for Task 3. In each
case, state the data type and purpose of the variable.
Purpose ...............
....
...............................................................................................................
.............................................................................................................................
...................
.............................................................................................................................
...........................................................................................................................................
.....
........
. .....
.........................................
.........
. ............
....................
..........
. ..............
....
......
......
......
.......................................
...........................................................................................................................................
T sk 3 vvariable
Ta
Task aria
ar ia
abl
b e name ..
.......................................................................................................
........................................................................................................
D ta
Da t ttype
Data ype
yp e ...................
..........................................................................................................
...........................................................................................................................
Purpose .....................
..........................................................................................................
.............................................................................................................................
.....................................
........................................................................................................
...........................................................................................................................................
...........................................................................................................................................
[6]
(b) Write an algorithm to show how you calculated and output the number of late arrivals and the
average number of minutes late for each bus route (part of Task 2), using eitherr pseudocode,
programming statements orr a flowchart.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
.......................................
................................................................................................................
...................................................................................................................................................
...........................
.............................................................................................................................
...................................................................................................................................................
..
.......
................
. .....
.........................................
.........
. ............
....................
..........
. ..............
....
......
......
......
................
................................................................................................................................................... . ......
................
.....
...
. ...................................................................................................................................................
...................................................................................................................................................
......
....................
................................................................................................................................
...................................................................................................................................................
...........................................
..........................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
................................
......................................................................................................................
...................................................................................................................................................
...........
........
. ..
....
....
.................................................
. ........................................................................
. ............
................................................................................................................................................... ................
........
.........
..........................................................................................................................................
..
...................................................................................................................................................
....................................................................................................................................................
......
....
.......................................................................................................................................................
.....
......
. ..
.............................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [6]
© UCLES 2019 2210/21/M/J/19 [Turn over
3$*(
(c) Explain how your program uses the input in Task 3 to only find the data for that specific day
(part of Task 3). Any programming statements used in your answer must be fully explained.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
................................
......................................................................................................................
...................................................................................................................................................
...........
........
. ..
....
....
.................................................
. ........................................................................
. ............
................................................................................................................................................... ................
........
.........
..........................................................................................................................................
..
...................................................................................................................................................
....................................................................................................................................................
......
....
.......................................................................................................................................................
.....
...
....
. ..
.............................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
(d) Explain how you would alter your program in Task 1 to allow you to choose the number of
weeks to enter data on bus arrival times.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
................................................................................................... [2]
.............................................................................................................................................
Section B
2 Describe each of the following data types used in programming. In each case, give an example of
a piece of data to illustrate your answer. Each example must be different.
Char
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
String
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Boolean
................................
......................................................................................................................
...................................................................................................................................................
...........
...
.......
. ..
....
....
..................................................
. ........................................................................
. ............
................................................................................................................................................... ................
........
.........
.........................................................................................................................................
..
...................................................................................................................................................
[6]
3 (a) Giv
ve an
ve
Give an example
exa
ex ample of a conditional
cond
ditional statement using pseudocode.
............................................
........................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
1 (a) All variables, constants and other identifiers must have meaningful names.
Describe the data structures you have used in Task 1 to record the items for sale. Include
some sample data for each data structure you have described.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
................................
......................................................................................................................
...................................................................................................................................................
...........
........
. ..
....
....
.................................................
. ........................................................................
............................................................................................................................................. . ............
.......... [5]
(b) Ex
E plai
ain
ain how
Explain how your
yo
our program for
for Task 1 ensures the item number is unique.
....................................................................................................................................................
......
....
.......................................................................................................................................................
.....
......
. ..
.............................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
.................................................................................................. [2]
.............................................................................................................................................
(c) Write an algorithm for the part of Task 2 that allows the buyer to add a new bid, using
eitherr pseudocode, programming statements orr a flowchart. Assume that Task 1 has been
completed and that the item details have already been found.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
.......................................
................................................................................................................
...................................................................................................................................................
...........................
.............................................................................................................................
...................................................................................................................................................
..
.......
................
. .....
.........................................
.........
. ............
....................
..........
. ..............
....
......
......
......
................
................................................................................................................................................... . ......
................
.....
.....
...................................................................................................................................................
...................................................................................................................................................
......
....................
................................................................................................................................
...................................................................................................................................................
...........................................
..........................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
................................
......................................................................................................................
...................................................................................................................................................
...........
........
. ..
....
....
.................................................
. ........................................................................
. ............
................................................................................................................................................... ................
........
.........
..........................................................................................................................................
..
...................................................................................................................................................
....................................................................................................................................................
......
....
.......................................................................................................................................................
.....
......
. ..
.............................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [5]
(d) Explain how your program for Task 2 checks that a new bid is higher than previous bids for
an item.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
(e) Explain how your program identifies the items that have reached their reserve price, then
calculates and displays the total auction company fee for all sold items as part of Task 3. Any
programming statements used in your answer must be fully explained.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
.......................................
................................................................................................................
...................................................................................................................................................
...........................
.............................................................................................................................
...................................................................................................................................................
..
.......
................
. .....
.........................................
.........
. ............
....................
..........
. ..............
....
......
......
......
................
................................................................................................................................................... . ......
................
.....
.....
...................................................................................................................................................
...................................................................................................................................................
......
....................
................................................................................................................................
...................................................................................................................................................
...........................................
..........................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [5]
11
4 For each of the fourr groups of statements in the table, place a tick in the correct column to show
whether it is an example of Selection or Repetition.
Valida
atitio
Validationon ..........................................................................................................................................
............
.......................................................................................................................................
...........
............
..........
. ..
. .......
...........................................................................................................................
..........................................................................................................................................................
...........
...
. ...........
..............................
.. ..........................................................................................................
..........................................................................................................................................................
....................................................
.......................................................................................................
..........................................................................................................................................................
Example .....................................
........................................................................................................
...........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Verification ........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Example ...........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
[6]
1 (a) All variables, constants and other identifiers must have meaningful names.
(i) Describe the data structures that you have used to store the data for the concrete slabs
in Task 1, include the name, data type and use for each data structure.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................
.........................................................................................................
...........................................................................................................................................
........................
......................................................................................................................
...........................................................................................................................................
...
........
. ..
....
....
.................................................
. ........................................................................
..................................................................................................................................... . ..................... [5]
(ii)
i) St
tat
ate
Statee on
onee vvariable
ariable tha
at you have used in Task 3.
at
that
G ive
ve tthe
Give he d atta type for tthe
data he variable. State what it is used for.
V
Variab
ri ab
ble n
Variable ame ...........
name ..........................................................................................................
...................................................................................................................
Use .............................
........................................................................................................
....................................................................................................................................
...........................................................................................................................................
[3]
(b) Explain how you calculated the volume of a concrete slab in Task 1.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
(c) Write an algorithm for Task 2, using eitherr pseudocode, programming statements orr a
flowchart. Assume that Task 1 has been completed.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
................................
......................................................................................................................
...................................................................................................................................................
...........
........
. ..
....
....
.................................................
. ........................................................................
. ............
................................................................................................................................................... ................
........
.........
..........................................................................................................................................
..
...................................................................................................................................................
....................................................................................................................................................
......
....
.......................................................................................................................................................
.....
...
....
. ..
.............................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
© UCLES 2019 2210/22/O/N/19
3$*(
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
................................
......................................................................................................................
...................................................................................................................................................
...........
........
. ..
....
....
.................................................
. ........................................................................
. ............
................................................................................................................................................... ................
........
.........
..........................................................................................................................................
..
...................................................................................................................................................
....................................................................................................................................................
......
....
.......................................................................................................................................................
.....
......
. ..
.............................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [5]
© UCLES 2019 2210/22/O/N/19 [Turn over
3$*(
(d) Explain how you changed your program for Task 1 to meet the requirements for Task 3.
Include and fully explain any altered or additional programming statements.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
................................
......................................................................................................................
...................................................................................................................................................
...........
........
. ..
....
....
.................................................
. ........................................................................
. ............
................................................................................................................................................... ................
........
.........
..........................................................................................................................................
..
...................................................................................................................................................
....................................................................................................................................................
......
....
.......................................................................................................................................................
.....
...
....
. ..
.............................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
© UCLES 2019 2210/22/O/N/19
3$*(
10
Explain, including
inc
ncludi
ludi
dinng examples
ng examples
xa programming statements, how totalling and counting could be used
of programming
in this program.
prog
prog
ogra
graam.
To
ota
tallling
Totallingg ..
.........
....
.........
.................................................................................................................................
.............................................................................................................................................
..................................................
..........................................................................................................
..........................................................................................................................................................
...................................................
........................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Counting ...........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
[4]
11
Constants .........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Variables ..........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Arrays ...............................................................................................................................................
...................................................
..........................................................................................................
..........................................................................................................................................................
.............................................
...
..............................................................................................................
..
..........................................................................................................................................................
..................................
......
....
.............
..........................................................................................................
..........................................................................................................................................................
[6]
1 (a) All variables, constants and other identifiers must have meaningful names.
Name two arrays you could use for Task 1. State the data type and purpose of each one.
Array 1 ......................................................................................................................................
Purpose ....................................................................................................................................
...................................................................................................................................................
Array 2 ......................................................................................................................................
Purpose ....................................................................................................................................
...................................................................................................................................................
[4]
Variable .............
......
....
...............
.........................................................................................................
.....................................................................................................................................
Da
ata ttype
Data yp
pe ...................................................................................................................................
....
.......
.....................
. ...........
.....
................
. ...............
.......
.........
.....
. ...............................
. ....
. ......
. ......
................
Pur
rpos
rpo
rp ose ...
Purpose .....................................................................................................................................
....................................................................................................................................
......
....................
................................................................................................................................
...................................................................................................................................................
...........................................
..........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[4]
(c) Write an algorithm for Task 1, using eitherr pseudocode, programming statements orr a
flowchart. Assume that the first part of Task 1, the storage and display of tile descriptions,
prices per box and identification codes has already been done.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
.......................................
................................................................................................................
...................................................................................................................................................
...........................
.............................................................................................................................
...................................................................................................................................................
..
.......
................
. .....
.........................................
.........
. ............
....................
..........
. ..............
....
......
......
......
................
................................................................................................................................................... . ......
................
.....
...
. ...................................................................................................................................................
...................................................................................................................................................
......
....................
................................................................................................................................
...................................................................................................................................................
...........................................
..........................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
................................
......................................................................................................................
...................................................................................................................................................
...........
........
. ..
....
....
.................................................
. ........................................................................
. ............
................................................................................................................................................... ................
........
.........
..........................................................................................................................................
..
...................................................................................................................................................
....................................................................................................................................................
......
....
.......................................................................................................................................................
.....
......
. ..
.............................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [6]
© UCLES 2019 2210/23/O/N/19 [Turn over
3$*(
(d) Explain how you extended your program to complete Task 2. Any programming statements
you use in your answer must be fully explained.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
................................
......................................................................................................................
...................................................................................................................................................
...........
...
.......
. ..
....
....
.................................................
. ........................................................................
. ............
................................................................................................................................................... ................
........
.........
..........................................................................................................................................
..
...................................................................................................................................................
....................................................................................................................................................
......
....
.......................................................................................................................................................
.....
......
. ..
.............................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
© UCLES 2019 2210/23/O/N/19
3$*(
(e) Explain how you could validate the input for percentage waste allowance in Task 3.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
IF Response = 1
THEN
X X + Y
ELSE
IF Response = 2
THEN
X X – Y
ELSE
IF Response = 3
THEN
X X * Y
ELSE
IF Response = 4
THEN
X X / Y
ELSE
OUTPUT "No response"
ENDIF
ENDIF
ENDIF
ENDIF
........
.........
..........................................................................................................................................
..
...................................................................................................................................................
..............................................................................................................................................
......
.. ....
.................................................................................................................................................. [1]
(b) Re
e-w
wri
rite
te the
Re-write the
he pseudocode algorithm
algorithm using a CASE statement.
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
1 All variables, constants and other identifiers must have meaningful names.
(a) (i) Identify two arrays you could have used for Task 1 and, in each case, state its purpose.
Array 1 ...............................................................................................................................
Purpose .............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Array 2 ...............................................................................................................................
Purpose .............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
[4]
(ii) Identify two variabless you could have used for Task 1 and, in each case, state its
purpose.
Variable 1 ..
........
....
.....................................................................................................................
..........................................................................................................................
Purp
Pu r os
rp ose ..............................................................................................................................
Purpose .. .................................
..... .........
. ............
....................
.........
. ..............
....
......
......
......
.......................................
............................................................................................................................................
................................................................................................................................................
............................................................................................................................................
...........
. ....
................................................................................................................................
Variable 2 ..................
..........................................................................................................
..........................................................................................................................
Purpose .......................
........................................................................................................
.............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
[4]
(b) Explain why the item code data could not be stored as a real data type and identify the most
suitable data type for the item code data.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
(c) Write an algorithm to show how you input your choice of mobile device and SIM card (part of
Task 1), using eitherr pseudocode, programming statements orr a flowchart. It is not necessary
to show initialisation or setting up of arrays containing product details.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
.......................................
................................................................................................................
...................................................................................................................................................
...........................
........
....
.....................................................................................................................
...................................................................................................................................................
..
....
...................
. ....
................................................
. ..............................
..........
. ..............
....
...........
.....................
................................................................................................................................................... . ......
................
.....
...
. ...................................................................................................................................................
...................................................................................................................................................
......
................
. ....
................................................................................................................................
...................................................................................................................................................
...........................................
..........................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
.................................
.....................................................................................................................
...................................................................................................................................................
.............
........
....
....
....
. ...............................................
.. . ........................................................................
. ............
................................................................................................................................................... ................
........
.........
...........
.. . ..............................................................................................................................
...................................................................................................................................................
....................................................................................................................................................
......
.. .....................
. ..................................................................................................................................
.....
...
....
. ..
.. ....
..........................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [5]
© UCLES 2020 2210/21/M/J/20 [Turn over
3$*(
(d) Explain how your program completes Task 3. Any programming statements used in your
answer must be fully explained.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
.................................
.....................................................................................................................
...................................................................................................................................................
.............
........
....
....
....
. ...............................................
.. . ........................................................................
. ............
................................................................................................................................................... ................
........
.........
...........
.. . ..............................................................................................................................
...................................................................................................................................................
....................................................................................................................................................
......
.. .....................
. ..................................................................................................................................
.....
...
....
. ..
.. ....
..........................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [5]
4 The pseudocode algorithm shown should allow numbers to be entered and should allow
50 numbers to be stored in an array.
Count 0 ĸ
REPEAT
INPUT Values[Count]
Count Count + 1 ĸ
UNTIL Count = 0
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
...........................
........
....
.....................................................................................................................
...................................................................................................................................................
..
....
...................
. ....
................................................
. ...............................
.........
. ..............
....
...........
.....................
................................................................................................................................................... . ......
................
.....
...
. ...................................................................................................................................................
...................................................................................................................................................
......
................
. ....
................................................................................................................................
...................................................................................................................................................
...........................................
..........................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
(c) Describe how you could change your pseudocode in part (b) so that it prevents numbers
below 100 and above 200 from being stored in the array Values[ ]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
1 All variables, constants and other identifiers must have meaningful names.
(a) Identify two variables that you could have used for Task 1. Give the data type and state the
use of each variable.
Variable 1 ..................................................................................................................................
Use ...........................................................................................................................................
...................................................................................................................................................
Variable 2 ..................................................................................................................................
Use ...........................................................................................................................................
...................................................................................................................................................
[4]
Da
D
Dayy off a rriv
rr ival
iv
arrival al – vvalidation
alidation ch
ccheck
eck ...............................................................................................
....................................................................................................................................................
......
.. .....................
. ..................................................................................................................................
Jus
stifficcat
stif atio
Justificationion
io n .......................
..........................................................................................................
...............................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Justification ...............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[4]
(c) Explain how your program for Task 1 ensured that the frequent parking number entered by
the customer had a valid check digit.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
................................
......................................................................................................................
...................................................................................................................................................
.............
. ....
.. ......
....
....
.......................................
...........
. ......................................
. ...........................................................
...................................................................................................................................................
........
....
......
...........
. .............................................................................................................................
...................................................................................................................................................
..............................................................................................................................................
......
...
.......
. ..........................................................................................................................................
. . [4]
(d) Wrritite
Write e an al orithm for partt of
lg
algorithm of Task 2 that simulates customer payment and calculating total
payments using eitherr pseudocode,
pse eudocode, programming statements orr a flowchart. Assume that
Task 1 has been completed.
completed d.
............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
© UCLES 2020 2210/22/M/J/20
3$*(
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
.................................
.....................................................................................................................
...................................................................................................................................................
.............
........
....
....
....
. ...............................................
.. . ........................................................................
. ............
................................................................................................................................................... ................
........
.........
...........
.. . ..............................................................................................................................
...................................................................................................................................................
....................................................................................................................................................
......
.. .....................
. ..................................................................................................................................
.....
...
....
. ..
.. ....
..........................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
© UCLES 2020 2210/22/M/J/20 [Turn over
3$*(
(e) Explain how your program completed Task 3. Assume that Task 2 has been completed. Any
programming statements used in your answer must be fully explained.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
.................................
.....................................................................................................................
...................................................................................................................................................
.............
........
....
....
....
. ...............................................
.. . ........................................................................
. ............
................................................................................................................................................... ................
........
.........
...........
.. . ..............................................................................................................................
...................................................................................................................................................
....................................................................................................................................................
......
.. .....................
. ..................................................................................................................................
.....
...
....
. ..
.. ....
..........................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
.................................................................................................. [4]
.............................................................................................................................................
Section B
2 Most programming languages include basic data types. Ahmad is describing the basic data types
he has used.
A number with a fractional part that can be positive or negative and used in calculations
A whole number that can be positive, negative or zero and used in calculations
Data ttype
yp
pe ....
............
..........................
. ...........
.....
.................
. ...............
.......
.........
.....
. ................................
. ....
. ......
........................................................................................................................................... ......
................
A se
equ
quen
ence
en
sequencece
e of
of characters
char
charac
acte
ac ters
te
Data typ
yp
pe ...........................................................................................................................................
type .....
.........................................................................................................................................
12
5 Arrays are data structures used in programming. Explain what is meant by the terms dimension
and index in an array. Use examples of arrays in your explanations.
Dimension ........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Index ................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
...................................................
. .......................................................................................................
..
..........................................................................................................................................................
[3]
(a) Draw a line to link each pseudocode description to the most appropriate pseudocode
statement.
FOR…TO…NEXT
IF…THEN…ELSE…ENDIF
WHILE…DO…ENDWHILE
CASE…OF…OTHERWISE…ENDCASE
a cond
conditional
nd
dit
itio
tiio
ona
nall sst
statement
tattem
tat ment with
h
differen
ent outcomes
en
different outtc
comes s for
forr true
true and false
ffa
alse
e
REPEAT…UNTIL
[4]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
3 Tick (9) one box to show the named section of a program that performs a specific task.
A file
B function
C parameter
D process
[1]
[4]
10
8 A programmer has written an algorithm to check that prices are less than $10.00
10.00 ................................................................................................................................................
..........................................................................................................................................................
9.99 ..................................................................................................................................................
..........................................................................................................................................................
ten ....................................................................................................................................................
..........................................................................................................................................................
[3]
..................................
......
.........................................................................................................................
..........................................................................................................................................................
.........
......
.........................................................
...................
.. . ...............
.......
.........
.....
. ......
... . .......
...........................................
.......................................................................................................................................................... . .............
............
.....................................................................................................................................................
..........................................................................................................................................................
...........................................................................................................................................................
..........................
.. ......................................................................................................................................
..................................................
.........................................................................................................
..........................................................................................................................................................
...................................................
................................................................................................... [3]
.....................................................................................................................................................
Tick (9) one box which accurately describes the use of the variable Inches
A answer
B call
C parameter
D response
[1]
© UCLES 2020 2210/02/SP/23
3$*(
13
x X stores a string
x Y stores a position in the string (e.g. 2)
x Z stores the number of characters in the string.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
Wrrite
iitte ps
Write p
pse
se eu
udo
doco
pseudocode code
co e statements
statemeents to:
to
o:
x sst tore
storeore the
th
he ststr
tring "Progr
string ramming is fun" in X
gr
g
"Programming
x fifind
ind
d tthe
hee llength
engt
en gth of the string
gt string and output it
x ex xtra
trrac
extract act th
act he word
the woord fun ffrom
rom th
thee st
stri
r ng a
ri
string n o
nd
and utpu
ut p t itit.
pu
output t.
.....
...
. ..
...
...
............................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
. ......................................................................................................
..
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [6]
14
13 The 1D array StudentName[] contains the names of students in a class. The 2D array
StudentMark[] contains the mark for each subject, for each student. The position of
each student’s data in the two arrays is the same, for example, the student in position 10 in
StudentName[] and StudentMark[] is the same.
The variable ClassSize contains the number of students in the class. The variable SubjectNo
contains the number of subjects studied. All students study the same number of subjects.
The arrays and variables have already been set up and the data stored.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
15
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
...................................................
...........................................................................................................
..........................................................................................................................................................
........................................
.....................................................................................................................
..........................................................................................................................................................
...................
...
....
....
...
...
............
.... ................................
.. ............
........................
.. ..............
...
..............
....
..
.. .................................................
..........................................................................................................................................................
...............
.................................................................................................................................................
..........................................................................................................................................................
.......
...
.....
......
.. ..........
..........
. .....................................
.......
. ..
. ..........
...............
.........
............
... ..........
. ..
.............
. ..............
.. ....
........................................................................................................................................................... ......
......
. .....
.. ........
. ...............
............
.....................................................................................................................................................
..........................................................................................................................................................
....................................................
.......................................................................................................
..........................................................................................................................................................
...................................................
........................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
© UCLES 2020 2210/02/SP/23 [Turn over
3$*(
16
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
...................................................
...........................................................................................................
..........................................................................................................................................................
........................................
.....................................................................................................................
..........................................................................................................................................................
...................
...
....
....
...
...
............
.... ................................
.. ............
........................
.. ..............
...
..............
.....
. .................................................
..........................................................................................................................................................
...............
.................................................................................................................................................
..........................................................................................................................................................
.......
...
.....
......
.. ..........
..........
. .....................................
.......
. ..
. ..........
.................
.........
............
... ..........
. ..
.............
. ..............
.. ....
.......................................................................................................................................................... . ......
......
. .....
.. ........
. ...............
............
.....................................................................................................................................................
..........................................................................................................................................................
....................................................
.......................................................................................................
..........................................................................................................................................................
...................................................
........................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
................................................................................................................................................... [15]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
publisher will be pleased to make amends at the earliest possible opportunity.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of
Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge.
&+$37(5
0$5.,1*
6&+(0(
3$*(
3$*(
1(a)(i) Many correct answers, the name must be meaningful. Must relate to Task 1 3
1 mark per bullet point
e.g.1
Array BusA
Data type integer
Purpose storing the minutes late
e.g.2
Array Day
Data type string
Purpose storing the code for the day of the week
1(a)(ii) Many correct answers, the name must be meaningful. Names shown are 6
examples only.
1 mark per bullet point
Taskk 3 va variable
ariab e name
ble SearchDay
Data
D ata
at a type
t y pe
ty string
stri
st r ng
g
Purpose
P urpo
ur pose
po to iinput
n utt tthe
np day
he d ay tto
o be ssearched
ea
arc
rch
hed
d fo
for
1(b) 1 mark
mar
arkk for
for each
e ch point::
ea 6
MP1
MP1 Conditiona
n l statement to identify when a bus is late (punctuality
na
Conditional
< 0)
MP
MP2P2 Count the e number of late days for at least one bus route
MP3 e late minutes for at least one bus route
Total the
MP4 Calculation
Calculatioon of average minutes late
Three from:
MP1 The input stored as a variable
MP2 The method used to find the position of the day in the Day
array that matches the input
MP3 The array index is stored as a variable
MP4 The index variable used as the array index for each bus array
MP5 «and the contents of each array stored/output.
2 Many possible
possibl
ble
bl e answers,
an
a nswerrs, those given are examples only. 6
1 mark
rk for
for
o each
eac
a h correct
correcct description
desc
scri
sc rip
ptio
on and
a d 1 mark
an m rk
ma r for
for each
eac
ach
ac h correct
co
orr
rre
ectt example
exxam
ample
e
Cha
Ch ar
ar
Char
D
De s ri
sc ript
ptio
pt ion:
io
Description: n: A single ccharacter
haracter (from the keyboard)
Ex
xampl
am
mplple:
Example: e
e: A/#/2
Stri
St ring
ri
Stringng
g
D escription: An (ordered)
Description: (orde
ered) sequence of characters
Example: world
orld / #123?Y / 234 78963
Hello wo
or
Boolean
Description: A data type
p with two possible values
Example: TRUE / FALSE
Example answer:
IF X < 0
THEN
PRINT "Negative"
ELSE
PRINT "Not negative"
ENDIF
OR
Example answer:
CASE X OF
1: PRINT ("ONE")
("
"ON
O E")
2: PRINT
PRINNT ("TWO")
("
"TWWO")
OTHERWISE
OTHER
ERWI
ER WI SE PRINT
ISE PRIINT ("Less
("L
"Leess than
t an
th an ONE
E or
ONE or more
mo than
n TWO")
than TWO
TW O")
)
ENDCASE
ENDC
EN DC
D CAS
A E
3(b) T
Too al
a low diffe
allow erent routes through a program
different 2
d ep
pendent on
dependent n meeting certain criteria
Section A
Sample answer
REPEAT
PRINT "Enter Buyer Number"
INPUT BuyerNumber
UNTIL BuyerNumber >= BuyerLow and BuyerNumber <=
BuyerHigh
REPEAT
PRINT "Enter Bid B d -99 to exit"
Bi
INPUT Bid
IF Bid > HighestBid(item)
High
ghe
gh estBid(item)
THEN
Hig
ighe
ighe tBid(item) ĸ Bid
h st
HighestBid(item)
Num
umberBBids(s(
(it
item)
NumberBids(item) ) ĸ NumberBids(item)
Num
u beerB
rBid
i s(
(it
i em
em)) + 1
END
N IF
ENDIFF
UN
NTI
TIL Bid
TIL
UNTIL Bid > HighestBid(item)
Highes
estBBid
id(i
(ite
(i t m) OR
te OR Bid
Bi
id = -99
-9
99
F Bid
IF Bidd <>
<> -99
THEN
HE
THEN
Buye
Bu yerItem((item) ĸ BuyerNumber
BuyerItem(item)
ENDI
ENDI
DIF
ENDIFF
possib
ble correct answers, this is an example only.
There are many possible
Five from:
MP1 Method to search item arrays
MP2 Conditional statement used to check for the successful bids
MP3 « equal to / greater than reserve price
MP4 Method used to calculate 10% percent of successful bid (for each
item)
MP5 «and add to auction company total fee
MP6 Method used to display total fee with a suitable message
4 4
Statements Selection Repetition
FOR A ĸ 1 TO 100
B ĸ B + 1 9
NEXT A
CASE A OF
100: B ĸ A
9
200: C ĸ A
ENDCASE
IF A > 100
THEN
9
B ĸ A
ENDIF
REPEAT
A ĸ B * 10 9
UNTIL A > 100
Question Answer
Answ
An wer Marks
Marks
5 Validation
V
Vaaliidatitiion
on 6
Two
Tw o from:
fro
fr om
om:
x a automated
u omated checking
ut che
hecking
he
x cchecking
hecking thatt data
data is reasonable / of a certain type
x checking thatt data data meets certain criteria
Example 1 mark
x range check //
// length check // type check // check digit etc.
Verification
Two from:
x checking that data has not changed«
x « during input to a computer
x « during transfer between computers / devices
Example 1 mark
x double entry // checking against original // visual check // use of
checksum etc.
Section A
Additional data structure description using the same data structure type
maximum one mark
x Two or more full descriptions of the data structure including name, data
type and use
Sample answer
REPEAT
PRINT "Enter Number of slabs to purchase"
INPUT Number
UNTIL Number >= 20 and Number <= 100
PurchaseNo Number
IF Number > 20 AND D Number <= 40 THEN PurchaseNo 40
ENDIF
IF Number > 40 AND D Number <= 60 THEN PurchaseNo 60
AND
ENDIF
IF Number > 60 D Number <= 80 THEN PurchaseNo 80
60 AND
ND
ENDIF F
IF Number
IF Num
um er > 80 THEN
umbe THE
HE
EN PurchaseNo
Purc
Pu rcha
rc hase
seNo
se o 100
No 100
0 ENDIF
END
NDIF
IF
F
Baatc
tchN
hNo
hN
BatchNo o PurchaseNo
Purchas
seNo / 20
Prric
ceT ToP
oPay
PriceToPay y BatchNo
ay Batch
c No * BatchPrice //BatchPrice
ch
c
calc
alc
lcul
ulat
ul ated
calculatedted in Task k 1
PRRIN
INT
PRINT T "Price
"Pri
"P rice for ",
", PurchaseNo, " Slabs is $", PriceToPay
4 3
5 Totalling:
Tota
To t lllin
ta ing:
g: 4
x A Adding
d in
dd the
ng th off ea
he weight o each basket
ach b asske o tthe
et to total
he tot
ota
ot al w
al weight
eiigh each
ht as e ach
ac weight
h we
weig
ight
ht iss
entered
ente
en tere
red
re d
x To Total
T tal = Total + Weight
tal
Counting:
C
Co unti
un ting
ti ng::
ng
x A Adding
dding one to/incre
to/incrementing
ementing the number of baskets as each weight is
entered
x BasketCount = BasketCount
BasketCount + 1
6 Constants 6
Two from:
x The value cannot be changed accidentally «
x « during the execution of the program
x Value only needs to be changed once if circumstances change/during the
initialisation process
Variables
Two from:
x Stores a value that can change «
x « during the execution of the program
x Can use a variable without knowing its value
Arrays
Two from:
x A list of items of the same data type «
x « stored under a single name
x To reduce the num
number
mber of variables used
x Any item can be foundund using an index number to show its place in the list
fou
Questio Answer
A
An sw
wer
e Mark
Mark
M
n s
7(a) x N umbe
um be
b
Number er is repeated/not
repeate
ed/not unique 1
7(b)
b)) x IItem
tem number
tem
te numb
nu displayed/Amount
mber not dis
mb splayed/Amount column not required 5
x NNot
ot Like
Likke ‘Delivered’’ will
will also show cancelled items
Sort:
Show:
; ;
Criteria: Like "Not
started"
1(b) Any meaningful name for a variable related to Task 2 – one mark, e.g. 4
NumberOfWalls
TotalArea
TotalCost
Relevant data type for the variable related to Task 2 – one mark, e.g.
« Integer
« Real
One
O
On emmark
ark fo
ar for
or a ccorrect reason,
orrect re
reaso e.g.
on,, e .g.
V Variables
aria
ar ia
iabl
abl es allow the storage
bles storage of values within a program that may change as
the
th
he prprogram
prog
ogra
og raam runs // VVariables
ariables are used to store values that are input or
calculated
callc
ca lcul
lcul
ulat
a edd
Example algorithm
REPEAT
OUTPUT "Please enter height of wall "
INPUT Height
UNTIL Height > 0
REPEAT
"Pleasse enter
OUTPUT "Please enter width of wall "
INPUT Width
h
UNTIL Width > 0
REPE
RE PEAT
PE
REPEATAT
T
Found
ound
Found d m FALSE
Cou
o nt
nter
Countererr m 0
REEP
PEA
EAT
REPEAT T
OUT
UTPU
PUT "Please
OUTPUT "Pleas
ase enter tile identification code "
as
INPUT MyTileId
INPUT MyTileI
e d
eI
IF MyTileId = TileCode(Counter)
THEN
t m TilePrice(Counter)
MyCost
Found m TRUE
ENDIF
Counter m Counter + 1
UNTIL Found OR Counter = 10
UNTIL Found
2 Two from 2
Sub-program / system not the whole program / system
To perform a frequently used operation within a program
That can be called when needed
That can be reused by another program
3 FOR (… TO … NEXT)loop 3
WHILE (… DO … ENDWHILE) loop
REPEAT (… UNTIL) loop
0 16 FALSE
0 16 10 8 FALSE
0 7 10 3 FALSE
4 7 10 5 TRUE TRUE
on
ne m
Correct purpose for each array related to Task 1 – one ark
ar
rk (m
mark (max
ax
a two) e.g.
…to store the item codes
…to store the descriptions of the items for sale
1(a)(ii) Any meaningful variable related to Task 1 – one mark (max two)) e.
e
e.g.
g. 4
PurchaseItem
TotalPrice
Correct purpose for each variable related to Task 1 - one mark (max two) e.g.
… to allow input of an item/code for purchase
… to store/calculate the total price off the transaction
Example answer
OUTPUT "Which type of phone or tablet would you like?
like
ke?
ke ? Input
I put the Item Code"
In
DeviceFlag ← False
WHILE DeviceFlag = False
INPUT DeviceCode
Count ← 0
WHILE Count<10 DO
IF DeviceCode = ItemCode[Count]
THEN
IF Count < 6
THEN
3$*(
DeviceType ← "Phone"
ELSE
DeviceType ← "Tablet"
ENDIF
DeviceFlag ← True
Count ← 10
ENDIF
Count ← Count + 1
ENDWHILE
IF DeviceFlag = False
THEN
Question Answer
An swer
wer Marks
2 2
True False
Statement
(9) (9)
3(a) One mark for each correct validation check (max two)) 4
• Range
• Length
• Type
• Check Digit
e.g.
One mark for each correct related purpose (max two)) e.
e g.
spec
pecciffic
• To make sure the data entered falls within a specific i set
et of
of values
valu
va l es
specified
• To make sure the data entered is no longer than specifi ed
d
whether
• To make sure the data entered follows rules related to whethe herr it iis
he s numbers of letters
• To make sure an identification code entered is ge g
genuine
nuine or possible
possiblele
Question Answer
An swer
wer Marks
4(b) 4
Count ĸ 0
REPEAT
INPUT Number
IF Number >= 100
THEN
Values[Count] ĸ Number
ENDIF
Count ĸ Count + 1
UNTIL Count = 50
Variable hourArrived
Data type integer
Use to calculate the price based on the
e number
numb
nu m er of
of hours
hour
ho u s parking
Variable priceToPay
Data type real
Use store result of price
e calculation
calc
calcul
lc ulat
ul atio
at ion
io n
Day
3$*(
Hour
Check range check
Justification need to check hour is between 8 and 23
1(e) Explanation 4
Any fourr from:
• Add number of hours selected to arrival hour
• Check if this is greater than 16
• True – calculate price up to 16 …
• … using current price in force
• … and add in evening charge
• False – calculate price as usual
explained.
Programming statements can be used but must be exp
pla
lained.
2 Real 5
Integer
Char/String
String
Boolean
6(a) One mark for field and one mark for reas
reason
asson 2
Field Juice code
Reason only unique identifier
6(b) 4
Field: Fruit 1 Fruit 2 Size Stock level
Sort:
Show: ; ;
or:
Pseudocode description P
Ps
Pseudocode
eudocode statement
FOR…TO…NEXT
IF…THEN…ELSE…ENDIF
IF …T
THE
HEN…
N ELSE…ENDIF
WHILE…DO…ENDWHILE
WHIL
WH I E…DO…ENDWHILE
CASE…OF…OTHERWISE…ENDCASE
CASE
SE
E…O
…OF…
OF OTHERWISE…ENDCASE
3$*(
REPEAT…UNTIL
R
RE PEAT…UNTIL
sam
ame
am
Note: reading and the output MUST be within the same lo
oop
o .
e loop.
For example:
Count m 0
WHILE Count < 50 DO
OUTPUT Name[Count]
Count m Count + 1
ENDWHILE
Question An swer
wer
e
Answer Marks
2 Validation check 4
x spec
A range check tests that data entered fits within specified valu
lues
ues
e .
eccifified values.
Verification check
Question Answer
An sw
weerr Marks
4 One mark for a hierarchical structure. 4
One mark for suitable names for the sub-systems.
One mark for identifiable inputs.
One mark for identifiable outputs.
For example:
Satellite
Sate
tellllititite
enna
navigation
avi
viga
gatit on
on ssystem
yysste
t m
Question Answer
Answ
wer
e Marks
5(a) One mark for each error identified and correction: 4
x Numbers should be Number
x IF Number > 100 should be IF Number >= 100 00 0
x INPUT Number is missing from inside the loop, inse ert INPUT
insert Nu
umb
T Number
m er after the ENDIF statement.
x The final OUTPUT Number is not needed, remove it. t
t.
5(b) inequality
One mark for both ends of the range and correct inequ allitity symbols.
ty symbol
o s. 2
One mark for the AND // nested IFs.
The test should be IF Number >= 100 AND Number <= < 200200
0
Note: Repeated values do not need to be written unless a value iss rrewritten.
ewritten.
ew
w
7(b) x bubble sort / sorting the names 2
x eti
ascending order / A to Z / lowest to highest / alphabe tical orde
alphabetical de
er
order
Question Answer
An swer
wer Marks
8 One mark for each. 3
10.00ERXQGDU\DEQRUPDOGDWDWKHSULFHVKRXOGEHUH
0
10.00ERXQGDU\DEQRUPDOGDWDWKHSULFHVKRXOGEHUHMHFWHGYDOXHLVRXWRIUDQJH
UHMH
UH MHFWHGYDO
MH DOXH
X LVRXWRIUDQJH
9.99ERXQGDU\H[WUHPHQRUPDOGDWDWKH
9.99ERXQGDU\H[WUHPHQRUPDOGDWDWKHSULFHVKRXOGEHDFFHSWHGYDOXHLVZLWKLQQRUPDOUDQJH
SULFHVKRRXO
X G EHDFF
F HSW
FF S HGYDOXHLVZLWKLQQRUPDOUDQJH
tenDEQRUPDOGDWDLQSXWVKRXOGEHUHMHFWHGYDO
tenDEQRUPDOGDWDLQSXWVKRXOGEHUHMHFWHGYDOXHLVZURQJW\SH
XH
H LV
V ZURQJJ W\S\SHH