Computer Science (0478) · Feb/March 2026 · Question paper 22

Cambridge Computer Science (0478) question paper for paper 22, Feb/March 2026 — 0478/22/F/M/26, file 0478_m26_qp_22.pdf.

Advertisement
Loading the paper…
Text of this paper

DFD

* 0000800000001 *

,

,

Cambridge IGCSE™
¬WŠ. 4mHuOªEŠ`y6€W
¬‡q[§ ªX ƒG/›€4ˆ‚
¥¥¥UuUe55 e E5 U¥U

* 9 0 4 0 2 2 3 2 2 5 *

COMPUTER SCIENCE
Paper 2 Algorithms, Programming and Logic

0478/22
February/March 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 20 pages. Any blank pages are indicated.
DC (CJ) 355603/3
© Cambridge University Press & Assessment 2026

[Turn over

2
,

Tick (3) one box to identify the reason for applying a verification check to input data.
A

To make sure that all the data is in the correct range.

B

To make sure that all the data is accurate.

C

To make sure that no errors have been introduced during input.

D

To make sure that all the data is of the correct length.
[1]

2

(a) Identify the type of validation check in each description. Each check must be different.
(i)

A check to make sure that data input follows a set pattern such as two letters followed
by three numbers.
[1]

(ii)

A check to make sure that only whole numbers can be input.
[1]

(b) Explain the reasons why validation checks are necessary when data is input.

DO NOT WRITE IN THIS MARGIN

1

,

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000002 *

[3]

© Cambridge University Press & Assessment 2026
ĬÕĊ®Ġ´íÈõÏĪÅĊÝû¸þ×
ĬćčòÚģāĀßüõìćġ°ČĀĂ
ĥµõÕµµĥÕąÅõÅÅõĥĕÅÕ

0478/22/F/M/26

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DFD

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

* 0000800000003 *

3
,

,

(c) Write the pseudocode for an algorithm to perform a validation check on each number as it is
input to meet the following criteria:

•
•
•
•

Input 20 numbers, one at a time.
If a number is negative, store it in the current element of array NegNumbers[]
If a number is not negative, ask for it to be input again until a negative number is input.
When all 20 negative numbers have been stored, output a message to state the check
has been completed.

Use appropriate input prompts and output messages to make the requirements clear to
the user.
Do not declare any arrays or variables for this algorithm.

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

[6]

© Cambridge University Press & Assessment 2026
Ĭ×Ċ®Ġ´íÈõÏĪÅĊÝù¸þ×
ĬćĎñÒĥýðÚþČĝÓęĬČðĂ
ĥµąĕõÕąµĕµåÅÅĕąÕÕÕ

0478/22/F/M/26

[Turn over

4
,

3

,

The program development life cycle is split into a number of stages.
Describe what happens during the analysis and design stages of the program development
life cycle.
analysis

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000004 *

design

DO NOT WRITE IN THIS MARGIN

[6]
4

Tick (3) one box to identify which of the following does not help to create a
maintainable program.
A

Use meaningful identifiers for variable names.

B

Remove blank lines to make the program code shorter.

C

Use procedures and functions.

D

Use the commenting feature provided by the programming languages.
[1]

© Cambridge University Press & Assessment 2026
ĬÕĊ®Ġ´íÈõÏĪÅĊßû¸Ā×
ĬćĎôÒğïùÝĄăĦñµÊĜĈĂ
ĥąÕĕµÕąĕõĕÕÅąĕåÕÅÕ

0478/22/F/M/26

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DFD

5
,

,

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

* 0000800000005 *

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

Turn over

© Cambridge University Press & Assessment 2026
Ĭ×Ċ®Ġ´íÈõÏĪÅĊßù¸Ā×
ĬćčóÚĩóĉÜöîãå½ĎĜøĂ
ĥąåÕõµĥõĥĥąÅąõÅĕÕÕ

0478/22/F/M/26

[Turn over

This pseudocode algorithm is intended to sort 200 names in ascending order, using a bubble
sort. The last names and first names are stored in separate columns of a two‑dimensional
(2D) array. The last names are stored in column 1 of the array.
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22

// The array Names[] has already been declared as
// ARRAY[1:200, 1:2] OF STRING and it is already populated
DECLARE Row : STRING
DECLARE Temp1 : STRING
DECLARE Temp2 : STRING
DECLARE Swap : BOOLEAN
FALSE
Swap
WHILE NOT Swap DO
FALSE
Swap
2 TO 199
FOR Row
IF Names[Row, 1] > Names[Row + 1, 1]
THEN
Names[Row, 1]
Temp1
Names[Row, 2]
Temp2
Names[Row + 1, 1]
Names[Row, 1]
Names[Row + 1, 2]
Names[Row, 1]
Temp1
Names[Row + 1, 1]
Temp2
Names[Row + 1, 2]
FALSE
Swap
ENDIF
NEXT Column
ENDWHILE

(a) Identify the line numbers of five errors in the pseudocode and suggest corrections.
error 1 line number
correction

DO NOT WRITE IN THIS MARGIN

5

,

DO NOT WRITE IN THIS MARGIN

6
,

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000006 *

error 2 line number
correction

error 3 line number
correction

DO NOT WRITE IN THIS MARGIN

correction

© Cambridge University Press & Assessment 2026
ĬÙĊ®Ġ´íÈõÏĪÅĊÞùµþ×
ĬćĎóÕģěăÔñÿÚŵï´ĈĂ
ĥÕąÕõĕĥÕåąåÅÅõĥÕąÕ

0478/22/F/M/26

DO NOT WRITE IN THIS MARGIN

error 4 line number

DFD

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

* 0000800000007 *

7
,

,

error 5 line number
correction

[5]
(b) Write the pseudocode for an algorithm, using nested iteration, to output the contents
of Names[]

DO NOT WRITE IN THIS MARGIN

[4]
(c) Describe a possible problem with the algorithm that could mean the names are not
sorted accurately.

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

[2]

© Cambridge University Press & Assessment 2026
ĬÛĊ®Ġ´íÈõÏĪÅĊÞûµþ×
ĬćčôÍĥėóåćòďđ½ë´øĂ
ĥÕõĕµõąµµõõÅÅĕąĕĕÕ

0478/22/F/M/26

[Turn over

8
,

This flowchart represents an algorithm.
START

INPUT
Sentence
LENGTH(Sentence)

LetterNo

Start

1

1

DO NOT WRITE IN THIS MARGIN

SentLength

IS
SUBSTRING(Sentence,
LetterNo, 1) = " "
?

Yes

Word
SUBSTRING(Sentence,
Start, LetterNo – Start)

No

OUTPUT Word, " ",
LENGTH(Word)

Start

LetterNo + 1
LetterNo

Word
SUBSTRING(Sentence,
Start, LetterNo – Start + 1)

Yes

OUTPUT Word, " ",
LENGTH(Word)

STOP
© Cambridge University Press & Assessment 2026
ĬÙĊ®Ġ´íÈõÏĪÅĊàùµĀ×
ĬćčñÍğĥöÒĉùƳġĉäĀĂ
ĥĥåĕõõąĕÕÕąÅąĕåĕąÕ

0478/22/F/M/26

LetterNo + 1

IS LetterNo =
SentLength ?

No

DO NOT WRITE IN THIS MARGIN

6



DO NOT WRITE IN THIS MARGIN

,

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000008 *

DFD

9
,



,

(a) Complete the trace table for the algorithm, using the given sentence.
Note: the start position of the sentence is index 1.
Sentence
Computing is fun

SentLength

LetterNo

Start

Word

OUTPUT

16

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

* 0000800000009 *

[5]
(b) Explain the purpose of the algorithm shown by the flowchart.

DO NOT WRITE IN THIS MARGIN

[3]

© Cambridge University Press & Assessment 2026
ĬÛĊ®Ġ´íÈõÏĪÅĊàûµĀ×
ĬćĎòÕĩĩĆçïĈÑħęÍäðĂ
ĥĥÕÕµĕĥõÅåÕÅąõÅÕĕÕ

0478/22/F/M/26

[Turn over

10
,

,

(c) As currently written, the algorithm may be difficult to understand if it was used as a program.
Identify three improvements that could be made to the algorithm to make it more
user friendly.

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000010 *

© Cambridge University Press & Assessment 2026
ĬÙĊ®Ġ´íÈõÏĪÅĊÝù·þ×
ĬćĐñØĝĝĤÐĂò®ÏģĝĜøĂ
ĥµÅÕõõåĕõĥąąąµåĕµÕ

0478/22/F/M/26

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

[3]

DO NOT WRITE IN THIS MARGIN

DFD

DO NOT WRITE IN THIS MARGIN

* 0000800000011 *

11
,

7

,

Consider the logic expression:
X = (A NAND NOT B) XOR (A NOR C)
(a) Draw a logic circuit for this logic expression.
Each logic gate must have a maximum of two inputs.

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 simplify the logic expression.

A

B

X

C

[4]
(b) Complete the truth table from the given logic expression.
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
ĬÛĊ®Ġ´íÈõÏĪÅĊÝû·þ×
ĬćďòÐīġĔéøÿûċě¹ĜĈĂ
ĥµµĕµĕÅõĥĕÕąąÕÅÕåÕ

0478/22/F/M/26

[Turn over

A database table NATIONAL_TREES stores details of the national trees of some countries from
around the world.
IDCode

Country

Continent

CommonName

ScientificName

EU121

Albania

Europe

Olive

Olea europaea

OC235

Australia

Oceania

Golden wattle

Acacia pycnantha

NO126

The Bahamas

North America

Lignum vitae

Guaiacum sanctum

AS534

Bangladesh

Asia

Mango tree

Mangifera indica

SO326

Brazil

South America

Brazilwood

Caesalpinia echinata

NO124

Canada

North America

Maple

Acer

EU321

Cyprus

Europe

Golden oak

Quercus alnifolia

NA456

Dominican Republic

North America

West Indian mahogany

Swietenia mahagoni

EU652

Finland

Europe

Silver birch

Betula pendula

AS222

India

Asia

Indian banyan

Ficus benghalensis

NO232

Jamaica

North America

Blue mahoe

Talipariti elatum

AF875

Madagascar

Africa

Baobab

Adansonia

OC123

New Zealand

Oceania

Silver fern

Cyathea dealbata

AS498

Philippines

Asia

Narra

Pterocarpus indicus

AF501

South Africa

Africa

Real yellowwood

Podocarpus Iatifolius

SO522

Venezuela

South America

Araguaney

Tabebuia chrysantha

(a) State the number of fields and records in this database table.

DO NOT WRITE IN THIS MARGIN

8

,

DO NOT WRITE IN THIS MARGIN

12
,

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000012 *

records
[2]
(b) The data in both IDCode and Country fields are unique in the database table.
State one reason why IDCode would make a better primary key than Country

DO NOT WRITE IN THIS MARGIN

fields

© Cambridge University Press & Assessment 2026
ĬÙĊ®Ġ´íÈõÏĪÅĊßù·Ā×
ĬćďóÐġēĕÎúĈôé·ěČðĂ
ĥąĥĕõĕÅÕąµåąÅÕĥÕµÕ

0478/22/F/M/26

DO NOT WRITE IN THIS MARGIN

[1]

DFD

DO NOT WRITE IN THIS MARGIN

* 0000800000013 *

13
,

,

(c) Give the output that would be produced by the structured query language (SQL) statement:
SELECT IDCode, Country, CommonName
FROM NATIONAL_TREES
WHERE Continent = "Europe";

[3]
(d) Complete the SQL statement to list only the country, common name and scientific name of
the national trees listed for North America, in alphabetical order of their common names.
SELECT
FROM
WHERE
;
[5]

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
ĬÛĊ®Ġ´íÈõÏĪÅĊßû·Ā×
ĬćĐôØħďĥëĀùµí¿¿ČĀĂ
ĥąĕÕµõåµĕÅõąÅµąĕåÕ

0478/22/F/M/26

[Turn over

14
,

9

,

A program is required to enable voting in class surveys, for example to find the most
popular smartphone.
The one‑dimensional (1D) array Options[] is used to store between 2 and 12 options on which
users can vote.
The one‑dimensional (1D) array Votes[] is used to store the votes of between 2 and 1000 users.

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000014 *

•
•
•
•
•
•

Initialise all the arrays before they are used.
Input and validate the number of options and the number of voters.
Input each of the required options and store them in the array Options[]
Display the list of options for each voter and allow each voter to input their preferred option.
Validate this input and store it in the array Votes[]
Once all the votes have been input, count the number of voters who chose each option and
find the most and least popular options.
Output the most and least popular options as well as the number of voters who selected
each of these options.

The program does not need to identify if two or more options are the equal most or least popular.
You must use pseudocode or program code, and add comments to explain how your code works.
Do not declare arrays, variables or constants for this algorithm; assume this has been done.
Initialisation must be carried out as appropriate.
All inputs and outputs must contain suitable messages.

DO NOT WRITE IN THIS MARGIN

Write a program for the following requirements:

DO NOT WRITE IN THIS MARGIN

The one‑dimensional (1D) array VoteCount[] is used to store the number of votes for each of
the options. The array index represents the option number.

DO NOT WRITE IN THIS MARGIN

© Cambridge University Press & Assessment 2026
ĬÕĊ®Ġ´íÈõÏĪÅĊàü¶Ă×
ĬćďòÕĩĤčÙĊîĚÑĖ˼ĈĂ
ĥåĕĕõĕĥĕõÕõÅąõåÕõÕ

0478/22/F/M/26

DO NOT WRITE IN THIS MARGIN

DFD

DO NOT WRITE IN THIS MARGIN

* 0000800000015 *

15
,

,

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
Ĭ×Ċ®Ġ´íÈõÏĪÅĊàú¶Ă×
ĬćĐñÍğĠĝàðăÏąĞď¼øĂ
ĥåĥÕµõąõĥååÅąĕÅĕĥÕ

0478/22/F/M/26

[Turn over

16
,

,

DO NOT WRITE IN THIS MARGIN

DFD

* 0000800000016 *

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

DO NOT WRITE IN THIS MARGIN

[15]
© Cambridge University Press & Assessment 2026
ĬÕĊ®Ġ´íÈõÏĪÅĊÞü¶Ą×
ĬćĐôÍĥĎĬÛòČØç­ìĀĂ
ĥĕµÕõõąÕąąÕÅÅĕĥĕõÕ

0478/22/F/M/26

DO NOT WRITE IN THIS MARGIN

DFD

17
,

,

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

* 0000800000017 *

© Cambridge University Press & Assessment 2026
Ĭ×Ċ®Ġ´íÈõÏĪÅĊÞú¶Ą×
ĬćďóÕģĒĜÞĈõđóºĩìðĂ
ĥĕÅĕµĕĥµĕõąÅÅõąÕĥÕ

0478/22/F/M/26

18
,



,

© Cambridge University Press & Assessment 2026
ĬÕĊ®Ġ´íÈõÏĪÅĊßü¸Ă×
ĬćčôØħĖîÕùăîËÄÙĔøĂ
ĥÅÕĕõõåÕåµÕąÅµĥĕÅÕ

0478/22/F/M/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

* 0000800000018 *

DFD

19
,



,

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

* 0000800000019 *

© Cambridge University Press & Assessment 2026
Ĭ×Ċ®Ġ´íÈõÏĪÅĊßú¸Ă×
ĬćĎóÐġĚþäÿî»ď¼ýĔĈĂ
ĥÅåÕµĕŵµÅąąÅÕąÕÕÕ

0478/22/F/M/26

20
,

,

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
ĬÕĊ®Ġ´íÈõÏĪÅĊÝü¸Ą×
ĬćĎòÐīĬċ×āõ´­ĘߥðĂ
ĥõõÕõĕÅĕÕĥõąąÕåÕÅÕ

0478/22/F/M/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

* 0000800000020 *

Advertisement