Algorithm design and problem-solving – IGCSE Computer Science (0478)

199 questions · page 2 of 14 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
16
0478/21/O/N/25 · Question 9Oct/Nov 2025Paper 214 marks
Loading question…
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]

17
0478/22/O/N/25 · Question 3Oct/Nov 2025Paper 226 marks
Loading question…
Question text

3
A program is written that will only accept values between –99.99 and +99.99, inclusive.
The program is to be tested.
The table, when completed, shows appropriate test data that matches the type of test data and
purpose of the test data.
Complete the table by inserting the missing information.
Test data
Type of test data
Purpose of test data
…
0
…
…
boundary
…
to make sure that the program rejects data that is
outside acceptable limits
[6]
ĬÍĊ®Ġ´íÈõÏĪÅĊàú·Ā×

18
0478/23/O/N/25 · Question 5Oct/Nov 2025Paper 236 marks
Loading question…
Question text

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.
900
01
Lowest
1
02
Highest
1 TO 5
03
FOR Count
04
INPUT Number
05
IF Number < Lowest
06
THEN
Number
07
Lowest
08
ELSE
09
IF Number > Highest
10
THEN
Number
11
Highest
12
ENDIF
13
ENDIF
14
NEXT Count
(a) Complete the trace table for the algorithm using the following numbers:
563, 21, 376, 99, 400
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.
Reason …
…
Correction …
…
[2]
ĬÏĊ®Ġ´íÈõÏĪÅĊÞü¸Ā×

Advertisement
19
0478/23/O/N/25 · Question 6Oct/Nov 2025Paper 239 marks
Loading question…
Question text

6
The flowchart represents an algorithm.
START
Position
–1
Count
1
INPUT Name
IS Name =
Yes
Position
Count
ClassList[Count]
?
No
Count
Count + 1
No
IS Count
> 5 ?
Yes
OUTPUT
Position
STOP
ĬÑĊ®Ġ´íÈõÏĪÅĊßüµþ×
,
,
(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]
(b) Identify the standard method of solution used by the flowchart.
… [1]
(c) Write the algorithm in pseudocode.
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
ĬÓĊ®Ġ´íÈõÏĪÅĊßúµþ×

20
0478/23/O/N/25 · Question 7Oct/Nov 2025Paper 238 marks
Loading question…
Question text

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
DECLARE BinaryArray : ARRAY[1:8] OF INTEGER
02
DECLARE DenaryNumber : CHAR
03
OUTPUT "Please enter a whole number between 1 and 255 inclusive "
04
INPUT DenaryNumber
7 TO 1 STEP -1
05
FOR Count
MOD(DenaryNumber,3)
06
BinaryArray[Count]
DIV(DenaryNumber,2)
07
DenaryNumber
08
NEXT Count
(a) Identify the line numbers of the three 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 …
…
[3]
ĬÑĊ®Ġ´íÈõÏĪÅĊÝüµĀ×
,
,
(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.
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.
…
…
…
…
…
… [3]
ĬÓĊ®Ġ´íÈõÏĪÅĊÝúµĀ×

21
0478/21/M/J/25 · Question 1May/June 2025Paper 211 marks
Loading question…
Question text

1
Tick ( ü ) one box to identify the type of test to only check for the largest or smallest acceptable
value.
A
normal test data
B
abnormal test data
C
extreme test data
D
boundary test data
[1]

22
0478/21/M/J/25 · Question 2May/June 2025Paper 217 marks
Loading question…
Question text

2
Four requirements for validating inputs and five types of validation check are given.
(a) Draw one line from each requirement to the most appropriate validation check.
Not all validation checks will be used.
Requirement
Validation check
length check
Date of birth must be between
01/01/1900 and 01/01/2010.
format check
Name has been entered.
range check
Password has exactly 12 characters.
check digit
Student ID must contain 2 letters followed
by a 4-digit number.
presence check
[4]
(b) Identify and describe one verification check that could be applied when a new password is
input into a system.
Verification check …
Description …
…
…
…
[3]
ĬÍĊ®Ġ´íÈõÏĪÅĊßù·þ×

23
0478/21/M/J/25 · Question 10May/June 2025Paper 217 marks
Loading question…
Question text

10 The flowchart represents an algorithm to calculate grades.
START
INPUT
Score
IS Score
Yes
Grade
"C"
>= 40 ?
No
IS Score
Yes
Grade
"B"
>= 60 ?
No
IS Score
Yes
Grade
"A"
>= 80 ?
No
Grade
"D"
OUTPUT "You
achieved a ", Grade
STOP
ĬÑĊ®Ġ´íÈõÏĪÅĊßû¸þ×
,
,
(a) Complete the trace table for the algorithm, using the input data:
21, 46, 63, 91, 12
Score
Grade
OUTPUT
[3]
(b) Explain how the flowchart can be changed to produce the correct output.
…
…
…
…
…
…
…
… [4]
ĬÓĊ®Ġ´íÈõÏĪÅĊßù¸þ×

Advertisement
24
0478/22/M/J/25 · Question 1May/June 2025Paper 221 marks
Loading question…
Question text

1
Tick (✓) one box to complete the description of abstraction.
Abstraction is part of the analysis stage of the development life cycle. Abstraction means
A
testing the solution to the problem.
B
writing a program using program code.
C
defining the sub-systems that make up the problem.
D
removing details from the problem that are not relevant.
[1]

25
0478/22/M/J/25 · Question 2May/June 2025Paper 223 marks
Loading question…
Question text

2
A fence measuring 2 metres in height and 20 metres in length needs painting. The area of the
fence needs to be calculated so that enough paint for the job is purchased.
After the task is decomposed, there are three component parts: input, process and output.
Three component parts and four example descriptions are shown.
Draw one line from each component part to the most appropriate relevant description.
Not all descriptions will be used.
Component part
Description
the height of the fence
the length of the fence
process
The amount of paint required is
40 square metres.
output
the colour of the paint
input
The area of fence is calculated as
40 square metres.
[3]

26
0478/22/M/J/25 · Question 3May/June 2025Paper 224 marks
Loading question…
Question text

3
A range check is used to validate that the input temperature is an integer between –100 and 0,
inclusive.
Suggest suitable normal, abnormal, extreme and boundary test data to test if this validation check
is working correctly.
Normal test data …
Abnormal test data …
Extreme test data …
Boundary test data …
[4]
ĬÍĊ®Ġ´íÈõÏĪÅĊßû¸þ×

27
0478/22/M/J/25 · Question 4May/June 2025Paper 227 marks
Loading question…
Question text

4
(a) State one reason for using a verification check when inputting data.
…
… [1]
(b) Write the pseudocode for an algorithm to perform a double entry verification check, using the
following criteria:
•
Input 10 numbers and store them in the array Numbers[]
•
Input the same 10 numbers again; as each number is input, compare it with its
corresponding number in the array Numbers[]
◦
if the numbers match, move on to the next number
◦
if the numbers do not match, display both numbers and ask for the number to be
re-entered
◦
store the re-entered number in the corresponding array location and move on to the
next number.
•
When all the numbers have been checked, display a message to say the check has
been completed.
You do not need to declare any arrays or variables for this algorithm.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
ĬÏĊ®Ġ´íÈõÏĪÅĊßù¸þ×

28
0478/22/M/J/25 · Question 7May/June 2025Paper 2210 marks
Loading question…
Question text

7
The flowchart shows an algorithm that is used to input 50 numbers. Each number is stored in the
variable Value when it is input. Any number input that is less than or equal to –20 or greater than
or equal to 50 is rejected and re-input. The accepted numbers are added together as they are
entered and the total and average of these numbers are output at the end of the algorithm.
(a) Complete the flowchart.
START
0
Count
0
Total
Yes
No
No
Yes
STOP
[6]
ĬÑĊ®Ġ´íÈõÏĪÅĊÞùµĀ×
,
,
(b) Explain how you would alter the flowchart in 7(a) so that it will individually store each accepted
value as it is entered and then output all the numbers, one after the other, outside of the loop
that inputs values.
You may include program statements or flowchart symbols in your answer, but they must be
fully explained.
…
…
…
…
…
…
…
…
…
… [4]
ĬÓĊ®Ġ´íÈõÏĪÅĊÞûµĀ×

Advertisement
29
0478/23/M/J/25 · Question 1May/June 2025Paper 2310 marks
Loading question…
Question text

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.
START
PassCount
0
RejectCount
0
Yes
No
No
Yes
STOP
[6]
ĬÍĊ®Ġ´íÈõÏĪÅĊÝü·þ×
,
,
(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.
…
…
…
…
…
…
…
…
…
… [4]

30
0478/23/M/J/25 · Question 4May/June 2025Paper 2311 marks
Loading question…
Question text

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.
Abnormal test data …
Reason …
…
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.
…
…
…
…
…
…
…
…
…
… [5]
ĬÑĊ®Ġ´íÈõÏĪÅĊÞú¶þ×

Advertisement