0% found this document useful (0 votes)
9 views

AlgorithmDesignAndProblemSolving (1)

The document contains a series of questions from IGCSE/O-Level past papers focused on algorithm design and problem solving. It includes tasks such as identifying errors in pseudocode, completing trace tables, and explaining concepts like validation and verification. The questions require students to apply their understanding of algorithms, data types, and flowcharts in various programming scenarios.

Uploaded by

nabeel ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

AlgorithmDesignAndProblemSolving (1)

The document contains a series of questions from IGCSE/O-Level past papers focused on algorithm design and problem solving. It includes tasks such as identifying errors in pseudocode, completing trace tables, and explaining concepts like validation and verification. The questions require students to apply their understanding of algorithms, data types, and flowcharts in various programming scenarios.

Uploaded by

nabeel ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

March 2019 Paper 22, question 2

2 (a) An algorithm has been written in pseudocode to input 50 numbers and total only the
positive numbers.

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 only total numbers greater than 0
and less than 20.
...................................................................................................................................................
...................................................................................................................................................
......................................................................................................................................[2]

http://SirRazaAcademy.com Compiled by S.M.Raza 1


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

March 2019 Paper 22, question 3

This flowchart inputs the type of passenger for a survey: S for Senior, A for Adult, C for Child.
All other values are ignored, apart from Z which ends the process.

http://SirRazaAcademy.com Compiled by S.M.Raza 2


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

Complete the trace table for the passenger input data:


S, S, S, A, C, C, C, A, A, A, A, W, S, S, D, C, Z, D, S

Senior Adult Child Type OUTPUT

[5]

March 2019 Paper 22, question 5

5 A programmer restricts input values to less than 90 and greater than 60.
(a) State whether this is called validation or verification.

...................................................................................................................................................

Name the check that needs to be used.

...................................................................................................................................................[2]

(b) State three different types of test data the programmer would need to use. Give an
example of each type and the reason that the programmer chose that test data.

Type 1 .......................................................................................................................................
Example ....................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
Type 2 .......................................................................................................................................
Example ....................................................................................................................................
http://SirRazaAcademy.com
Compiled by S.M.Raza 3
Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

Reason .....................................................................................................................................
...................................................................................................................................................
Type 3 .......................................................................................................................................
Example ....................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................[9]
June 2019 Paper 21, question 4

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
Value OUTPUT

[3]

http://SirRazaAcademy.com
Compiled by S.M.Raza 4
Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

(d) Draw a flowchart to represent this section of program code. [5]

http://SirRazaAcademy.com Compiled by S.M.Raza 5


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

June 2019 Paper 22, question 2


2 (a) An algorithm has been written in pseudocode to input 100 numbers, select and print the
largest number and smallest number.

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]

http://SirRazaAcademy.com Compiled by S.M.Raza 6


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

June 2019 Paper 22, question 3

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

Total Count Distinction Mark OUTPUT

[4]

http://SirRazaAcademy.com Compiled by S.M.Raza 7


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

June 2019 Paper 22, question 5

5 Explain what is meant by validation and verification.


Give an example for each one.
Validation .....................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
Example .......................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
Verification ...................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
Example.........................................................................................................................................
.......................................................................................................................................................
...................................................................................................................................................[6]
June 2019 Paper 23, question 2

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.

Find the four errors in the pseudocode and suggest a correction for each error.
Error 1 .......................................................................................................................................
...................................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 2 .......................................................................................................................................
...................................................................................................................................................
Correction .................................................................................................................................
http://SirRazaAcademy.com Compiled by S.M.Raza 8
Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

...................................................................................................................................................
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]

June 2019 Paper 23 question 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.

Statements Validation Verification


Range check

Double entry

Check digit

Presence check

[4]

http://SirRazaAcademy.com Compiled by S.M.Raza 9


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

June 2019 Paper 23, question 3

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.

Complete Trace table 1 for the tread depth input data:


1.7, 1.9, 1.4, 1.8, 2.0
TreadReject Count Depth OUTPUT

Trace table 1

http://SirRazaAcademy.com Compiled by S.M.Raza 10


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

Complete Trace table 2 for the tread depth input data:


1.2, 1.9, 1.4, 1.8, 2.4
TreadReject Count Depth OUTPUT

Trace table 2 [4]

Nov 2019 Paper 21, question 2

2 For each of the four descriptions in the table, place a tick in the correct column to show
whether it describes a Structure diagram, a Flowchart or Library routines.

Description Structure Flowchart Library


diagram routines
A modelling tool used to show the hierarchy
of a system.
A collection of standard programs available
for immediate use.
A graphical representation used to represent
an algorithm.
A graphical representation to show how a
system is broken into sub-systems.
[4]

Nov 2019 Paper 21, question 4

4 (a) Complete the trace table for this algorithm using the given input data.

http://SirRazaAcademy.com Compiled by S.M.Raza 11


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

Index Count Value PassMarks OUTPUT


[0] [1] [2] [3] [4] [5] [6] [7]

[6]

Nov 2019 Paper 22, question 2

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.

Find the four errors in the pseudocode and suggest a correction to remove each error.

Error 1 ..............................................................................................................................................
Correction
.........................................................................................................................................

http://SirRazaAcademy.com Compiled by S.M.Raza 12


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210
..........................................................................................................................................................

http://SirRazaAcademy.com Compiled by S.M.Raza 13


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

Error 2 ..............................................................................................................................................
Correction
.........................................................................................................................................
..........................................................................................................................................................
Error 3 ..............................................................................................................................................
Correction .........................................................................................................................................
..........................................................................................................................................................
Error 4 ..............................................................................................................................................
Correction .........................................................................................................................................
..........................................................................................................................................................[4]
Nov 2019 Paper 22 question 3

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.

http://SirRazaAcademy.com Compiled by S.M.Raza 14


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

Complete the trace table for the input data:


24.88, 25.01, 24.98, 25.00, 25.05, 24.99, 24.97, 25.04, 25.19, 25.07
Reject Count Length OUTPUT

[4]

(b) (i) It has been decided to only reject batches of rope that contain ropes that are too short.
State the change required to the algorithm.
...........................................................................................................................................
..................................................................................................................................... [1]
(ii) Explain how the algorithm to reject batches could be improved to make it more effective.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]

Nov 2019 Paper 22 question 4

4 Four validation checks and four descriptions are shown.


Draw a line to connect each validation check to the correct description.

http://SirRazaAcademy.com Compiled by S.M.Raza 15


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

Nov 2019 Paper 23, question 5

5 The algorithm performs an operation on the array named MyData 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

http://SirRazaAcademy.com Compiled by S.M.Raza 16


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

(b) Describe the function being performed by the algorithm.


...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
......................................................................................................................................[2]

Nov 2019 Paper 23, question 6

6 Draw four different flowchart symbols and describe how they are used in a program
flowchart.

http://SirRazaAcademy.com Compiled by S.M.Raza 17


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

March 2020 Paper 22 question 2

2 Most programming languages include basic data types. Ahmad is describing the basic data
types he has used.
State the data type that Ahmad is describing in each sentence.
Choose the data type from this list of programming terms.

Array Boolean Char Constant Function Integer


Iteration Procedure Real String Variable

A number with a fractional part that can be positive or negative and used in calculations
Data type .......................................................................................................................................
A whole number that can be positive, negative or zero and used in calculations
Data type .......................................................................................................................................
A single number, symbol or letter
Data type .......................................................................................................................................
A sequence of characters
Data type .......................................................................................................................................
A data type with two values, True or False
Data type ...................................................................................................................................[5]

March 2020 Paper 22 question 3

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.

http://SirRazaAcademy.com Compiled by S.M.Raza 18


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

Give line numbers where the four errors are to be found in the pseudocode. Suggest a
correction for each error.

Error 1 line number ...................................................................................................................


Correction .................................................................................................................................
...................................................................................................................................................
Error 2 line number ...................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 3 line number ...................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 4 line number ...................................................................................................................
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.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................

http://SirRazaAcademy.com Compiled by S.M.Raza 19


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
......................................................................................................................................[6]

March 2020 Paper 22 question 4

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.

http://SirRazaAcademy.com Compiled by S.M.Raza 20


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

(a) Complete a trace table for this set of input data:

5000, 4474, 6055, 2000, 7900, 9800, 3000, 2150, –1, 6700, 7615

PointsWon PointsLost Difference OUTPUT

[3]

(b) The flowchart needs to be changed. When the difference is more than 5000 the output
message is ‘Fantastic leap up two levels’.
Describe the changes that will need to be made to the flowchart.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
......................................................................................................................................[3]

June 2020 Paper 21, question 2

2 Tick () one box in each row to identify if the statement is about validation,
verification or both.
Statement Validation Verification Both
() () ()
Entering the data twice to check if both
entries are the same.
Automatically checking that only numeric
data has been entered.
Checking data entered into a computer
system before it is stored or processed.
Visually checking that no errors have been
introduced during data entry.
[3]

http://SirRazaAcademy.com Compiled by S.M.Raza 21


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

June 2020 Paper 21, question 3

3 Name and describe the most appropriate programming data type for each of the examples of
data given. Each data type must be different.

Data: 37
Data type name ............................................................................................................................
Data type description ...................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
Data: Cambridge2021
Data type name ............................................................................................................................
Data type description ..................................................................................................................
.......................................................................................................................................................
.......................................................................................................................................................
Data: 47.86
Data type name ...........................................................................................................................
Data type description ..................................................................................................................
.......................................................................................................................................................
..................................................................................................................................................[6]
June 2020 Paper 21 question 4

4 The pseudocode algorithm shown has been written by a teacher to enter marks for the
students in her class and then to apply some simple processing.

Compiled by S.M.Raza 21
Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

(a) Describe what happens in this algorithm.

...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
..................................................................................................................................... [3]

June 2020 Paper 21 question 5


(b) Write the pseudocode to output the contents of the arrays Score[] and Grade[] along with
suitable messages.

...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
..................................................................................................................................... [3]

(c) Describe how you could change the algorithm to allow teachers to use it with any size of
class.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
......................................................................................................................................[3]

http://SirRazaAcademy.com Compiled by S.M.Raza 22


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

June 2020 Paper 22, question 3


3 (a) Draw the most appropriate flowchart symbol for each pseudocode statement.`

(b) State the type of each pseudocode statement. For example, X ← X + Y is totalling. IF
Number = 20 ................................................................................................................... PRINT
Number ........................................................................................................................ Number

← Number + 1 ......................................................................................................[3] June


2020 Paper 22, question 4

4 This algorithm checks passwords.


• Each password must be 8 or more characters in length; the predefined function Length
returns the number of characters.
• Each password is entered twice, and the two entries must match.
• Either Accept or Reject is output.
• An input of 999 stops the process.

http://SirRazaAcademy.com Compiled by S.M.Raza 23


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

(a) Complete the trace table for the algorithm using this input data:
Secret, Secret, VerySecret, VerySecret, Pa55word, Pa55word, 999, 888

Password PasswordRepeat OUTPUT

[3]

(b) Explain how the algorithm could be extended to allow three attempts at inputting the
matching password. Any pseudocode statements used in your answer must be fully explained.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
......................................................................................................................................[4]

June 2020 Paper 23, question 3

3 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.

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.

Error 1 line number .......................................................................................................................

http://SirRazaAcademy.com Compiled by S.M.Raza 24


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

Correction .....................................................................................................................................
.......................................................................................................................................................
Error 2 line number .......................................................................................................................
Correction .....................................................................................................................................
.......................................................................................................................................................
Error 3 line number .......................................................................................................................
Correction .....................................................................................................................................
...................................................................................................................................................[6]

June 2020 Paper 23, question 4

4 A code must take the form LL9 9LL where L is a letter and 9 is a digit.
(a) A presence check has already been used to ensure data has been entered. Name two
other types of validation check that can be used to test the code is valid.
Check 1 .....................................................................................................................................
Check 2 .....................................................................................................................................[2]

(b) Give one example of invalid test data for each of the validation checks you have named in
part (a) and in each case, give a reason why it fails the check. Each example of test data
must be different.

Check 1 Invalid Test Data .........................................................................................................


...................................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Check 2 Invalid Test Data .........................................................................................................
...................................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.................................................................................................................................................[4]

http://SirRazaAcademy.com Compiled by S.M.Raza 25


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

June 2020 Paper 23, question 5

5 This algorithm finds prime numbers.


The pre-defined function DIV gives the value of the result of integer division,
for example, y 9 DIV 4 gives y a value of 2

Complete the trace table for the algorithm using the input data:
5, 6, 8, 0, 11, 13
Flag Number Divisor Value OUTPUT

[5]

http://SirRazaAcademy.com Compiled by S.M.Raza 26


Topical Past Papers – Algorithm design and problem solving IGCSE 0478 /O-Level 2210

June 2020 Paper 23, question 6

6 Draw the flowchart symbol for Decision and the flowchart symbol for Process.

Decision Process

[2]

2023 Specimen Paper 2, question 2, question 4, question 5 and question 7

http://SirRazaAcademy.com Compiled by S.M.Raza 27

You might also like