Programming – IGCSE Computer Science (0478)

36 questions · page 1 of 3 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
1
0478/22/F/M/26 · Question 1Feb/March 2026Paper 221 marks
Loading question…
Question text

1
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
0478/22/F/M/26 · Question 4Feb/March 2026Paper 221 marks
Loading question…
Question text

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
,
,
© Cambridge University Press & Assessment 2026

3
0478/22/F/M/26 · Question 5Feb/March 2026Paper 2211 marks
Loading question…
Question text

5
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
// The array Names[] has already been declared as
02
// ARRAY[1:200, 1:2] OF STRING and it is already populated
03
DECLARE Row : STRING
04
DECLARE Temp1 : STRING
05
DECLARE Temp2 : STRING
06
DECLARE Swap : BOOLEAN
FALSE
07
Swap
08
WHILE NOT Swap DO
FALSE
09
Swap
2 TO 199
10
FOR Row
11
IF Names[Row, 1] > Names[Row + 1, 1]
12
THEN
Names[Row, 1]
13
Temp1
Names[Row, 2]
14
Temp2
Names[Row + 1, 1]
15
Names[Row, 1]
Names[Row + 1, 2]
16
Names[Row, 1]
Temp1
17
Names[Row + 1, 1]
Temp2
18
Names[Row + 1, 2]
FALSE
19
Swap
20
ENDIF
21
NEXT Column
22
ENDWHILE
(a) Identify the line numbers of five errors in the pseudocode and suggest corrections.
error 1 line number …
correction …
…
error 2 line number …
correction …
…
error 3 line number …
correction …
…
error 4 line number …
correction …
…
© Cambridge University Press & Assessment 2026
,
,
error 5 line number …
correction …
…
[5]
(b) Write the pseudocode for an algorithm, using nested iteration, to output the contents
of Names[]
…
…
…
…
…
…
…
… [4]
(c) Describe a po

Advertisement
4
0478/22/F/M/26 · Question 6Feb/March 2026Paper 2211 marks
Loading question…
Question text

6
This flowchart represents an algorithm.
START
INPUT
Sentence
SentLength
LENGTH(Sentence)
LetterNo
1
Start
1
IS
Yes
SUBSTRING(Sentence,
LetterNo, 1) = " "
?
Word
SUBSTRING(Sentence,
Start, LetterNo – Start)
No
OUTPUT Word, " ",
LENGTH(Word)
Start
LetterNo + 1
LetterNo
LetterNo + 1
Yes
Word
SUBSTRING(Sentence,
No
IS LetterNo =
Start, LetterNo – Start + 1)
SentLength ?
OUTPUT Word, " ",
LENGTH(Word)
STOP
© Cambridge University Press & Assessment 2026
,
,
(a) Complete the trace table for the algorithm, using the given sentence.
Note: the start position of the sentence is index 1.
Sentence
SentLength
LetterNo
Start
Word
OUTPUT
Computing is fun
16
[5]
(b) Explain the purpose of the algorithm shown by the flowchart.
…
…
…
…
…
… [3]
© Cambridge University Press & Assessment 2026
,
,
(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.
…
…
…
…
…
… [3]
© Cambridge University Press & Assessment 2026

5
0478/22/F/M/26 · Question 9Feb/March 2026Paper 2215 marks
Loading question…
Question text

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.
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.
Write a program for the following requirements:
•
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.
…
…
…
…
…
…
…
…
…
…
…
…
© Cambridge University Press & Assessment 2026
,
,
…
…
…
…

6
0478/22/F/M/25 · Question 2Feb/March 2025Paper 221 marks
Loading question…
Question text

2
Tick (✓) one box to complete this sentence.
The pseudocode to store a hotel name held in the variable Name to a text file is
A
READFILE Hotels.txt, Name
B
WRITEFILE Hotels.txt, Name
C
WRITEFILE Name, Hotels.txt
D
STOREFILE Hotels.txt, Name
[1]

7
0478/22/F/M/25 · Question 5Feb/March 2025Paper 226 marks
Loading question…
Question text

5
A program is written to only accept data that contains more than 9 characters. The program needs
to be tested. The table, when completed, shows appropriate test data that matches the type of test
data and the purpose of the test data.
Complete the table by inserting the missing information.
Test data
Type of test data
Purpose of test data
…
ABC
…
…
Boundary
…
to make sure that the program accepts data
that is an appropriate length
[6]

8
0478/22/F/M/25 · Question 6Feb/March 2025Paper 2211 marks
Loading question…
Question text

6
This pseudocode algorithm is intended to allow 1000 positive integers to be input and stored in
a one-dimensional (1D) array. The integers are added together as they are input and the highest
value is identified. At the end of the algorithm, the highest number, the total and the average of the
numbers are output.
01
DECLARE Numbers : ARRAY[1:1000] OF INTEGER
02
DECLARE Highest : STRING
03
DECLARE Count : INTEGER
04
DECLARE Total : INTEGER
←
1500
05
Highest
←
0
06
Total
←
1 TO 1000
07
FOR Count
08
INPUT Numbers[Count]
←
Total + Count
09
Total
10
IF Numbers[Count] > Total
11
THEN
←
Numbers[Count]
12
Highest
13
ENDIF
14
NEXT Count
15
OUTPUT "The highest number is ", Highest
16
OUTPUT "The total is ", Total
17
OUTPUT "The average is ", Average / 1000
(a) Identify the line numbers of five 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 …
…
Error 5 line number …
Correction …
…
[5]
(b) Write the pseudocode statement to output the average of the numbers, rounded to two
decimal places.
…
… [2]
(c) Explain how you could change the corrected algorithm so that it also finds the smallest
number that was input and outputs its value at the end.
Any code used must be fully explained.
…
…
…

Advertisement
9
0478/22/F/M/25 · Question 7Feb/March 2025Paper 2210 marks
Loading question…
Question text

7
This flowchart represents an algorithm.
START
OUTPUT
"Continue?"
INPUT Answer
No
Yes
IS Answer =
'Y' ?
INPUT
Value1
STOP
INPUT
Operator
INPUT
Yes
IS Operator =
Value2
'A' ?
OUTPUT
Value1 +
No
Value2
Yes
IS Operator =
'S' ?
OUTPUT
Value1 –
No
Value2
Yes
No
IS Operator =
'M' ?
OUTPUT
OUTPUT
Value1 *
Value1 /
Value2
Value2
ĬÑĊ®Ġ´íÈõÏĪÅĊàùµþ×
,
,
(a) Complete the trace table for the input data:
Y, 7, S, 9, Y, 5, M, 12, Y, 25, D, 5, N, 10, A, 6
Answer
Value1
Operator
Value2
OUTPUT
[5]
(b) State the purpose of the algorithm on page 6.
… [1]
(c) There are problems with the given algorithm. If the lower-case letter ‘y’ is entered for Answer,
the algorithm stops and if a lower-case letter is entered for Operator, the algorithm gives an
incorrect output.
(i)
Explain how you would change the algorithm to prevent the problems described.
…
…
…
…
…
… [3]
(ii)
Identify one more error related to inputs when the algorithm is run.
…
… [1]
ĬÓĊ®Ġ´íÈõÏĪÅĊàûµþ×

10
0478/22/F/M/25 · Question 10Feb/March 2025Paper 2215 marks
Loading question…
Question text

10 A sports club uses a six-character alphanumeric membership code to identify each member of the
club.
The one-dimensional (1D) array MemberID[] is used to store the unique membership codes for
club members.
The two-dimensional (2D) array Name[] is used to store the names of the club members. The first
and last name of each member will be stored in separate array elements.
The system can store details for a maximum of 1000 members.
The position of any member’s data is the same in both arrays. For example, the data in index 2 of
MemberID[] belongs to the member in index 2 of Name[]
The variable NewID is used to input a new membership code.
Write a program that meets the following requirements:
•
Provide a menu that offers the choices: inputting a new member, outputting a list of
membership codes and first and last names, or stopping.
•
Input and validate a response to the menu.
•
When inputting a new member, input a new membership code and check that it contains six
characters:
○ If the new code is six characters, check it against all the previously stored membership
codes to make sure it is unique.
○ If the code is not unique, a new code must be entered and checked.
○ If the code is unique, it is stored in the first available space in the appropriate array
and the new member is required to enter their first name and last name, which are also
stored in the corresponding location of the appropriate array.
•
When outputting a list of membership codes and names, output for each member: their
membership code, first name and last name.
•
The program will continue until the stop option on the menu is selected.
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; assume this has already been
done.
You do not need to initialise the data in the arrays.
You do need to initialise any variables or constants used if appropriate.
All inputs and outputs must contain suitable messages.
…
…
…
…
…
…
…
ĬÑĊ®Ġ´íÈõÏĪÅĊÝù·Ā×
,
,
…
…
…
…
…
…

11
0478/22/F/M/24 · Question 2Feb/March 2024Paper 228 marks
Loading question…
Question text

2
(a) Four test data types and five descriptions are shown.
Draw one line to link each test data type to its most appropriate description.
Test data type
Description
abnormal
a value that is accepted
a value that is the highest or lowest value to be accepted and
the corresponding lowest or highest value to be rejected
boundary
a value that is the highest or lowest value to be rejected
extreme
a value that is rejected
a value that is the highest or lowest value to
be accepted
normal
[4]
(b) An algorithm has been written to test if an integer that is input is in the range 5 to 10 inclusive.
Identify an example of suitable test data for each test data type.
Abnormal …
…
Boundary …
…
Extreme …
…
Normal …
…
[4]

12
0478/22/F/M/24 · Question 4Feb/March 2024Paper 223 marks
Loading question…
Question text

4
Identify three data types used in programming.
1 …
2 …
3 …
[3]

13
0478/22/F/M/24 · Question 6Feb/March 2024Paper 224 marks
Loading question…
Question text

6
Describe two types of iteration that a programmer can use whilst writing a program.
…
…
…
…
…
…
…
… [4]

Advertisement
14
0478/22/F/M/24 · Question 10Feb/March 2024Paper 226 marks
Loading question…
Question text

10 A programmer has written a program that will be maintained by another programmer.
Explain how the program can be written to make sure it can be easily maintained by the other
programmer.
…
…
…
…
…
…
…
…
…
…
…
… [6]

15
0478/22/F/M/24 · Question 11Feb/March 2024Paper 2215 marks
Loading question…
Question text

11
Students in a class are recording the amount of time in minutes spent in front of a screen for each
day of the week.
The one-dimensional (1D) array StudentName[] contains the names of the students in the class.
The two-dimensional (2D) array ScreenTime[] is used to input the number of minutes on each
day spent in front of a screen.
The position of each student’s data in the two arrays is the same. For example, the student stored
at index 10 in StudentName[] and ScreenTime[] is the same.
The variable ClassSize contains the number of students in the class.
Write a program that meets these requirements:
•
allows all the students to enter their daily minutes of screen times for the past week
•
calculates the total number of minutes of screen time for each student in the week
•
counts, for each student, the number of days with more than 300 minutes of screen time
•
calculates the average weekly minutes of screen time for the whole class
•
finds the student with the lowest weekly minutes of screen time
•
outputs for each student:
–
name
–
total week’s screen time in hours and minutes
–
number of days with more than 300 minutes of screen time
•
outputs the average weekly minutes of screen time for the whole class
•
outputs the name of the student with the lowest weekly screen time.
You must use pseudocode or program code and add comments to explain how your code works.
All inputs and outputs must contain suitable messages.
Assume that the array StudentName[] and the variable ClassSize already contain the
required data.
You do not need to declare any arrays or variables; you may assume that this has already been
done.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…

Advertisement