Computer Science (0478) · Oct/Nov 2025 · Question paper 23
Cambridge Computer Science (0478) question paper for paper 23, Oct/Nov 2025 — 0478/23/O/N/25, file 0478_w25_qp_23.pdf.
Text of this paper
DFD
* 0000800000001 *
,
www.dynamicpapers.com
,
Cambridge IGCSE™
¬O. 4mHuOªE]|6W
¬C{t[¬yRnmUP@
¥U55eU5eu E5 U5U
* 0 6 5 0 4 1 3 5 7 1 *
COMPUTER SCIENCE
Paper 2 Algorithms, Programming and Logic
0478/23
October/November 2025
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 or correction fluid.
●
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 (CJ) 342262/2
© UCLES 2025
[Turn over
www.dynamicpapers.com
2
,
1
,
Give three ways of creating a maintainable program.
1
2
3
[3]
Four descriptions of programming techniques and five programming techniques are given.
DO NOT WRITE IN THIS MARGIN
2
Draw one line from each description to the relevant technique. Not all techniques will be used.
Description
Programming technique
output
adding up a set of numbers
DO NOT WRITE IN THIS MARGIN
DFD
* 0000800000002 *
selection
DO NOT WRITE IN THIS MARGIN
displaying the result of a
calculation
totalling
executing a set of instructions
based on a condition
iteration
executing the same set of
instructions multiple times
3
Tick (3) one box to identify the most appropriate data type to store 'M'
A
integer
B
char
C
real
D
Boolean
© UCLES 2025
[1]
ĬÍĊ®Ġ´íÈõÏĪÅĊàú¸þ×
ĬÃùóÚĩĠďéăċĦĝæðºďĂ
ĥąåĕõõĥµąĥåÅÅõĥĕĕÕ
0478/23/O/N/25
DO NOT WRITE IN THIS MARGIN
[4]
DO NOT WRITE IN THIS MARGIN
counting
DFD
DO NOT WRITE IN THIS MARGIN
* 0000800000003 *
www.dynamicpapers.com
3
,
4
,
(a) Tickets for a theme park are booked online. An adult ticket costs $12.99 and a child ticket
costs $7.99. A booking fee of $1.99 is added to the total cost of each booking.
Write an algorithm in pseudocode to:
•
•
•
input the number of adult tickets for a booking
input the number of child tickets for a booking
calculate and output the total cost of the booking using an appropriate message.
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[4]
(b) Each booking must have at least one adult ticket.
Explain how the algorithm could be changed to repeatedly ask for the number of adult tickets
if the number input is less than 1.
Any code used must be fully explained.
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[4]
© UCLES 2025
ĬÏĊ®Ġ´íÈõÏĪÅĊàü¸þ×
ĬÃúôÒğĤğÐõöã¹ÎìºğĂ
ĥąÕÕµĕąÕĕĕõÅÅĕąÕąÕ
0478/23/O/N/25
[Turn over
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
DFD
* 0000800000004 *
4
,
,
(c) The theme park has rules for a person to be able to go on a ride.
A person can go on a ride (X = 1) only if they:
are 1.4 metres tall or over
are 12 years old or over
do not have a medical condition.
Description
A
B
C
(i)
Binary value
under 1.4 metres
0
1.4 metres or over
1
under 12 years old
0
12 years old or over
1
does not have a medical condition
0
has a medical condition
1
DO NOT WRITE IN THIS MARGIN
Input
Write the logic expression for this problem.
X = [2]
Complete the truth table for this problem.
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
DO NOT WRITE IN THIS MARGIN
(ii)
DO NOT WRITE IN THIS MARGIN
•
•
•
© UCLES 2025
ĬÍĊ®Ġ´íÈõÏĪÅĊÞú¸Ā×
ĬÃúñÒĥĒĪëûíìěòĊêėĂ
ĥµąÕõĕąõõµąÅąĕåÕĕÕ
0478/23/O/N/25
DO NOT WRITE IN THIS MARGIN
[4]
DFD
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000005 *
www.dynamicpapers.com
5
,
5
,
A program has been written in pseudocode to input five numbers between 1 and 900 inclusive and
store the highest number and the lowest number entered.
01
02
03
04
05
06
07
08
09
10
11
12
13
14
900
Lowest
1
Highest
1 TO 5
FOR Count
INPUT Number
IF Number < Lowest
THEN
Number
Lowest
ELSE
IF Number > Highest
THEN
Number
Highest
ENDIF
ENDIF
NEXT Count
(a) Complete the trace table for the algorithm using the following numbers:
563, 21, 376, 99, 400
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
Count
Number
Lowest
Highest
[4]
(b) The algorithm does not work correctly.
State the reason why the algorithm does not work as expected and explain how the algorithm
could be corrected.
Any code used must be fully explained.
DO NOT WRITE IN THIS MARGIN
Reason
Correction
[2]
© UCLES 2025
ĬÏĊ®Ġ´íÈõÏĪÅĊÞü¸Ā×
ĬÃùòÚģĎĚÎýĄĝ¿ĊÎêħĂ
ĥµõĕµõĥĕĥÅÕÅąõÅĕąÕ
0478/23/O/N/25
[Turn over
6
,
6
,
The flowchart represents an algorithm.
START
Count
–1
DO NOT WRITE IN THIS MARGIN
Position
1
INPUT Name
IS Name =
ClassList[Count]
?
Yes
No
Count
Count + 1
IS Count
> 5?
Position
Count
DO NOT WRITE IN THIS MARGIN
No
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
DO NOT WRITE IN THIS MARGIN
DFD
* 0000800000006 *
Yes
OUTPUT
Position
© UCLES 2025
ĬÑĊ®Ġ´íÈõÏĪÅĊßüµþ×
ĬÃúòÕĩöĔÖĊñĘßò¯ĂėĂ
ĥĥÕĕµÕĥµååõÅÅõĥÕÕÕ
0478/23/O/N/25
DO NOT WRITE IN THIS MARGIN
STOP
DFD
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000007 *
www.dynamicpapers.com
7
,
,
(a) The algorithm uses the one-dimensional (1D) array ClassList that contains the following
data:
ClassList
1
2
3
4
5
Henil
Sven
Ella
Asia
Ridwan
Complete the table by writing the output from the flowchart when each of the given names are
input.
Name
OUTPUT
Ridwan
Yan
Ella
[2]
DO NOT WRITE IN THIS MARGIN
(b) Identify the standard method of solution used by the flowchart.
[1]
(c) Write the algorithm in pseudocode.
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[6]
© UCLES 2025
ĬÓĊ®Ġ´íÈõÏĪÅĊßúµþ×
ĬÃùñÍğúĤãðĀÑûĊīĂħĂ
ĥĥåÕõµąÕµÕåÅÅĕąĕÅÕ
0478/23/O/N/25
[Turn over
8
,
7
,
An algorithm has been written in pseudocode to:
•
•
•
input a whole number between 1 and 255 inclusive
convert the input to an 8-bit binary number
store each bit of the binary number in an array.
For example, if the denary number 127 was input, the binary number 01111111 would be stored in
the array.
01
02
03
04
05
06
07
08
DECLARE BinaryArray : ARRAY[1:8] OF INTEGER
DECLARE DenaryNumber : CHAR
OUTPUT "Please enter a whole number between 1 and 255 inclusive "
INPUT DenaryNumber
7 TO 1 STEP -1
FOR Count
MOD(DenaryNumber,3)
BinaryArray[Count]
DIV(DenaryNumber,2)
DenaryNumber
NEXT Count
(a) Identify the line numbers of the three errors in the pseudocode and suggest a correction for
each error.
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
DO NOT WRITE IN THIS MARGIN
DFD
* 0000800000008 *
Correction
Error 2 line number
Correction
DO NOT WRITE IN THIS MARGIN
Error 1 line number
[3]
© UCLES 2025
ĬÑĊ®Ġ´íÈõÏĪÅĊÝüµĀ×
ĬÃùôÍĥČĥØòćÚÙæÉĒďĂ
ĥÕõÕµµąõÕõÕÅąĕåĕÕÕ
0478/23/O/N/25
DO NOT WRITE IN THIS MARGIN
Correction
DO NOT WRITE IN THIS MARGIN
Error 3 line number
DFD
DO NOT WRITE IN THIS MARGIN
* 0000800000009 *
www.dynamicpapers.com
9
,
,
(b) Identify one programming technique used in the algorithm.
[1]
(c) (i)
The algorithm can accept a number between 1 and 255 inclusive as input.
Two validation checks that could be applied to DenaryNumber are a presence check
and a type check.
DO NOT WRITE IN THIS MARGIN
Identify one other validation check that could be applied to DenaryNumber
[1]
(ii)
Write the pseudocode to implement the validation check you identified in (c)(i).
You do not need to rewrite the whole algorithm.
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[3]
© UCLES 2025
ĬÓĊ®Ġ´íÈõÏĪÅĊÝúµĀ×
ĬÃúóÕģĈĕáĈúďýÎčĒğĂ
ĥÕąĕõÕĥĕÅąąÅąõÅÕÅÕ
0478/23/O/N/25
[Turn over
A school has set up a database table EquipmentLoan to record details of school equipment
loaned to students.
EquipmentID
Description
Name
DateLoaned
Returned
Cam01
Digital camera
James
23/04/2025
No
Cam04
Digital camera
Amir
12/03/2025
Yes
Gra02
Graphics tablet
Nikita
27/04/2025
No
Tab01
Tablet
Holly
18/03/2025
Yes
Ext01
External Hard drive
Hussein
27/04/2025
Yes
Cam02
Digital camera
Emily
10/04/2025
Yes
Tri01
Tripod
Emily
10/04/2025
Yes
Give the name of the field that is most appropriate to be the primary key.
[1]
State the reason for choosing this field for the primary key.
[1]
(b) Complete the structured query language (SQL) statement to list equipment not returned.
The list must contain only the descriptions and student names.
SELECT
FROM
WHERE ;
[3]
© UCLES 2025
ĬÑĊ®Ġ´íÈõÏĪÅĊàü·þ×
ĬÃüôØħĄóÚùĀôµèÝêħĂ
ĥąĕĕµµåõõÅÕąąµåĕĥÕ
0478/23/O/N/25
DO NOT WRITE IN THIS MARGIN
(ii)
DO NOT WRITE IN THIS MARGIN
(a) (i)
DO NOT WRITE IN THIS MARGIN
8
,
DO NOT WRITE IN THIS MARGIN
10
,
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
DFD
* 0000800000010 *
DFD
DO NOT WRITE IN THIS MARGIN
* 0000800000011 *
www.dynamicpapers.com
11
,
9
,
The variables Name, Age and Found are used in a computer program.
Name holds the name of a person. Age holds the age of a person as a whole number.
Found holds a flag that can be set to TRUE or FALSE
(a) Write pseudocode statements to declare the variables Name, Age and Found
DO NOT WRITE IN THIS MARGIN
[3]
(b) The procedure StoreData(Name) stores the name of a person in the file People.txt
(i)
Write pseudocode statements to:
•
•
define the procedure with the parameter
store the name of the person in the file.
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[5]
(ii)
Write the pseudocode that uses the procedure StoreData() to store the name ‘Suella’
in the file People.txt
DO NOT WRITE IN THIS MARGIN
[2]
© UCLES 2025
ĬÓĊ®Ġ´íÈõÏĪÅĊàú·þ×
ĬÃûóÐġĀăßÿñµġÐùêėĂ
ĥąĥÕõÕÅĕĥµąąąÕÅÕõÕ
0478/23/O/N/25
[Turn over
,
10 A number game has two players. Random whole numbers are generated for each player. The
numbers are compared and players are given points based on the result of the comparison.
The two-dimensional (2D) array NumberGenerated[] stores each number generated for each
player. The first dimension stores the player number and the second dimension stores the random
whole numbers generated.
The game is played as follows:
•
•
•
•
•
•
100 random whole numbers between 1 and 6 inclusive are generated for player 1 and stored
in the array.
100 random whole numbers between 1 and 6 inclusive are generated for player 2 and stored
in the array.
The first number generated for each player is compared and the player with the higher number
is awarded 2 points. If the two numbers are the same, both players are awarded 1 point each.
The comparisons repeat for all 100 numbers generated.
The player with the higher total number of points is output as the winner.
If the players have the same total number of points, a new random whole number is generated
for each player and compared. This is repeated until one player has a higher number than the
other player. 2 points are added to that player’s total number of points, making this player the
winner.
Write a program that meets the following requirements:
•
•
•
•
input and validate the names of the two players
generate 100 random whole numbers between 1 and 6 inclusive for each player and store
them in the array NumberGenerated[]
calculate and store the total number of points for each player
output the name and total number of points for each player in descending order of total
number of points.
You must use pseudocode or program code and add comments to explain how your code works.
DO NOT WRITE IN THIS MARGIN
12
,
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
DO NOT WRITE IN THIS MARGIN
DFD
* 0000800000012 *
All outputs must contain suitable messages.
DO NOT WRITE IN THIS MARGIN
You do not need to declare any arrays or variables; assume that this has already been done.
© UCLES 2025
ĬÑĊ®Ġ´íÈõÏĪÅĊÞü·Ā×
ĬÃûòÐīîĆÜāú®ÃôÛºğĂ
ĥµµÕµÕŵąĕõąÅÕĥÕĥÕ
0478/23/O/N/25
DO NOT WRITE IN THIS MARGIN
DFD
DO NOT WRITE IN THIS MARGIN
* 0000800000013 *
www.dynamicpapers.com
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
© UCLES 2025
ĬÓĊ®Ġ´íÈõÏĪÅĊÞú·Ā×
ĬÃüñØĝòöÝ÷ćûėČÿºďĂ
ĥµÅĕõµåÕĕĥåąÅµąĕõÕ
0478/23/O/N/25
[Turn over
www.dynamicpapers.com
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
© UCLES 2025
ĬÍĊ®Ġ´íÈõÏĪÅĊÝù¶Ă×
ĬÃûóÕģýþÏñĄØ»ÑċĊėĂ
ĥĕÅÕµÕĥõõõåÅąõåÕåÕ
0478/23/O/N/25
DO NOT WRITE IN THIS MARGIN
DFD
DO NOT WRITE IN THIS MARGIN
* 0000800000015 *
www.dynamicpapers.com
15
,
,
DO NOT WRITE IN THIS MARGIN
[15]
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
© UCLES 2025
ĬÏĊ®Ġ´íÈõÏĪÅĊÝû¶Ă×
ĬÃüôÍĥāîêćíđğéÏĊħĂ
ĥĕµĕõµąĕĥąõÅąĕÅĕµÕ
0478/23/O/N/25
www.dynamicpapers.com
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 (UCLES) 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 the Cambridge
Assessment International Education 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 Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.
© UCLES 2025
ĬÍĊ®Ġ´íÈõÏĪÅĊßù¶Ą×
ĬÃüñÍğóûÍĉöĚ½ąíĚďĂ
ĥåĥĕµµąµąåąÅÅĕĥĕåÕ
0478/23/O/N/25
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 *