Algorithm design and problem-solving – O Level Computer Science (2210)

76 questions · page 1 of 6 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
1
2210/21/M/J/26 · Question 1May/June 2026Paper 211 marks
Loading question…
Question text

1
Tick (3) one box to identify the type of validation check to test whether a number entered into a
computer system is between two set values.
A
length check
B
presence check
C
type check
D
range check
[1]

2
2210/21/M/J/26 · Question 4May/June 2026Paper 2154 marks
Loading question…
Question text

4
The following pseudocode algorithm uses a bubble sort to sort the array Names[50]
Complete the algorithm.
…
Last
REPEAT
…
Swap
1 TO Last ‑ 1
FOR …
IF Names[Index] > Names[Index + 1]
THEN
Names[Index]
Temp
Names[Index + 1]
Names[Index]
Temp
Names[Index + 1]
TRUE
Swap
ENDIF
NEXT Index
Last ‑ 1
Last
UNTIL … Swap OR Last = 1
[4]
© Cambridge University Press & Assessment 2026

3
2210/21/M/J/26 · Question 5May/June 2026Paper 2112 marks
Loading question…
Question text

5
A computer system automatically creates usernames for new users. A new user enters their first
name and their last name.
The system:
•
takes the first letter of the first name
•
takes the first two letters of the last name
•
converts all the letters to upper case
•
generates a random whole number between 1 and 1000 inclusive.
For the following example:
The first name is Muhammed
The last name is Hann
The generated number is 492
The username will be MHA492
(a) Write the pseudocode to generate a whole random number between 1 and 1000 inclusive
and store it in the variable GeneratedNumber
…
…
… [2]
(b) The last name is input into the variable LastName
Write the pseudocode to:
•
take the first two letters from LastName
•
convert the letters to upper case
•
store the result in the variable Temp
…
…
… [3]
(c) The new username is stored in the variable NewUsername
Write the pseudocode to store NewUsername to the file Username.txt
…
…
…
… [3]
© Cambridge University Press & Assessment 2026
,
,
(d) Identify and describe verification checks that could be applied to the inputs of the first name
and the last name of the user.
…
…
…
…
…
… [4]

Advertisement
4
2210/21/M/J/26 · Question 10May/June 2026Paper 219 marks
Loading question…
Question text

10 (a) Draw a flowchart to input six whole numbers and output the highest. You do not need to
validate the inputs.
START
[6]
© Cambridge University Press & Assessment 2026
,
,
(b) Describe how the flowchart could be changed to only accept positive whole numbers.
…
…
…
…
…
… [3]

5
2210/22/M/J/26 · Question 3May/June 2026Paper 2211 marks
Loading question…
Question text

3
(a) Identify the type of validation check used in each description.
(i)
A check to make sure that data has been input and not left blank.
… [1]
(ii)
A value placed at the end of a sequence of numbers in the code. The value is calculated
from all the other values before it.
… [1]
(b) Explain the purpose of a format check and give an example of where it could be used.
purpose …
…
…
…
…
example …
…
[3]
© Cambridge University Press & Assessment 2026
,
,
(c) Write the pseudocode for an algorithm to perform a validation check on each number as it is
input, using the following criteria:
•
Input one number at a time.
•
If the number is a whole number, store it in the current element of array Accepted[]
•
If the number is not a whole number, ask for it to be input again until it is a
whole number.
•
When 15 whole numbers have been stored, output a message that states the check has
been completed.
Use appropriate input prompts and output messages to make the requirements clear to
the user.
You do not need to declare any arrays or variables for this algorithm.
…
…
…
…
…
…
…
…
…
…
…
…

6
2210/22/M/J/26 · Question 4May/June 2026Paper 226 marks
Loading question…
Question text

4
The program development life cycle is split into several stages.
Outline what happens during the coding and testing stages of the program development
life cycle.
coding …
…
…
…
…
…
testing …
…
…
…
…
…
[6]
© Cambridge University Press & Assessment 2026
,
,
© Cambridge University Press & Assessment 2026

7
2210/22/M/J/26 · Question 6May/June 2026Paper 227 marks
Loading question…
Question text

6
This flowchart represents an algorithm.
START
INPUT Word
WordLength
LENGTH (Word)
0
Count
1
NumLetter
IS SUBSTRING(Word, NumLetter, 1)
Yes
= SUBSTRING(Word, NumLetter + 1
, 1) ?
Count
Count + 1
No
NumLetter
NumLetter + 1
IS
OUTPUT Count
Yes
No
NumLetter =
WordLength
?
INPUT Choice
Yes
Is Choice =
'Y' ?
No
STOP
© Cambridge University Press & Assessment 2026
,
,
(a) Complete the trace table for the algorithm, using the input data:
post, Y, committee, N, bookkeeper
Note: the first character of each word is in position 1.
Word
WordLength
Count
NumLetter
Choice
OUTPUT
[6]
(b) State the purpose of the algorithm shown by the flowchart.
…
… [1]
© Cambridge University Press & Assessment 2026

8
2210/22/M/J/26 · Question 7May/June 2026Paper 225 marks
Loading question…
Question text

7
(a) State one reason to store data in a file.
…
… [1]
(b) A list of names of the members of a club are stored in a file called Names.txt
Write the pseudocode statements to load a line of text from Names.txt and assign the line
of text to an appropriately named variable.
…
…
…
…
…
…
…
… [4]
© Cambridge University Press & Assessment 2026

Advertisement
9
2210/21/M/J/25 · Question 1May/June 2025Paper 211 marks
Loading question…
Question text

1
Tick ( ü ) one box to identify the type of test to only check for the largest or smallest acceptable
value.
A
normal test data
B
abnormal test data
C
extreme test data
D
boundary test data
[1]

10
2210/21/M/J/25 · Question 2May/June 2025Paper 217 marks
Loading question…
Question text

2
Four requirements for validating inputs and five types of validation check are given.
(a) Draw one line from each requirement to the most appropriate validation check.
Not all validation checks will be used.
Requirement
Validation check
length check
Date of birth must be between
01/01/1900 and 01/01/2010.
format check
Name has been entered.
range check
Password has exactly 12 characters.
check digit
Student ID must contain 2 letters followed
by a 4-digit number.
presence check
[4]
(b) Identify and describe one verification check that could be applied when a new password is
input into a system.
Verification check …
Description …
…
…
…
[3]
ĬÍĊ®Ġ´íÈõÏĪÅĊÞû·þ×

11
2210/21/M/J/25 · Question 4May/June 2025Paper 218 marks
Loading question…
Question text

4
A telephone number with 13 characters is input. The first character is a ‘+’, followed by a 2-digit
country code, for example:
+20xxxxxxxxxx where 20 is the country code and x is a digit between 0 and 9 inclusive.
The algorithm includes checks for the country codes: 44 for the UK and 20 for Egypt.
(a) Write an algorithm using pseudocode to:
•
input the telephone number
•
extract the 2-digit country code
•
output the matching country
•
output ‘Unknown’ if there is no matching country.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [5]
ĬÍĊ®Ġ´íÈõÏĪÅĊàû·Ā×
,
,
(b) Explain how you could change the algorithm to repeatedly prompt for the telephone number
until the number entered is 13 characters in length.
Any code used must be fully explained.
…
…
…
…

12
2210/21/M/J/25 · Question 10May/June 2025Paper 217 marks
Loading question…
Question text

10 The flowchart represents an algorithm to calculate grades.
START
INPUT
Score
IS Score
Yes
Grade
"C"
>= 40 ?
No
IS Score
Yes
Grade
"B"
>= 60 ?
No
IS Score
Yes
Grade
"A"
>= 80 ?
No
Grade
"D"
OUTPUT "You
achieved a ", Grade
STOP
ĬÑĊ®Ġ´íÈõÏĪÅĊÞù¸þ×
,
,
(a) Complete the trace table for the algorithm, using the input data:
21, 46, 63, 91, 12
Score
Grade
OUTPUT
[3]
(b) Explain how the flowchart can be changed to produce the correct output.
…
…
…
…
…
…
…
… [4]
ĬÓĊ®Ġ´íÈõÏĪÅĊÞû¸þ×

13
2210/22/M/J/25 · Question 1May/June 2025Paper 221 marks
Loading question…
Question text

1
Tick (✓) one box to complete the description of abstraction.
Abstraction is part of the analysis stage of the development life cycle. Abstraction means
A
testing the solution to the problem.
B
writing a program using program code.
C
defining the sub-systems that make up the problem.
D
removing details from the problem that are not relevant.
[1]

Advertisement
14
2210/22/M/J/25 · Question 3May/June 2025Paper 224 marks
Loading question…
Question text

3
A range check is used to validate that the input temperature is an integer between –100 and 0,
inclusive.
Suggest suitable normal, abnormal, extreme and boundary test data to test if this validation check
is working correctly.
Normal test data …
Abnormal test data …
Extreme test data …
Boundary test data …
[4]

15
2210/22/M/J/25 · Question 4May/June 2025Paper 227 marks
Loading question…
Question text

4
(a) State one reason for using a verification check when inputting data.
…
… [1]
(b) Write the pseudocode for an algorithm to perform a double entry verification check, using the
following criteria:
•
Input 10 numbers and store them in the array Numbers[]
•
Input the same 10 numbers again; as each number is input, compare it with its
corresponding number in the array Numbers[]
◦
if the numbers match, move on to the next number
◦
if the numbers do not match, display both numbers and ask for the number to be
re-entered
◦
store the re-entered number in the corresponding array location and move on to the
next number.
•
When all the numbers have been checked, display a message to say the check has
been completed.
You do not need to declare any arrays or variables for this algorithm.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]

Advertisement