Oliii Computer Past Papers Qs
Oliii Computer Past Papers Qs
Handouts
Computer O’ Levels III
1 ____________________________________________________________________________
____________________________________________________________________________
2 ____________________________________________________________________________
____________________________________________________________________________
3 ____________________________________________________________________________
____________________________________________________________________________
4 ____________________________________________________________________________
____________________________________________________________________________
6 Identify three different loop structures that you can use when writing pseudocode. [3]
1 ____________________________________________________________________________
____________________________________________________________________________
2 ____________________________________________________________________________
____________________________________________________________________________
3 ____________________________________________________________________________
____________________________________________________________________________
3 The flowchart below inputs the weight of a number of parcels in kilograms. Parcels weighing more than 25 kilograms
are rejected. A value of –1 stops the input.
The following information is output: the total weight of the parcels accepted and number of parcels rejected.
Complete the trace table for the input data: [5]
1.8 26.0 7.0 11.3 10.0 2.5 25.2 5.0 19.8 29.3 –1
Total Reject Weight Output
2 Read this section of program code that should input 30 positive numbers and then output the largest number input.
[4]
1 Large = 9999
2 Counter = 0
3 WHILE Counter > 30
4 DO
5 INPUT Num
6 IF Num < Large THEN Large = Num
7 Counter = Counter - 1
8 ENDWHILE
9 PRINT Large
There are four errors in this code.
Locate these errors and suggest a corrected piece of code for each error.
1 ______________________________________________________________________
____________________________________________________________________________
2 ______________________________________________________________________
____________________________________________________________________________
3 ______________________________________________________________________
____________________________________________________________________________
4 ______________________________________________________________________
____________________________________________________________________________
3 (a) The flowchart below inputs six single digit numbers. The predefined function MOD gives the value of the remainder,
for example, Y ←10 MOD 3 gives the value Y = 1
Complete a trace table for each of the two sets of input data.
Set 1: 5 2 4 3 1 5
Set 2: 3 2 1 0 7 3
Problem ________________________________________________________________
____________________________________________________________________________
Solution ________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
5 (a) Write an algorithm, using pseudocode and a FOR … TO … NEXT loop structure, to input 1000 numbers into an array.
[2]
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
(b) Rewrite your algorithm using another loop structure. [4]
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
Winter 2015
2 Read this section of program code that should input 50 numbers and then output the average of the positive numbers
only.
1 Total = 0
2 PosCount = 0
3 FOR Counter = 1 TO 50
4 INPUT Num
5 IF Num < 0 THEN Total = Total + Num
6 IF Num > 0 THEN Counter = Counter + 1
7 Average = Total/PosCount
8 NEXT Counter
9 PRINT Num
There are four errors in this code.
Locate these errors and suggest code corrections to remove each error. [4]
1 __________________________________________________________________________
____________________________________________________________________________
2 __________________________________________________________________________
____________________________________________________________________________
3 __________________________________________________________________________
____________________________________________________________________________
4 __________________________________________________________________________
____________________________________________________________________________
4 A routine checks the age and height of children who are allowed to enter a play area. The children must be less than
5 years of age and under 1 metre in height.
(a) The first set of test data used is age 3 and height 0.82 metres.
State what type of test data this is. [1]
____________________________________________________________________________
Give a reason for using this test data. [2]
____________________________________________________________________________
____________________________________________________________________________
(b) Provide two additional sets of test data. For each, give
• The type of each set of test data
• The reason why it is used
Each type of test data and reason for use must be different. [6]
Set 1: ______________________________________________________________________
Type ______________________________________________________________________
Reason ______________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
Set 1: ______________________________________________________________________
Type ______________________________________________________________________
Reason ______________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
3 (a) This pseudocode inputs an integer. The predefined function DIV gives the value of the division, e.g. Y 10 DIV 3 gives
the value Y = 3. The predefined function MOD gives the value of the remainder, e.g. Y 10 MOD 3 gives the value Y =
1.
INPUT X
WHILE X > 15
DO
T1 = X DIV 16
T2 = X MOD 16
CASE T2 OF
10: OUTPUT A
11: OUTPUT B
12: OUTPUT C
13: OUTPUT D
14: OUTPUT E
15: OUTPUT F
OTHERWISE OUTPUT T2
ENDCASE
X= T1
ENDWHILE
CASE X OF
10: OUTPUT A
11: OUTPUT B
12: OUTPUT C
13: OUTPUT D
14: OUTPUT E
15: OUTPUT F
OTHERWISE OUTPUT X
ENDCASE
Complete a trace table for each of the two input values 37 and 191.
Trace table for input value 37 [2]
Trace table for input value 191 [2]
Summer 2016
2 Read this section of program code that inputs 10 positive numbers and then outputs the smallest number input.
1 Small = 1000
2 Counter = 0
3 REPEAT
4 INPUT Num
5 IF Num < Small THEN Small = Num
6 Counter = Counter + 1
7 UNTIL Counter = 10
8 PRINT Small
(i) Identify three changes you would need to make to find the largest number input instead of the smallest number.
[3]
1 __________________________________________________________________________
____________________________________________________________________________
2 __________________________________________________________________________
____________________________________________________________________________
3___________________________________________________________________________
____________________________________________________________________________
(ii) Rewrite the program code with your changes. [3]
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
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.
4 IF ... THEN ... ELSE ... ENDIF and CASE ... OF ... OTHERWISE ... ENDCASE are two different conditional
statements that you can use when writing pseudocode.
Explain, using examples, why you would choose to use each conditional statement. [6]
Example 1: __________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
Correction: _______________________________________________________________
____________________________________________________________________________
Error 2: _____________________________________________________________________
Correction: _______________________________________________________________
____________________________________________________________________________
Error 3: ______________________________________________________________________
Correction: ________________________________________________________________
____________________________________________________________________________
Error 4: ______________________________________________________________________
Correction: _______________________________________________________________
____________________________________________________________________________
(b) Decide, with reasons, whether the numbers 10 and 20 are within or outside the range.
[4]
4 Four validation checks and four descriptions are shown below.
Draw a line to link each validation check to the correct description.
3 The flowchart below inputs the price of an item under $10. The change from a $10 note is output.
Any amount less than 5 cents is rounded up to 5 cents. The predefined function INT rounds a number down to the
nearest whole number; for example
Z ← INT(5.7) gives the value Z = 5
Complete the trace table for the input data: 6.29 [5]
5 REPEAT ... UNTIL and WHILE ... DO ... ENDWHILE are two different loop structures you can use when writing
pseudocode.
Explain, using examples, why you would choose to use each type of loop. [6]
Example 1: __________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
Reason for choice: ____________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
Example: __________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
Reason for choice: ____________________________________________________
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
Summer 2017
2 This section of program code asks for 50 numbers to be entered. The total and average of the numbers are
calculated.
1 Total = 0
2 Counter = 50
3 PRINT ′When prompted, enter 50 numbers, one at a time′
4 REPEAT
5 PRINT ′Enter a number′
6 INPUT Number
7 Total + Number = Total
8 Number = Number + 1
9 UNTIL Counter = 50
10 Average = Number * Counter
11 PRINT ′The average of the numbers you entered is ′, Average
There are four errors in this code.
State the line number for each error and write the correct code for that line.
Output Destination
New Saved
[2]
4 For each of the four statements in the table, place a tick in the correct column to show whether it is an example of
validation or verification. [4]
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
……............................................................................................................................................ [2]
(b) Identify, using pseudocode, another loop structure that the algorithm in part (a) could have used.
…….................................................................................................................................................
……............................................................................................................................................ [1]
(c) Write an algorithm, using pseudocode, to input a number between 0 and 100 inclusive. The algorithm should prompt
for the input and output an error message if the number is outside this range.
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
……............................................................................................................................................ [3]
6 This flowchart inputs a range of temperatures in degrees Fahrenheit. As each temperature is input, it is compared with
the previous highest temperature. If it is higher than the current highest, it replaces the previous highest temperature
and then it is converted to degrees Celsius.
For ease of calculation, the final step of the Fahrenheit to Celsius conversion has been approximated as division by 2.
When –1 is entered, the input process stops and the highest temperature (in both Fahrenheit and Celsius) is output.
Complete the trace table for the input data:
68, 46, 50, 86, 65, 50, 40, 30, –1 [5]
2 (a) Write an algorithm to input three different numbers, and then output the largest number.
Use either pseudocode or a flowchart.
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
…….................................................................................................................................................
……............................................................................................................................................ [4]
(b) Give two sets of test data to use with your algorithm in part (a) and explain why you chose each set.
[3]
4 IF … THEN … ELSE … ENDIF is one type of conditional statement used when writing pseudocode. Identify and
describe another type of conditional statement that you could use when writing pseudocode. Give a reason why you
would use this type of conditional statement.
Conditional statement......................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Description.......................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Reason............................................................................................................................................
................................................................................................................................................... [4]
5 (a) This flowchart checks a batch of 10 rice sacks for weight. Sacks should weigh 50 kilograms each. Sacks weighing
over 50.5 kilograms or less than 49.5 kilograms are rejected. The number of sacks accepted and the number of sacks
rejected is output.
(b) The size of the batch has increased to 50 sacks. It has been decided to only reject sacks that are underweight.
State the changes that need to be made to the flowchart.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
.............................................................................................................................................. [2]
2 This section of program code asks for 80 numbers between 100 and 1000 to be entered. It checks that the numbers
are in the correct range, and stores them in an array. It counts how many of the numbers are larger than 500 and then
outputs the result when the program is finished.
1 Count = 0
2 FOR Index = 1 TO 80
3 INPUT 'Enter a number between 100 and 1000', Number
4 WHILE Number = 99 AND Number = 1001
5 INPUT 'This is incorrect, please try again', Number
6 ENDWHILE
7 Num[80] = Number
8 IF Number > 500 THEN Count = Count + 1
9 UNTIL Index = 80
10 PRINT Index
11 PRINT ' numbers were larger than 500'
There are four lines of code that contain errors.
State the line number for each error and write the correct code for that line.
Error 1 Line Number.............................
Correct Code.......................................................................................................................
Error 2 Line Number.............................
Correct Code....................................................................................................................... Error 3 Line
Number.............................
Correct Code....................................................................................................................... Error 4 Line
Number.............................
Correct Code.................................................................................................................. [4]
3 (a) Explain the difference between a validation check and a verification check.
.........................................................................................................................................................
.........................................................................................................................................................
.................................................................................................................................................... [2]
(b) Describe, using an example, how data could be verified on data entry.
.........................................................................................................................................................
.........................................................................................................................................................
.................................................................................................................................................... [2]
(c) Explain what is meant by the term library routine?
.........................................................................................................................................................
.........................................................................................................................................................
.................................................................................................................................................... [2]
4(a) Four pseudocode descriptions and five pseudocode statements are shown. Draw one line to link each pseudocode
description to the correct pseudocode statement. Not all pseudocode statements will be used
[4]
(b) Write an algorithm in pseudocode, using a single loop, to print 50 names that have been stored in an array.
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.................................................................................................................................................... [3]
5 The flowchart below represents a program routine.
(a) The array used in the flowchart contains the following data:
Complete the trace table using the data given in the array. [5]
[5]
(b) Explain how you would change the algorithm to input eight digits (seven digits and the check digit) and output if the
check digit entered is correct or not.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
............................................................................................................................................. [3]
4 A programmer has written a routine to check that prices are below $10.00. These values are used as test data.
10.00 9.99 ten
Explain why each value was chosen.
10.00 ...............................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
9.99 .................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
ten ...................................................................................................................................................
.........................................................................................................................................................
.................................................................................................................................................... [3]
5 Explain the difference between the programming concepts of counting and totalling.
Include an example of a programming statement for each concept in your explanation.
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.................................................................................................................................................... [4]
2 (a) Draw a flowchart for an algorithm to input numbers. Reject any numbers that are negative and count how many
numbers are positive. When the number zero is input, the process ends and the count of positive numbers is output.
[6]
(b) Explain the changes you will make to your algorithm to also count the negative numbers.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..............................................................................................................................................[2]
3 This pseudocode algorithm inputs two non-zero numbers and a sign, and then performs the calculation shown by the
sign. An input of zero for the first number terminates the process.
INPUT Number1, Number2, Sign
WHILE Number1 <> 0
IF Sign = '+' THEN Answer Number1 + Number2 ENDIF
IF Sign = '-' THEN Answer Number1 - Number2 ENDIF
IF Sign = '*' THEN Answer Number1 * Number2 ENDIF
IF Sign = '/' THEN Answer Number1 / Number2 ENDIF
IF Sign <> '/' AND Sign <> '*' AND Sign <> '-' AND Sign <> '+'
THEN Answer 0
ENDIF
IF Answer <> 0 THEN OUTPUT Answer ENDIF
INPUT Number1, Number2, Sign
ENDWHILE
(a) Complete the trace table for the input data:
5, 7, +, 6, 2, –, 4, 3, *, 7, 8, ?, 0, 0, /
[3]
(b) Show how you could improve the algorithm written in pseudocode by writing an alternative type of conditional
statement in pseudocode.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..............................................................................................................................................[3]
4 A programmer has written a routine to store the name, email address and password of a contributor to a website’s
discussion group.
(a) The programmer has chosen to verify the name, email address and password.
Explain why verification was chosen and describe how the programmer would verify this data.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..............................................................................................................................................[4]
(b) The programmer has also decided to validate the email address and the password.
Describe validation checks that could be used.
Email address ............................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
Password .................................................................................................................................
..................................................................................................................................................
................................................................................................................................................. [2]
5 A program checks that the weight of a basket of fruit is over 1.00 kilograms and under
1.10 kilograms. Weights are recorded to an accuracy of two decimal places and any weight not in this form has
already been rejected.
Give three weights as test data and for each weight state a reason for choosing it. All your reasons must be different.
Weight 1:.......................................................................................................................................
Reason: ..........................................................................................................................................
.........................................................................................................................................................
Weight 2: .......................................................................................................................................
Reason:...........................................................................................................................................................................................
.........................................................................................................Weight
3: .......................................................................................................................................
Reason: ....................................................................................................................
.................................................................................................................................................... [3]
Winter 2018
2 Six terms associated with programming and six descriptions are listed.
Draw a line to link each term with its most appropriate description.
[5]
3 Describe, giving a different example for each, the purpose of these validation checks used in
programming.
Range check ...................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Example ...........................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Length check ...................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Example ...........................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Type check ......................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Example ...........................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
[6]
4 An algorithm is written in pseudocode:
Total 0
FOR Count 1 TO 50
INPUT Num
Total Total + Num
NEXT Count
OUTPUT Total
(a) Describe the purpose of the algorithm.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..............................................................................................................................................[3]
(b) Re-write the algorithm in pseudocode using a different type of loop.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..............................................................................................................................................[3]
(c) Describe how you could modify the original algorithm shown at the start of question 4, to allow any number of inputs.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..............................................................................................................................................[2]
5 The flowchart performs a mathematical process on a number input called TestNum
DIV is used to represent integer division e.g. 7 DIV 3 = 2
[2]
(b) Complete the trace table for the input data: 6
[2]
(c) State the purpose of the algorithm in the flowchart.
..................................................................................................................................................
..............................................................................................................................................[1]
2 (a) Write an algorithm, using pseudocode, to input three different numbers, multiply the two larger numbers together and
output the result. Use the variables: Number1, Number2 and Number3 for your numbers and Answer for your result.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
............................................................................................................................................. [5]
(b) Give two sets of test data to use with your algorithm in part (a) and explain why you chose each set.
Test data set 1 ..........................................................................................................................
Reason ....................................................................................................................................
..................................................................................................................................................
Test data set 2 ..........................................................................................................................
Reason ....................................................................................................................................
..................................................................................................................................................
[4]
3 Four programming concepts and four descriptions are shown. Draw a line to connect each programming concept to the
most appropriate description.
[3]
4 A programmer wants to test that the readings from 2000 electricity meters are greater than 400 units and less than 900
units. The programmer uses selection and repetition statements as part of the program. Explain, using programming
statements, how selection and repetition could be used in this
program.
Selection .........................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Repetition ........................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
[4]
5 The flowchart checks the level of chlorine and the depth of water compared to the height of the
swimming pool. Error messages are output if a problem is found.
(a) Complete the trace tables for each set of input data.
Input data: 6, 2.5, 2
[4]
(b) Complete the trace table for the input data: 2
[2]
Summer 2019
3 (a) Give an example of a conditional statement using pseudocode.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
............................................................................................................................................ [2]
(b) Describe the purpose of a conditional statement.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
............................................................................................................................................ [2]
4 This section of program code may be used as a validation check.
1 PRINT "Input a value between 0 and 100 inclusive"
2 INPUT Value
3 WHILE Value < 0 OR Value > 100
4 PRINT "Invalid value, try again"
5 INPUT Value
6 ENDWHILE
7 PRINT "Accepted: ", Value
(a) Give a name for this type of validation check.
............................................................................................................................................ [1]
(b) Describe what is happening in this validation check.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
............................................................................................................................................ [2]
(c) Complete the trace table for this program code using the test data: 200, 300, –1, 50, 60 [3]
Value OUTPUT
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 Number is ", Number
PRINT "Smallest Number is ", Low
Find the four errors in the pseudocode and suggest a correction for each error.
Error 1 .......................................................................................................................................
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]
3 This flowchart inputs the marks gained in an examination. An input of –1 ends the routine.
Complete the trace table for the mark input data: 50, 70, 65, 30, 95, 50, 55, 85, 65, 35, –1, 45
[4]
4 For each of the four groups of statements in the table, place a tick in the correct column to show
whether it is an example of Selection or Repetition.
[4]
5 Explain what is meant by validation and verification.
Give an example for each one.
Validation .........................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Example ..........................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Verification .......................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Example ..........................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
[6]
2 (a) An algorithm has been written in pseudocode to input the weight of 500 items and reject any
that are over-weight or under-weight, then print the percentage rejected.
Count 1
Reject 0
Over 62
Under 58
REPEAT
INPUT ItemWeight
IF ItemWeight > Over AND ItemWeight < Under
THEN
Reject Reject - 1
ENDIF
Count Count + 1
UNTIL Count > = 500
Reject Reject / 100
PRINT "Percentage rejected is ", Reject
Find the four errors in the pseudocode and suggest a correction for each error.
Error 1 ......................................................................................................................................
..................................................................................................................................................
Correction ................................................................................................................................
..................................................................................................................................................
Error 2 ......................................................................................................................................
..................................................................................................................................................
Correction ................................................................................................................................
..................................................................................................................................................
Error 3 ......................................................................................................................................
..................................................................................................................................................
Correction ................................................................................................................................
..................................................................................................................................................
Error 4 ......................................................................................................................................
..................................................................................................................................................
Correction ................................................................................................................................
..................................................................................................................................................
[4]
(b) Describe how you would change the corrected algorithm to calculate the number accepted instead of rejected, using a
variable Accept, and print a warning if fewer than 50% are accepted.
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
............................................................................................................................................ [4]
3 This flowchart inputs the tread depth of five tyres, four on the car and a spare tyre. Any tread depth of 1.6 mm or less is
rejected. To be potentially roadworthy, a car must have four tyres with a tread depth greater than 1.6 mm.
[4]
4 For each of the four checks in the table, place a tick in the correct column to show whether it is an
example of a validation or verification check. [4]
Statements Validation Verification
Range check
Double entry
Check digit
Presence check
5 Identify and describe three loop structures that are available in pseudocode.
Loop structure 1 ...............................................................................................................................
.........................................................................................................................................................
Description ......................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Loop structure 2 ...............................................................................................................................
.........................................................................................................................................................
Description ......................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
Loop structure 3 ...............................................................................................................................
.........................................................................................................................................................
Description ......................................................................................................................................
.........................................................................................................................................................
.........................................................................................................................................................
[6]