Computer Science (2210) · May/June 2026 · Question paper · Paper 21

Cambridge O Level Computer Science question paper for Paper 21, May/June 2026 — 2210/21/M/J/26, file 2210 Computer Science June 2026 Question Paper 21.pdf.

Advertisement
Loading the paper…
Text of this paper

DFD

* 0000800000001 *

,

,

Cambridge O Level
¬PŠ. 4mHuOªEŠ`|6€W
¬kY|QŸ¬s[€}j˜ 9il‚
¥ UUuu U E¥EE5¥u¥U

* 5 5 1 9 4 2 1 0 1 4 *

COMPUTER SCIENCE
Paper 2 Algorithms, Programming and Logic

2210/21
May/June 2026
1 hour 45 minutes

You must answer on the question paper.
No additional materials are needed.
INSTRUCTIONS
●
Answer all questions.
●
Use a black or dark blue pen. You may use an HB pencil for any diagrams or graphs.
●
Write your name, centre number and candidate number in the boxes at the top of the page.
●
Write your answer to each question in the space provided.
●
Do not use an erasable pen. Do not use correction fluid or tape.
●
Do not write on any bar codes.
●
Calculators must not be used in this paper.

INFORMATION
●
The total mark for this paper is 75.
●
The number of marks for each question or part question is shown in brackets [ ].
●
No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Any blank pages are indicated.
DC (LO) 369886
© Cambridge University Press & Assessment 2026

[Turn over

1

2

,

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]

Identify four operators that are not arithmetic operators from the list.
/

>

<=

+

*

^

AND

DIV

MOD

NOT

DO NOT WRITE IN THIS MARGIN

2
,

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000002 *

4
[4]
3

Complete the table by writing the most appropriate data type for each variable described.
variable

description

example data

Age

the age of the student

16

TelephoneNumber

the telephone number of
the student

+44 7846398573

Teenager

whether the student is a
teenager or not

TRUE

data type

[3]

© Cambridge University Press & Assessment 2026
ĬÎĊ®Ġ´íÈõÏĪÅĊÝú¸þ×
ĬëÛûÔīĠĕäñûÅàïĉđäĂ
ĥÕÅÕµĕŵµąµąÅõąµÅÕ

2210/21/M/J/26

DO NOT WRITE IN THIS MARGIN

3

DO NOT WRITE IN THIS MARGIN

2

DO NOT WRITE IN THIS MARGIN

1

DFD

DO NOT WRITE IN THIS MARGIN

* 0000800000003 *

3
,

4

The following pseudocode algorithm uses a bubble sort to sort the array Names[50]
Complete the algorithm.

Last
REPEAT

Swap
DO NOT WRITE IN THIS MARGIN

,

IF Names[Index] > Names[Index + 1]
THEN
Names[Index]

Temp

Names[Index]

Names[Index + 1]

Names[Index + 1]

Temp

TRUE

Swap
ENDIF
NEXT Index
Last

Last ‑ 1

UNTIL Swap OR Last = 1

[4]

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

1 TO Last ‑ 1

FOR

© Cambridge University Press & Assessment 2026
ĬÐĊ®Ġ´íÈõÏĪÅĊÝü¸þ×
ĬëÜüÜĝĤĥÕćĆĄüćÍđÔĂ
ĥÕµĕõõåÕåõĥąÅĕĥõÕÕ

2210/21/M/J/26

[Turn over

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

DO NOT WRITE IN THIS MARGIN

A computer system automatically creates usernames for new users. A new user enters their first
name and their last name.

DO NOT WRITE IN THIS MARGIN

5

,

DO NOT WRITE IN THIS MARGIN

4
,

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000004 *

[3]
© Cambridge University Press & Assessment 2026
ĬÎĊ®Ġ´íÈõÏĪÅĊßú¸Ā×
ĬëÜùÜħĒĤâĉýċÚëïāìĂ
ĥĥĥĕµõåõÅÕĕąąĕÅõÅÕ

2210/21/M/J/26

DO NOT WRITE IN THIS MARGIN

Write the pseudocode to store NewUsername to the file Username.txt

DFD

DO NOT WRITE IN THIS MARGIN

* 0000800000005 *

5
,

,

(d) Identify and describe verification checks that could be applied to the inputs of the first name
and the last name of the user.

DO NOT WRITE IN THIS MARGIN

[4]
6

Give programming examples for a count‑controlled loop and a post‑condition loop.
Describe each of the loops.
count‑controlled loop example

DO NOT WRITE IN THIS MARGIN

description

post‑condition loop example
description

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

[4]

© Cambridge University Press & Assessment 2026
ĬÐĊ®Ġ´íÈõÏĪÅĊßü¸Ā×
ĬëÛúÔġĎĔ×ïô¾þÓëāÜĂ
ĥĥĕÕõĕÅĕÕåÅąąõåµÕÕ

2210/21/M/J/26

[Turn over

An algorithm has been written in pseudocode for a user to repeatedly input positive whole
numbers and store them in an array called Values[] until –1 is input or until the array is full.
The algorithm outputs the average of the numbers to 2 decimal places.
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17

DECLARE Counter : INTEGER
DECLARE Total : INTEGER
DECLARE Average : INTEGER
DECLARE Values : ARRAY[1:100] OF INTEGER
1
Counter
0
Total
OUTPUT "Please enter a positive whole number or ‑1 "
INPUT Number
WHILE Number = ‑1 AND Counter <= 100 DO
Number
Values[Counter]
Total + 1
Total
Counter + 1
Counter
INPUT Number
ENDWHILE
Counter ‑ 1
Counter
Counter / Total
Average
OUTPUT "The average is ", ROUND(Average, 2)

Identify the line numbers of four errors in the pseudocode and suggest a correction for
each error.
error 1 line number
correction

error 2 line number

DO NOT WRITE IN THIS MARGIN

7

,

DO NOT WRITE IN THIS MARGIN

6
,

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000006 *

error 3 line number
correction

error 4 line number
correction

[4]

© Cambridge University Press & Assessment 2026
ĬÒĊ®Ġ´íÈõÏĪÅĊÞüµþ×
ĬëÜúÏīöĚÏüā·ĞëÊéìĂ
ĥµµÕõµÅµĕÅĥąÅõąõąÕ

2210/21/M/J/26

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

correction

DFD

DO NOT WRITE IN THIS MARGIN

* 0000800000007 *

7
,

8

,

Consider the logic circuit:

A

DO NOT WRITE IN THIS MARGIN

B

X

C

(a) Write the logic expression for the given logic circuit.

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

[3]
(b) Complete the truth table for the given logic circuit.
A

B

C

0

0

0

0

0

1

0

1

0

0

1

1

1

0

0

1

0

1

1

1

0

1

1

1

working space

X

[4]

© Cambridge University Press & Assessment 2026
ĬÔĊ®Ġ´íÈõÏĪÅĊÞúµþ×
ĬëÛù×ĝúĪêþðòºÓĎéÜĂ
ĥµÅĕµÕåÕąµµąÅĕĥµĕÕ

2210/21/M/J/26

[Turn over

8
,

9



,

A swimming club wants to set up a new database table to store details of the members of the
club and the maximum distance each member swam in metres.
The table is called SWIMMERS and will contain these fields:

•
•
•
•
•

Distance – distance the member swam, for example 1500
Date – date the member swam the distance
Time – time taken to swim the distance
MemberID – the code to identify a member, for example TH749
MemberName – name of the member.

(a) (i)

State why MemberName would not be appropriate for a primary key.

[1]

(ii)

Give the name of the most appropriate field for the primary key.

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000008 *

DO NOT WRITE IN THIS MARGIN

[1]
(b) Complete the table to identify the most appropriate data type for these fields in the
table SWIMMERS. Each data type must be different.
field

data type

Distance
Date

[2]
(c) Complete the structured query language (SQL) statement to display only the names of the
members who swam a distance of 1500 metres or more.
SELECT
FROM

DO NOT WRITE IN THIS MARGIN

MemberID

;
[3]

© Cambridge University Press & Assessment 2026
ĬÒĊ®Ġ´íÈõÏĪÅĊàüµĀ×
ĬëÛü×ħČğÍĄ÷ùĜï°¹äĂ
ĥąĕĕõÕåõĥĕÅąąĕŵąÕ

2210/21/M/J/26

DO NOT WRITE IN THIS MARGIN

WHERE

DFD

9
,



,

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

* 0000800000009 *

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

Turn over

© Cambridge University Press & Assessment 2026
ĬÔĊ®Ġ´íÈõÏĪÅĊàúµĀ×
ĬëÜûÏġĈďìöĊ°ÀćĬ¹ÔĂ
ĥąĥÕµµÅĕõĥĕąąõåõĕÕ

2210/21/M/J/26

[Turn over

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000010 *

10
,

,

10 (a) Draw a flowchart to input six whole numbers and output the highest. You do not need to
validate the inputs.

[6]
© Cambridge University Press & Assessment 2026
ĬÒĊ®Ġ´íÈõÏĪÅĊÝü·þ×
ĬëÚüÎĥĄùÓċðÓøíÜāÜĂ
ĥÕõÕõÕąõÅåÅÅąµÅµµÕ

2210/21/M/J/26

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

START

DFD

DO NOT WRITE IN THIS MARGIN

* 0000800000011 *

11
,

,

(b) Describe how the flowchart could be changed to only accept positive whole numbers.

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

[3]
11

The function Power(FirstNumber, SecondNumber) returns the value of FirstNumber
raised to the power of SecondNumber. FirstNumber and SecondNumber are integers.
Write pseudocode statements to:

•
•

define the function
call the function with the variables A and B and store the return value in the variable Value

function definition

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

function call

[5]

© Cambridge University Press & Assessment 2026
ĬÔĊ®Ġ´íÈõÏĪÅĊÝú·þ×
ĬëÙûÖģĀĉæíāĖäąĀāìĂ
ĥÕąĕµµĥĕÕÕĕÅąÕåõåÕ

2210/21/M/J/26

[Turn over

12 A weather monitoring station records the number of minutes of sunshine for each day of a month.
The one‑dimensional (1D) array Sunshine[] is used to store the number of minutes of sunshine
for each day. The index of the array represents the day.
The one‑dimensional (1D) array MonthDays[] contains the number of days in each month. The
index of the array represents the month. In this array, 28 is stored in index 2 for the month of
February. However, there are 29 days in February in a leap year.
In this program, a leap year is a year that divides by 4 with no remainder. For example, 2026 is
not a leap year but 2028 will be a leap year.
Write a program that meets the following requirements:

•
•
•
•
•
•

allows the user to input a year, calculates whether it is a leap year and updates the number
of days in February as appropriate
allows a user to input the name of one of the first three months of the year: January,
February or March
allows a user to input the number of minutes of sunshine for each day of the month and
validates the input
calculates the total amount of sunshine for the month in hours and minutes
finds the highest amount of daily sunshine for the month
outputs the:
◦
year
◦
month
◦
total amount of sunshine for the month in hours and minutes
◦
the highest amount of daily sunshine for the month.

You must use pseudocode or program code and add comments to explain how your code works.
Do not declare any arrays or variables; assume that this has already been done.
All inputs and outputs must contain suitable messages.

DO NOT WRITE IN THIS MARGIN

,

DO NOT WRITE IN THIS MARGIN

12
,

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000012 *

DO NOT WRITE IN THIS MARGIN

© Cambridge University Press & Assessment 2026
ĬÒĊ®Ġ´íÈõÏĪÅĊßü·Ā×
ĬëÙúÖĩîĀÑóĊčĂéÞđÔĂ
ĥĥÕĕõµĥµµõĥÅÅÕąõµÕ

2210/21/M/J/26

DO NOT WRITE IN THIS MARGIN

DFD

DO NOT WRITE IN THIS MARGIN

* 0000800000013 *

13
,

,

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

© Cambridge University Press & Assessment 2026
ĬÔĊ®Ġ´íÈõÏĪÅĊßú·Ā×
ĬëÚùÎğòðèą÷ÜÖÑúđäĂ
ĥĥåÕµÕąÕåąµÅŵĥµåÕ

2210/21/M/J/26

[Turn over

14
,

,

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000014 *

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

[15]
© Cambridge University Press & Assessment 2026
ĬÎĊ®Ġ´íÈõÏĪÅĊàù¶Ă×
ĬëÙûÏġýĈÖăô÷úČîáìĂ
ĥÅåĕõµÅõÅĕµąąõÅõõÕ

2210/21/M/J/26

DO NOT WRITE IN THIS MARGIN

DFD

15
,

,

BLANK PAGE

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

* 0000800000015 *

© Cambridge University Press & Assessment 2026
ĬÐĊ®Ġ´íÈõÏĪÅĊàû¶Ă×
ĬëÚü×ħāøãõý²ÞôêáÜĂ
ĥÅÕÕµÕåĕÕĥĥąąĕåµĥÕ

2210/21/M/J/26

16
,

,

Permission to reproduce items where third‑party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (Cambridge University Press & Assessment) to trace copyright holders, but if any items requiring clearance
have unwittingly been included, the publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer‑related information to candidates, all copyright acknowledgements are reproduced online in our Copyright
Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cambridgeinternational.org after the live
examination series.
Cambridge International Education is the name of our awarding body and a part of Cambridge University Press & Assessment, which is a department of the
University of Cambridge.

© Cambridge University Press & Assessment 2026
ĬÎĊ®Ġ´íÈõÏĪÅĊÞù¶Ą×
ĬëÚù×ĝóñØûùĀÐȱäĂ
ĥõąÕõÕåµµÅĕąÅĕąµõÕ

2210/21/M/J/26

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

BLANK PAGE

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000016 *

Advertisement