Past paper – IGCSE Computer Science (0478)
Cambridge IGCSE · 0478
Computer Science · Paper 21
Oct/Nov 2025 · 0478/21/O/N/25
Answer on paper, open each mark scheme and give yourself marks, then open the Summary.
Question text
1
Four descriptions of structured query language (SQL) keywords and five SQL keywords are
given.
Draw one line from each description to its matching keyword.
Not all SQL keywords will be used.
Description
SQL keywords
ORDER BY
identifies the database table
COUNT
sets the condition
WHERE
sorts the results
SUM
returns the number of records
FROM
[4]
Question text
2
Identify three different types of test data that can be used to test a program.
1 …
2 …
3 …
[3]
Question text
3
Tick (✓) one box to identify the operator that returns the quotient of a calculation with the fractional
part discarded.
A
/
B
DIV
C
^
D
MOD
[1]
ĬÕĊ®Ġ´íÈõÏĪÅĊÝú¸þ×
Question text
4
(a) A restaurant offers a fixed priced menu. A meal for an adult costs $9.99 and a meal for a child
costs $6.99.
If there are 6 or more people at a table, a 15% discount is applied to the total cost of the
order.
Write an algorithm in pseudocode to:
•
input the number of adults and the number of children at a table
•
calculate the total cost of the order with the discount, if this applies
•
output the final cost of the order.
…
…
…
…
…
…
…
…
…
…
…
…
…
… [5]
(b) The final cost of the order after the discount may have more than 2 decimal places.
Write a pseudocode statement to set the final cost of the order to 2 decimal places.
You do not need to rewrite the whole algorithm.
…
… [2]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊÝü¸þ×
,
,
(c) The restaurant offers a discount on a meal if the person ordering is either a student or is 65
years or older. The discount (X = 1) can only be given if the amount of the order is $20.00 or
over.
a student
0
rule A
not a student
1
under 65 years old
0
rule B
65 years or older
1
under $20.00
0
rule C
$20.00 or over
1
(i)
Write the logic expression for this problem.
… [2]
(ii)
Draw a logic circuit for this logic expression.
Each logic gate must have a maximum of two inputs.
Do not simplify this logic expression.
A
B
X
C
[3]
(d) Draw the NAND logic gate symbol and complete the truth table for it.
NAND logic gate symbol:
Truth table:
A
B
X
0
0
0
1
1
0
1
1
[2]
ĬÕĊ®Ġ´íÈõÏĪÅĊßú¸Ā×
Question text
5
A hotel booking system is an example of a computer system that is made up of sub-systems.
The booking system:
•
allows the user to select the room type and the number of nights required
•
displays the types of rooms available to the user as pictures or as a list.
Complete the structure diagram for the given parts of the hotel booking system.
Hotel booking system
[4]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊßü¸Ā×
Question text
6
A check digit is one method to validate a 5-digit number.
The check digit for a 5-digit number is calculated as follows:
•
Each digit is multiplied by its position (the first digit on the left is in position 1).
•
The result of each multiplication is totalled.
•
MOD(Total, 11) is used to calculate the check digit.
•
If the result of the MOD function is 10, the check digit is ‘X’.
For example:
The calculation of the check digit for the 5-digit number 30475 is as follows:
Multiply each digit by its position and total the results:
(3 * 1) + (0 * 2) + (4 * 3) + (7 * 4) + (5 * 5) = 68
Calculate the check digit with MOD(Total, 11)
MOD(68, 11) = 2
The check digit for 30475 is 2
This pseudocode algorithm should calculate and output the check digit of a 5-digit number:
01
DECLARE Total : INTEGER
02
DECLARE Digit : INTEGER
03
DECLARE CheckDigit : CHAR
0
04
Total
1 TO 10
05
FOR Count
06
OUTPUT "Please enter digit ", Count
07
INPUT Digit
Total + (Digit / Count)
08
Total
09
NEXT Count
MOD(Total, 11)
10
CheckDigit
11
IF CheckDigit = 10
12
THEN
13
OUTPUT "The check digit is X"
14
ELSE
15
OUTPUT "The check digit is ", Count
16
ENDIF
ĬÙĊ®Ġ´íÈõÏĪÅĊÞüµþ×
,
,
(a) Identify the line numbers of the four errors in the pseudocode and suggest a correction for
each error.
Error 1 line number …
Correction …
…
Error 2 line number …
Correction …
…
Error 3 line number …
Correction …
…
Error 4 line number …
Correction …
…
[4]
(b) Explain how you could modify the pseudocode to validate that each input is a single digit.
Any code must be fully explained.
…
…
…
…
… [3]
(c) The 5-digit number needs to be entered as a single input.
Describe one verification method that could be applied to the input of the 5-digit number.
…
…
Question text
7
The flowchart represents an algorithm.
START
Count
0
INPUT Number
Value
Count * Number
IS Value <=
Count
Count + 1
Yes
100 ?
No
Count
Count - 1
OUTPUT Count
STOP
ĬÙĊ®Ġ´íÈõÏĪÅĊàüµĀ×
,
,
(a) Complete the tables, using the flowchart, for the given data:
Input data: 20
Count
Number
Value
Output
Input data: 110
Count
Number
Value
Output
[4]
ĬÛĊ®Ġ´íÈõÏĪÅĊàúµĀ×
,
,
(b) State the purpose of the algorithm on page 8. A copy of the algorithm is provided for you on
page 11.
…
… [1]
(c) State a suitable data type for the variable Count
… [1]
(d) Write the algorithm in pseudocode. A copy of the algorithm is provided for you on page 11.
…
…
…
…
…
…
…
…
… [4]
ĬÙĊ®Ġ´íÈõÏĪÅĊÝü·þ×
,
,
START
Count
0
INPUT Number
Value
Count * Number
IS Value <=
Count
Count + 1
Yes
100 ?
No
Count
Count - 1
OUTPUT Count
STOP
ĬÛĊ®Ġ´íÈõÏĪÅĊÝú·þ×
Question text
8
A school has set up a database table SchoolTrip to record details of students that will go on a
school trip.
StudentID
StudentName
ParentName
Permission
DateReceived
STU147
Amir
Mr Akar
True
03/03/2025
STU348
Filip
Mrs Johnson
True
04/03/2025
STU274
Matthew
Mr Smith
False
STU873
Jafar
Mr Al-Saigh
True
21/03/2025
STU221
Hussein
Mr Alkasab
True
28/02/2025
STU553
Julie
Mrs Jones
True
25/02/2025
STU213
Julie
Mr Smith
False
(a) State the reason why ParentName is not appropriate as the primary key.
… [1]
(b) Give the name of the field that should be the primary key.
… [1]
(c) The database only uses these data types:
•
text
•
character
•
Boolean
•
integer
•
real
•
date/time.
Complete the table to show the most appropriate data type for each field.
Each data type must be different.
Field
Data type
ParentName
Permission
DateReceived
[2]
(d) Complete the structured query language (SQL) statement to display only the names of the
students who do not have permission to go on the trip.
SELECT …
FROM …
WHERE …
[2]
ĬÙĊ®Ġ´íÈõÏĪÅĊßü·Ā×
Question text
9
A school stores all the students’ attendance data in a file called Attendance.txt
Write an algorithm in pseudocode to read a line of text from the file and store this line in the
variable StudentAttendance
…
…
…
…
…
… [4]
Question text
10 The variables Seconds and Minutes are used in a program. Seconds holds the number of
seconds as a whole number and Minutes holds the number of minutes as a whole number.
(a) Write pseudocode statements to declare the variables Seconds and Minutes
…
…
… [1]
(b) The procedure Time(TotalSeconds) takes the number of seconds as a parameter. The
procedure converts the value held in the parameter into minutes and seconds and outputs
the result.
Write this procedure in pseudocode.
…
…
…
…
…
…
…
… [4]
ĬÛĊ®Ġ´íÈõÏĪÅĊßú·Ā×
Question text
11
The scores for each competitor in an archery competition are recorded.
The one-dimensional (1D) array CompetitorName[] is used to store the names of the
competitors.
The maximum number of competitors is 30.
There are 10 rounds in the competition with a maximum score of 30 per round.
The two-dimensional (2D) array CompetitorScore[] stores the score in each of the 10 rounds
for each competitor.
The first index of the array CompetitorScore[] is the same as the index of the competitor in
CompetitorName[]
After the 10 rounds have been completed, the highest score and the lowest score for each
competitor are discarded.
The overall score for each competitor is the total of the remaining 8 scores (after discarding the
highest and lowest scores) .
A competitor with an overall score of 210 or more moves onto the next competition. A competitor
with an overall score between 180 and 209 inclusive becomes a reserve competitor. A competitor
with an overall score below 180 does not qualify.
Write a program that meets the following requirements:
•
inputs the total score (out of 30) for each competitor in each round
•
validates each input is between 0 and 30 inclusive
•
calculates the overall score for each competitor discarding the highest and lowest scores
•
outputs the name of each competitor and if they move onto the next competition, are a
reserve or do not qualify
•
calculates and outputs the number of competitors who:
◦
have qualified for the next competition
◦
are reserve competitors
◦
do not qualify.
You must use pseudocode or program code and add comments to explain how your code works.
You do not need to declare any arrays or variables; assume that this has already been done.
All inputs and outputs must contain suitable messages.
…
…
…
…
…
…
…
ĬÕĊ®Ġ´íÈõÏĪÅĊàù¶Ă×
,
,
…
…
…
…
…
…
…
…