(1) Four validation checks, and four descriptions are shown.
Draw a line to connect each validation
check to the correct description.
(2) An algorithm has been written in pseudocode to input 100 numbers and print out the sum.
A REPEAT … UNTIL loop has been used.
(a) Find the error in the pseudocode and suggest a correction.
(b) Rewrite the correct algorithm using a for loop.
Count ← 0
Sum ← 0
REPEAT
INPUT Number
Sum ← Sum + Number
Count ← Count + 1
UNTIL Count > 100
PRINT Sum
(3) Read this section of program code that inputs 10 positive numbers and then outputs the smallest
number input.
Identify three changes you would need to make to find the largest number input instead
of the smallest number.
Small ← 1000
Counter ← 0
REPEAT
INPUT Num
IF Num < Small
THEN Small ← Num
Counter ← Counter + 1
UNTIL Counter ← 10
PRINT Small
(4) The flowchart below inputs the height of children who want to ride on a rollercoaster. Children
under 1.2 metres are rejected. The ride starts when eight children have been accepted.
Complete the trace table for the input data:
1.4, 1.3, 1.1, 1.3, 1.0, 1.5, 1.2, 1.3, 1.4, 1.3, 0.9, 1.5, 1.6, 1.0
Riders Reject Height OUTPUT
(5) 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.
HighestMark ← 100
HighestMarkStudents ← 0
FOR Count ← 1 TO 35
OUTPUT "Please enter student name"
INPUT Name[Count]
OUTPUT "Please enter student mark"
INPUT Mark[Counter]
IF Mark[Count] = HighestMark
THEN HighestMarkStudents ← HighestMarkStudents – 1
ENDIF
IF Mark[Count] > HighestMark
THEN Mark[Count] ← HighestMark
HighestMarkStudents ← 1
ENDIF
NEXT Count
OUTPUT "There are ", HighestMarkStudents," with the highest mark of ", HighestMark
Give line numbers where the four errors are to be found in the pseudocode. Suggest a
correction for each error.
(6) This section of pseudocode is to be used as a validation check that will continue until a
number between 0 and 499 inclusive is entered.
PRINT "Input a number from 0 to 499 inclusive"
FOR Number 1 TO 10
INPUT Number
IF Number < 0 AND Number > 499
THEN PRINT "Invalid number, please try again"
ENDIF
UNTIL Number ← 0 OR Number ← 499
PRINT Number, " is within the correct range"
There are three lines in this pseudocode that contain errors. In each case, state the line number
to identify the incorrect line and write out the corrected line in full.