Computer Science (0478) · May/June 2025 · Question paper 23
Cambridge Computer Science (0478) question paper for paper 23, May/June 2025 — 0478/23/M/J/25, file 0478_s25_qp_23.pdf.
Text of this paper
* 0000800000001 *
,
,
Cambridge IGCSE™
¬O. 4mHuOªE`z5W
¬>}yN£©g3HTq
¥¥UUuU¥UU 5 EU
* 7 2 4 1 1 0 2 3 8 2 *
COMPUTER SCIENCE
Paper 2 Algorithms, Programming and Logic
0478/23
May/June 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 (DE/CB) 342017/5
© UCLES 2025
[Turn over
2
1
,
The flowchart shows an algorithm used for quality control on a biscuit production line.
The weight of each biscuit is entered into the variable Weight. If the weight of the biscuit is
between 16.2 and 17.2 grammes, inclusive, the pass counter is incremented by 1. Otherwise,
the reject counter is incremented by 1. The process continues until –1 is entered, after which, the
totals for pass and reject counters are output.
(a) Complete this flowchart.
RejectCount
0
0
DO NOT WRITE IN THIS MARGIN
PassCount
DO NOT WRITE IN THIS MARGIN
START
Yes
No
DO NOT WRITE IN THIS MARGIN
No
Yes
STOP
[6]
© UCLES 2025
ĬÍĊ®Ġ´íÈõÏĪÅĊÝü·þ×
Ĭ¾ÿúÏħĝóÐøñÐðêßÉĦĂ
ĥµÅÕµµåµåÕąÅąõĥÕĥÕ
0478/23/M/J/25
DO NOT WRITE IN THIS MARGIN
,
DO NOT WRITE IN THIS MARGIN
* 0000800000002 *
DO NOT WRITE IN THIS MARGIN
* 0000800000003 *
3
,
,
(b) Explain how you would alter the flowchart in 1(a) so that it calculates and outputs the average
weight of only the biscuits that passed the weight check.
You may include program statements or flowchart symbols in your answer, but they must be
fully explained.
DO NOT WRITE IN THIS MARGIN
[4]
2
Three uses of arithmetic operators and four results are shown.
Draw one line from each use of arithmetic operator to the correct result.
Not all results will be used.
Use of arithmetic operator
Result
5
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
355 DIV 10
355
355 / 10
35
355 MOD 10
DO NOT WRITE IN THIS MARGIN
35.5
[3]
© UCLES 2025
ĬÏĊ®Ġ´íÈõÏĪÅĊÝú·þ×
Ĭ¾Āù×ġġăéĂĀęìÒûÉĖĂ
ĥµµĕõÕÅÕµåÕÅąĕąĕõÕ
0478/23/M/J/25
[Turn over
The purpose of this pseudocode algorithm is to carry out a bubble sort to sort, in descending
order, 1000 numbers stored in a one-dimensional (1D) array.
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
DECLARE Values : ARRAY[1:1000] OF REAL
DECLARE Index : CHAR
DECLARE Stop : BOOLEAN
DECLARE Hold : REAL
FALSE
Stop
WHILE NOT Stop DO
FALSE
Stop
1 TO 50
FOR Index
IF Values[Index + 1] > Values[Index]
THEN
Values[Index]
Hold
Values[Index + 1]
Values[Index]
Hold
Values[Index + 1]
FALSE
Stop
ENDIF
NEXT Index
NEXT Stop
(a) 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
Correction
DO NOT WRITE IN THIS MARGIN
3
,
DO NOT WRITE IN THIS MARGIN
4
,
DO NOT WRITE IN THIS MARGIN
* 0000800000004 *
Error 3 line number
Correction
Error 4 line number
Correction
DO NOT WRITE IN THIS MARGIN
© UCLES 2025
ĬÍĊ®Ġ´íÈõÏĪÅĊßü·Ā×
Ĭ¾Āü×īēĆÎĀćĒĊîÙÙĞĂ
ĥąĥĕµÕÅõÕąåÅÅĕåĕĥÕ
0478/23/M/J/25
DO NOT WRITE IN THIS MARGIN
[4]
DO NOT WRITE IN THIS MARGIN
* 0000800000005 *
5
,
,
(b) The swap section in lines 11 to 13 of the existing code are to be changed to a call statement
for a procedure. This procedure will include two parameters representing the indexes of the
array elements to be swapped.
(i)
Complete the pseudocode for PROCEDURE Swap
PROCEDURE Swap( )
DO NOT WRITE IN THIS MARGIN
DECLARE Hold : REAL
Values[ ]
Hold
ENDPROCEDURE
(ii)
[4]
Write the pseudocode to transfer control to PROCEDURE Swap
DO NOT WRITE IN THIS MARGIN
[2]
(c) Explain the difference between global variables and the variable declared in 3(b)(i).
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[2]
© UCLES 2025
ĬÏĊ®Ġ´íÈõÏĪÅĊßú·Ā×
Ĭ¾ÿûÏĝďöëúú×ÎĆýÙĎĂ
ĥąĕÕõµåĕÅõõÅÅõÅÕõÕ
0478/23/M/J/25
[Turn over
6
,
4
,
(a) An input must be an integer between 10 and 95, inclusive.
(i)
State the type of validation check to test if the input meets this requirement.
[1]
(ii)
Suggest suitable abnormal and extreme test data for an integer between 10 and 95
inclusive, and give a reason for each of your choices.
DO NOT WRITE IN THIS MARGIN
* 0000800000006 *
Extreme test data
Reason
[4]
(b) A password system requires all new passwords to contain at least 12 characters.
(i)
State the type of validation check to test that the password meets this requirement.
[1]
(ii)
Write the pseudocode to allow a new password to be entered and to ensure that it
contains at least 12 characters. The password is re-input until it meets this requirement.
Use an appropriate error message for inputs that do not meet the requirement.
You do not need to declare any variables for this algorithm.
DO NOT WRITE IN THIS MARGIN
Reason
DO NOT WRITE IN THIS MARGIN
Abnormal test data
DO NOT WRITE IN THIS MARGIN
[5]
© UCLES 2025
ĬÑĊ®Ġ´íÈõÏĪÅĊÞú¶þ×
Ĭ¾ĀûÔħ÷ðãíċÞ®îĠñĞĂ
ĥÕµÕõĕåµąĕÕÅąõĥĕåÕ
0478/23/M/J/25
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000007 *
7
,
5
,
(a) A computer store uses a database table COMPONENT to store the stock details of a range of
components needed to build computer systems.
Complete the table by giving appropriate data types for each field.
Only the data types: text, character, Boolean, integer, real, date/time are available in this
database.
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
Field
Data type
Description
ID
unique identifier
Name
component name
Description
component description
Price
selling price of component to
2 decimal places
NumberAvailable
number in stock
MinimumLevel
level at which the component
is reordered
ReOrdered
whether or not the component
has been reordered
DateOrdered
the date the component was
reordered
[4]
(b) Complete the structured query language (SQL) statement to list only the unique identifier,
component name and reorder date of all the components that have been reordered.
SELECT
FROM
WHERE ;
© UCLES 2025
ĬÓĊ®Ġ´íÈõÏĪÅĊÞü¶þ×
Ĭ¾ÿüÜġûĀÖċöīĪüñĎĂ
ĥÕÅĕµõÅÕĕĥąÅąĕąÕµÕ
0478/23/M/J/25
[4]
[Turn over
,
This pseudocode represents an algorithm.
© UCLES 2025
ĬÑĊ®Ġ´íÈõÏĪÅĊàú¶Ā×
Ĭ¾ÿùÜīĉĉáąíĤÌêĚġĦĂ
ĥĥĕĕõõÅõõÅõÅÅĕåÕåÕ
0478/23/M/J/25
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DECLARE Store : ARRAY[1:100] OF CHAR
DECLARE Word : STRING
DECLARE Index : INTEGER
DECLARE Letter : CHAR
INPUT Word
1 TO LENGTH(Word)
FOR Index
SUBSTRING(Word, Index, 1)
Letter
CASE OF Letter
""
'A' : Letter
""
'E' : Letter
""
'I' : Letter
""
'O' : Letter
""
'U' : Letter
ENDCASE
Letter
Store[Index]
NEXT Index
1 TO LENGTH(Word)
FOR Index
IF Store[Index] <> ""
THEN
OUTPUT Store[Index]
ENDIF
NEXT Index
DO NOT WRITE IN THIS MARGIN
6
DO NOT WRITE IN THIS MARGIN
8
,
DO NOT WRITE IN THIS MARGIN
* 0000800000008 *
9
,
,
(a) Complete the trace table for the algorithm, using input data: COMPUTER
Store[]
Word
Index
Letter
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
OUTPUT
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) Describe the processes in the algorithm.
DO NOT WRITE IN THIS MARGIN
[3]
© UCLES 2025
ĬÓĊ®Ġ´íÈõÏĪÅĊàü¶Ā×
Ĭ¾ĀúÔĝąùØóĄåĐÒ¾ġĖĂ
ĥĥĥÕµĕåĕĥµåÅÅõÅĕµÕ
0478/23/M/J/25
[Turn over
DO NOT WRITE IN THIS MARGIN
* 0000800000010 *
10
(a) Draw the symbol for a NOR logic gate and complete the truth table for it.
DO NOT WRITE IN THIS MARGIN
NOR logic gate symbol:
Truth table:
A
B
0
0
0
1
1
0
1
1
Z
[2]
(b) Consider the rules given in the following table:
Input
Binary value
L
M
S
Description
0
dark
1
light
0
no motion detected
1
motion detected
0
no sound detected
1
sound detected
A security system uses sensors to sound an alarm if an intruder is detected.
DO NOT WRITE IN THIS MARGIN
7
,
DO NOT WRITE IN THIS MARGIN
,
The alarm sounds if it is dark and if either motion or sound or both motion and sound are
detected.
© UCLES 2025
ĬÑĊ®Ġ´íÈõÏĪÅĊÝú¸þ×
Ĭ¾þùÑĩāďßþöÊèìîÙĎĂ
ĥµõÕõõĥõÕõõąÅµåÕĕÕ
0478/23/M/J/25
DO NOT WRITE IN THIS MARGIN
The alarm sounding is represented by the output A = 1.
11
,
(i)
,
Write the logic expression for the security system.
A =
[2]
(ii)
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000011 *
Complete the truth table for the security system.
L
M
S
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
A
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[4]
© UCLES 2025
ĬÓĊ®Ġ´íÈõÏĪÅĊÝü¸þ×
Ĭ¾ýúÙğýğÚüċÿôÔêÙĞĂ
ĥµąĕµĕąĕÅąåąÅÕÅĕąÕ
0478/23/M/J/25
[Turn over
The two-dimensional (2D) array Video[] is used to store, for each video item, the title, the format
of the video (4K Blu-ray disc, standard Blu-ray disc, DVD, or digital download), the year it was
released stored as a string and a storage code to represent where the video can be found in the
collection, for example:
Video[1,1]
Video[1,2]
Video[1,3]
Video[1,4]
is
is
is
is
"Macbeth"
"digital download"
"2015"
"DG276"
The two-dimensional (2D) array Results[] is used to store the results of a search to find a
specific video. The search uses the video title, and if the video is found, its data is copied from the
array Video[] to the array Results[]. The search continues and if other videos with the same
title are found, this data is also copied to the array Results[]. The search ends when the end of
the data is reached.
Write a program that meets the following requirements:
•
•
•
•
•
•
•
•
The video library array needs to be initialised with the null string (""), allowing for up to
10 000 records. The array Results[] must be initialised before every search with the null
string and must be able to hold up to 20 search results with the same title.
Create a menu to add a new video to the library to search for an existing video by title, or to
stop, with validation of the input.
When the user enters a new video, the following data is stored in the first available location of
the relevant array:
o video title
o format (4K Blu-ray disc, standard Blu-ray disc, DVD, digital download)
o year of release as string
o storage code.
Allow input of data for another video if required.
When searching for an existing video, if a match is found, transfer all the data for that video
into the array Results[], and continue to search until all videos with the same title have
been found.
Output the results from the array Results[]
If the video title is not found, output a suitable message.
The system returns to the menu after completing the input or the output, until the user
chooses to stop.
You must use pseudocode or program code and add comments to explain how your code works.
You do not need to declare any arrays, variables or constants. You may assume that this has
already been done.
DO NOT WRITE IN THIS MARGIN
A collector needs a video library system for a collection of videos stored on 4K Blu-ray discs,
standard Blu-ray discs, DVD, or as digital downloads.
DO NOT WRITE IN THIS MARGIN
8
,
DO NOT WRITE IN THIS MARGIN
12
,
DO NOT WRITE IN THIS MARGIN
* 0000800000012 *
© UCLES 2025
ĬÑĊ®Ġ´íÈõÏĪÅĊßú¸Ā×
Ĭ¾ýûÙĥïĪÝöĄĈÒðČÉĖĂ
ĥąÕĕõĕąµååÕąąÕĥĕĕÕ
0478/23/M/J/25
DO NOT WRITE IN THIS MARGIN
All inputs and outputs must contain suitable messages.
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
© UCLES 2025
ĬÓĊ®Ġ´íÈõÏĪÅĊßü¸Ā×
Ĭ¾þüÑģóĚÜĄíÁĆĈÐÉĦĂ
ĥąåÕµõĥÕµÕąąąµąÕąÕ
0478/23/M/J/25
[Turn over
14
,
,
DO NOT WRITE IN THIS MARGIN
* 0000800000014 *
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[15]
© UCLES 2025
ĬÍĊ®Ġ´íÈõÏĪÅĊàûµĂ×
Ĭ¾ýúÔĝĀĢêĆúĞêÍÜùĞĂ
ĥååĕõĕåõÕÅąÅÅõåĕÕÕ
0478/23/M/J/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
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000015 *
,
© UCLES 2025
,
15
BLANK PAGE
ĬÏĊ®Ġ´íÈõÏĪÅĊàùµĂ×
Ĭ¾þùÜīĄĒÏôćëîåĀùĎĂ
ĥåÕÕµõÅĕŵÕÅÅĕÅÕÅÕ
0478/23/M/J/25
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/M/J/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
* 0000800000016 *