Chapter 7
Chapter 7
3$*(
&+$37(5
3$*(
3$*(
10
............................................................................................................................................. [1]
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
.......................................
................................................................................................................
...................................................................................................................................................
...........................
............................................................................................................................
...................................................................................................................................................
..
.......
................
. .....
.........................................
.......................
....................
..........
. ..............
....
......
......
.....................
................................................................................................................................................... . ......
................
.....
.....
...................................................................................................................................................
...................................................................................................................................................
......
....................
.......................................................................................................................... [2]
.............................................................................................................................................
Value OUTPUT
[3]
11
[5]
© UCLES 2019 2210/21/M/J/19 [Turn over
3$*(
Section B
2 (a) An algorithm has been written in pseudocode to input 100 numbers, select and print the
largest number and smallest number.
Count 1
INPUT Number
High Number
Low Count
REPEAT
INPUT Number
IF Number > High
THEN
High Number
ENDIF
IF Number > Low
THEN
Low Number
ENDIF
Count Count + 1
UNTIL Count > 99
PRINT "Largest
"Largeest
s Number is ", Number
PRINT "Smallest
"Sma
mall
ma ll
lest Number is ", Low
Erro
Er rorr 1 ..
ro
Error ........
. .....
.........................................
.........
. ............
....................
.........
. ..............
....
......
......
......
.......................................
........................................................................................................................................
Cor
rrectiion
rrec
rr o ..................................................................................................................................
Correction ...................................................................................................................................
......
................
. ....
................................................................................................................................
...................................................................................................................................................
Error 2 ................................
..........................................................................................................
........................................................................................................................................
Correction ..........................
........................................................................................................
.................................................................................................................................
...................................................................................................................................................
Error 3 ........................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 4 ........................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
[4]
(b) Show how you would change the corrected algorithm to total the numbers and print the total.
Use a variable Total.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
10
3 This flowchart inputs the marks gained in an examination. An input of –1 ends the routine.
START
Total 0
Count 0
Distinction 0
INPUT Mark
Is Mark = –1 ? Yes
Total Total + Mark
Count Count + 1
No
No
o Is OUTPUT "Number of
Mark
M k >=
ark >= Dist
Di tinct
ctio
ions
Distinctions s ",
", Distinction
Dis
Di sti
inct
c ion
0?
80 OUT
OUTPUT
UT "Average
OUTPUT "Av
Aveerag
age
e Mark
Mark
rk "
Total/Count
Yes
Ye
es
Di
Distinction
n Distinction
Distinction + 1 END
[4]
© UCLES 2019 2210/22/M/J/19
3$*(
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]
Section B
2 An algorithm has been written in pseudocode to select a random number using the function
RandInt(n), which returns a whole number between 1 and the argument n. The algorithm then
allows the user to guess the number.
Number RandInt(100)
TotalTry 1
REPEAT
PRINT "Enter your guess now, it must be a whole number"
INPUT Guess
IF TotalTry > Number
THEN
PRINT "Too large try again"
ENDIF
IF Guess > Number
THEN
PRINT "Too small try again"
ENDIF
TotalTry Guess + 1
UNTIL Guess <>> Number
TotalTry TotalTry
Tot
talTry - 1
PRINT "Number
"Numbeer of
of guesses ", TotalTry
Error 1 ...............................................................................................................................................
...................
..........................
. ...........
....................
.. . ...............
.......
.........
.....
. ...............................
. ....
. ......
. ......
................
Correcti
ion
on ..
Correction .............................................................................................................................................
.........................................................................................................................................
...........................................................................................................................................................
...............
. ..........
....
......................................................................................................................................
Error 2 ......................................
..........................................................................................................
..............................................................................................................................................
Correction ...................................
........................................................................................................
.........................................................................................................................................
..........................................................................................................................................................
Error 3 ..............................................................................................................................................
Correction .........................................................................................................................................
..........................................................................................................................................................
Error 4 ..............................................................................................................................................
Correction .........................................................................................................................................
..........................................................................................................................................................
[4]
3 (a) The flowchart checks the lengths of a batch of 10 ropes. For the batch to be accepted 90% of
the lengths need to be between 24.9 and 25.1 metres.
START
Reject 0
Count 0
Yes
Is Count =
10 ?
No
No
Count Count + 1 Is Reject
<= 1 ?
INPUT Length
Yes
OUTPUT "Batch
rejected"
Yes Is Length
Lengt
g h <
gt
25.1
5.1 AND
25 AND
Lengthh > 24.9
th 24.9?
4.9
No
Reject Reject + 1
OUTPUT "Batch
accepted"
END
24.88, 25.01, 24.98, 25.00, 25.05, 24.99, 24.97, 25.04, 25.19, 25.07
[4]
(b) (i) It h
has been
as been
ee n decided to
ooonly
nly reject batches of rope that contain ropes that are too short.
Sttat
ate
Statee the
the change
cha
change required
requ
uired to the algorithm.
...........................................................................................................................................
...
.............................................................................................................................................
.....................................................................................................................................
................................................................................................. [1]
.....................................
(ii) algorith
th
hm to reject batches could be improved to make it more effective.
Explain how the algorithm
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]
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]
10
DIV means integer division, so only the whole number part of the result is returned
e.g. 7 DIV 2 returns a value of 3
First 0
Last 16
Found FALSE
INPUT UserIn
WHILE (First <= Last) AND (Found = FALSE) DO
Middle (First + Last) DIV 2
IF MyData[Middle] = UserIn
THEN
Found TRUE
ELSE
IF UserIn < MyData[Middle]
THEN
Last Middle - 1
ELSE
First Middle + 1
ENDIF
ENDIF
ENDWHILE
OUTPUT Found
This table
ble sshows
tab
ab h ws
ho ws tthe
he ccontents
ontents of
of the
eaarray:
rray:
rra a a e.g.
ay: MyData
MyDat
yDat e.g. MyD
yDat
ata[
at 2] stores
g. MyData[2]
a[2] oress tthe
stor he vvalue
a ue 5
al
MyData
Index [0]
[0] [1]
[1] [2]
[1 [2] [3]
[3] [4] [5]
5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]
[5
Value 2 3 5 6 8 10 0 12
12 13 14 16 18 20 25 27 29 34 36
[6]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
© UCLES 2019 2210/23/O/N/19
3$*(
11
6 Draw fourr different flowchart symbols and describe how they are used in a program flowchart.
[4]
Section B
2 Tick (9) one box in each row to identify if the statement about structure diagrams is true or false.
True False
Statement
(9) (9)
A structure diagram is a piece of code that is available throughout the
structure of a program.
A structure diagram shows the hierarchy of a system.
3 Programs can perform validation and verification checks when data is entered.
Check 1 .................
......
.... .............
.........................................................................................................
.....................................................................................................................................
Purp
rpos
rp osse ....
Purpose ....
....
. ........................
.............
........
. ....
..............
.........................
.............................
. ...................................
.....................................................................................................................................
.......
...................................................................................................................................................
...................................................................................................................................................
....................................................................................................................................................
...........
....
. ...........................................................................................................................................
Ch
hecck 2 .............................
Check ..........................................................................................................
.....................................................................................................................................
Purpose ..............................
........................................................................................................
.....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[4]
............................................................................................................................................. [1]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
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]
10
The predefined function DIV gives the value of the result of integer division,
for example, y ĸ 9 DIV 4 gives y a value of 2
START
INPUT
Value
IS Yes
Value =
-1 ?
No
Calc1
Calc
lc1 Value DIV 2
Calc2
Calc
lc2
lc Value DIV 3
IS
No Calc1 =
Value / 2 ?
Yes
IS
No Calc2 =
Value / 3 ?
Yes
OUTPUT
Value
END
11
[4]
...
........................
. ...............................................................................................................................
...................................................................................................................................................
....
........
.. ...
. ..........
. ..................................................................................................................................
...................................................................................................................................................
.........
...
...........
............................................................................................................................... [2]
.............................................................................................................................................
3 (a) An algorithm has been written in pseudocode to input the names and marks of 35 students.
The algorithm stores the names and marks in two arrays Name[ ] and Mark[ ]. The highest
mark awarded is found and the number of students with that mark is counted. Both of these
values are output.
01 HighestMark 100 ĸ
02 HighestMarkStudents 0 ĸ
03 FOR Count ĸ
1 TO 35
04 OUTPUT "Please enter student name"
05 INPUT Name[Count]
06 OUTPUT "Please enter student mark"
07 INPUT Mark[Counter]
08 IF Mark[Count] = HighestMark
09 THEN
10 HighestMarkStudents HighestMarkStudents – 1 ĸ
11 ENDIF
12 IF Mark[Count] > HighestMark
13 THEN
14 Mark[Count] HighestMark ĸ
15 HighestMarkStudents 1 ĸ
16 ENDIF
17 NEXT Count
18 Hig
i hestMarkStudents," with the highest mark of ",
OUTPUT "There are ", HighestMarkStudents,"
HighestMark
lin
Give linene numbers
numb
num er
mb e s where
where the
the fo
four
urr err
rro
rrors are
errors are to be
be found
f und in
fo n the
the pseudocode.
pse
seudoccod
ode. Suggest
Sug
uggest a
corr
correc
rre tition
ec
correctionon
on for
for each
eac
achh error.
Erro
ro
or 1 lilline
Error ine
n n umbe
um b r ...........
be
number ..........................................................................................................
...................................................................................................................
C orr
rrrec
e ti
tion
Correction n .....
...............................................................................................................................
.................................................................................................................................
...........................................
..........................................................................................................
...................................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
[4]
(b) Explain how you could extend the algorithm to also find the lowest mark awarded, count the
number of students with that mark, and output both these values.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
.................................
.....................................................................................................................
...................................................................................................................................................
.............
........
....
....
....
. ...............................................
.. . ........................................................................
. ............
................................................................................................................................................... ................
........
.........
...........
.. . ..............................................................................................................................
...................................................................................................................................................
....................................................................................................................................................
......
.. .....................
. ..................................................................................................................................
.....
...
....
. ..
.. ....
..........................................................................................................................................
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [6]
© UCLES 2020 2210/22/M/J/20 [Turn over
3$*(
10
4 This flowchart inputs the points won and the points lost when playing a game. The difference
between the points won and lost is calculated and depending on the result the player can: move
up to the next level, stay at the same level, or move down to the previous level. The flowchart
finishes when the input for points won is –1.
START
INPUT
PointsWon, PointsLost
IS
Yes END
PointsWon = –1 ?
No
Difference
PointsWon - PointsLost
OUTPUT
OUTP
OUTPUT
TP T IS
Yes
Ye
es
"Wel
"Well
el
"Welll done
done Difference > =
moove
ve up"
move up" 1000 ?
No
OUTPUT Yes IS
"Sorry move Difference < 0 ?
down"
No
OUTPUT
"Keep on trying"
11
[3]
(b) The flowchart needs to be changed. When the difference is more than 5000 the output
message is ‘Fantastic leap up two levels’.
....................................
..................................................................................................................
....
...................................................................................................................................................
.........................
........
.........................
....
. ..
.........................
... ............
....
....
. .................
........
......
................
. .........
................................................................................................................................................... ................
..
..........................................................................................................................................................
...................................................................................................................................................
.....
...
............................
..........................................................................................................................
...................................................................................................................................................
.....
.....
....
.......
..........................................................................................................................................
...................................................................................................................................................
...........................................
..........................................................................................................
...................................................................................................................................................
.............................................
........................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
2 Describe the purpose of validation and verification checks during data entry.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
[4]
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]
5 An algorithm has been written in pseudocode to input some numbers. It only outputs any numbers
that are greater than or equal to 100. The number 999 is not output and stops the algorithm.
INPUT Number
WHILE Numbers <> 999 DO
IF Number > 100
THEN
OUTPUT Number
ENDIF
ENDWHILE
OUTPUT Number
(a) Identify the fourr errors in the pseudocode and suggest corrections.
Error 1 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 2 ...............................
.........................................................................................................
.......................................................................................................................................
Correction ....................
.........
.........................................................................................................
.................................................................................................................................
...........................
.............................................................................................................................
...................................................................................................................................................
Erro
Er ror 3 ........................................................................................................................................
ro
Error ...........
........................................
.. ........................
....................
.. .........
.. ..............
......
. ..
.. .....
...... .............................
.. ................
Cor
rrec
rr ectiion
Correctiono ..
..................................................................................................................................
........
..............................................................................................................................
......
..............
.. .......................................................................................................................................
...................................................................................................................................................
Error 4 ...............................
..........................................................................................................
.......................................................................................................................................
Correction ..........................
........................................................................................................
.................................................................................................................................
...................................................................................................................................................
[4]
(b) Write a pseudocode statement to change the corrected algorithm to output all numbers
between 100 and 200 inclusive.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
START
Flag m 0
Count m 1
IS Name[Count] Yes
> Name[Count + 1]? Temp m Name[Count]
No Name[Count] m Name[Count + 1]
Name[Count + 1] m Temp
Flag
Fl
F lag
g m 1
Count
Co
Couun
nt m Count
t + 1
No IS Count
=4?
Yes
No IS Flag
=0?
Yes
STOP
(a) The array Name[1:4] used in the flowchart contains the following data:
Complete the trace table using the data given in the array.
[5]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [2]
&+$37(5
0$5.,1*
6&+(0(
3$*(
3$*(
Example answer:
IF X < 0
THEN
PRINT "Negative"
ELSE
PRINT "Not negative"
ENDIF
OR
Example answer:
CASE X OF
1: PRINT ("ONE")
("O
"ONE
NE
E")
2: PRINTNT ("TWO")
("TWO
WO")
WO
OTHERWISE
OTHEERW I E PRINT
RWIS PRINNT ("Less
IN ("
"Le s than
Less an ONE
tha ONE or more
or than
more th n TWO")
TWO
WO")
)
ENDCASE
ENDC
EN DC
D CAS
A E
3(b) To a
To llow diffe
allow ere
ent routes through a program
different 2
depe
de pe
endent on
dependent n meeting certain criteria
4(c) 3
Value OUTPUT
50 Accepted: 50
4(d) 5
START
PRINT "Input a
value between
0 and 100
inclusive"
INPUT Value
PRINT "Invalid
value, try
again"
IS Value < 0
Yes
OR
IS Value > 100 ?
No
PRINT
PRI
RINT
RIN
NT
"Ac
Ac
ccep
ceppted
ted: ",
"Accepted:
Value
V
Va
Vallue
END
E ND
Section B
Count ĸ 1
INPUT Number
High ĸ Number r
Low ĸ Number r
Total ĸ Number
Num
umbe
um b r
be
REPEAT
IN
NPU
PUT Number
INPUT Numb ber
Total
To
ota l ĸ Total
tal otal + Number
Tot
ot Num
mbe
ber
IF
IF Number
Number > High
Hi
igh
THEN
T EN
TH
High ĸ Number
High Number
EN
NDI
DIF
ENDIF
IF Number < Low
THEN
Low ĸ Number
Number
ENDIF
Count ĸ Count
Cou unt + 1
UNTIL Count > 99
PRINT "Largest Number is ", High
PRINT "Smallest Number is ", Low
PRINT "Total is ", Total
3 4
Total Count Distinction Mark OUTPUT
0 0 0 50
50 1 0 70
120 2 0 65
185 3 0 30
215 4 0 95
310 5 1 50
360 6 1 55
415 7 1 85
500 8 2 65
565 9 2 35
600 10
1 0 –1 Number of
Dist
Di stiincctio
Distinctionsonss 2
Average Mark 60
1 mamark
ark ffor
o T
or Total
otal and CCount
ount columns both correct.
1 mamarkrk for
for each
each correct
correcct column apart from Total and Count.
If n o ma
no markr s awarded allow
rk
marks allow 1 mark for initialisation of Total, Count and
D
Di ist
sti
tinction, set to zero.
Distinction, zeroo.
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 B
0 0
0 1 24.88
1 2 25.01
1 3 2
24
24.98
.98
8
1 4 2
25.0
25.00
5.0
00
1 5 25.05
1 6 24.99
1 7 24.97
1 8 25.04
1 9 25.19
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
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
6 One mark for each correct symbol and name / description / example of use 4
(maximum four marks)
Input / Output
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
5(a) 4
Value C lc1
Ca
Calc1 Calc2 OUTPUT
50 25
25 16
33 16
16 11
18 9 6 18
15 7 5
30 15 10 30
-1
3$*(
2 Real 5
Integer
Char/String
String
Boolean
4(a) PointsLo
Lost)
Lo
One mark for correct input (PointsWon and PointsLost) 3
One mark for correct calculations (Difference)
One mark for correct output
PointsWon PointsLost
s
st Difference
Dif
i fe
f re
rence OUTPUT
5000 4474 5
52
5266 Keep on trying
7900 9800
9800 -1900
-190
-1
190
900
0 Sorry
Sorr
So rryy move
rr m ve down
mo
-1 6700
3$*(
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