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

200 questions · page 7 of 14

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
91
0478/22/F/M/23 · Question 5Feb/March 2023Paper 224 marks
Loading question…
Question text

5
A food ordering system is an example of a computer system that is made up of sub-systems.
The food ordering system:
•
allows the user to enter the details of the food they want to order and to pay for the order
•
displays food available as pictures or as a list.
Complete the structure diagram for the given parts of the food ordering system.
Food ordering system
[4]

92
0478/22/F/M/23 · Question 6Feb/March 2023Paper 225 marks
Loading question…
Question text

6
The energy efficiency of an electrical appliance is the percentage of useful energy out compared with
the total energy in.
An algorithm has been written in pseudocode to calculate the energy efficiency of an appliance.
Values for total energy in and useful energy out are input. The efficiency is calculated and output
as a percentage.
The entry of the number –1 for either value stops the algorithm.
01 REPEAT
02
OUTPUT "Enter total energy in "
03
INPUT TotalEnergyIn
04
OUTPUT "Enter useful energy out "
05
OUTPUT UsefulEnergyOut
06
IF TotalEnergyIn <> -1 AND UsefulEnergy <> -1
07
THEN
(UsefulEnergyOut / TotalEnergyIn) * 100
08
Efficiency
09
OUTPUT "Efficiency is ", Efficiency, "%"
10
ENDIF
11 UNTIL TotalEnergyIn <> -1 OR UsefulEnergyOut <> -1
(a) Identify the three errors in the pseudocode and suggest corrections.
Error 1 …
Correction …
…
Error 2 …
Correction …
…
Error 3 …
Correction …
…
[3]
(b) Write pseudocode to check for an efficiency of 92% or over for this appliance and to output
“A-rated” if the efficiency is 92% or over.
…
…
…
…
… [2]

93
0478/22/F/M/23 · Question 8Feb/March 2023Paper 227 marks
Loading question…
Question text

8
This flowchart represents an algorithm to find the average value of a number of sales.
START
NumberSales
0
Total
0
INPUT
SaleValue
IS
Yes
SaleValue
Average
Total / NumberSales
= 0?
No
OUTPUT
"Average sale
NumberSales
NumberSales + 1
value ", Average
Total
Total + SaleValue
STOP
(a) Complete the trace table using this data:
5.50, 3.40, 6.25, 3.85, –11.00, 0
NumberSales
Total
SaleValue
Average
OUTPUT
[4]
(b) Identify the error in the algorithm and describe how to correct it.
Error …
…
Correction …
…
…
…
[3]

Advertisement
94
0478/21/O/N/22 · Question 3Oct/Nov 2022Paper 219 marks
Loading question…
Question text

3
(a) A PIN (personal identification number) is input into a banking app by the user. Before the PIN
is accepted, the following validation checks are performed:
•
check 1 – each character must be a digit
•
check 2 – there must be exactly four digits
•
check 3 – the value of the PIN must be between 1000 and 9999 inclusive.
Describe each validation check.
Check 1 …
…
…
…
Check 2 …
…
…
…
Check 3 …
…
…
…
[6]
(b) The PIN can be changed by the user.
Describe how the new PIN could be verified before use.
…
…
…
…
…
… [3]
Question 4 starts on page 12.

95
0478/21/O/N/22 · Question 4Oct/Nov 2022Paper 217 marks
Loading question…
Question text

4
This algorithm makes sure that there are enough fresh bread rolls available for customers to buy.
START
Stock
50
Total
0
INPUT Sold
Yes
IS Sold =
OUTPUT Total
–1?
No
STOP
Stock
Stock – Sold
Yes
OUTPUT
IS Stock
"Add new stock"
< 20?
No
Total
Total + Sold
Stock
Stock + 50
(a) Complete the trace table for the algorithm using this input data:
24, 12, 6, 30, 12, 18, –1, 24
Sold
Stock
Total
OUTPUT
[4]
(b) Identify the problem that will occur if the input data starts with a value of 70.
Explain how you would correct this problem.
…
…
…
…
…
…
…
… [3]

96
0478/22/O/N/22 · Question 3Oct/Nov 2022Paper 223 marks
Loading question…
Question text

3
Describe the use of verification on input of data when entering a list of items in stock into a
database. Explain why verification is necessary.
…
…
…
…
…
… [3]

97
0478/22/O/N/22 · Question 4Oct/Nov 2022Paper 222 marks
Loading question…
Question text

4
Describe one type of test data that must be used to test if a program accepts valid input data.
…
…
…
… [2]

98
0478/23/O/N/22 · Question 3Oct/Nov 2022Paper 239 marks
Loading question…
Question text

3
A check digit is to be used to validate an identification number on input. The identification number
contains five digits and the check digit.
The check digit is calculated by adding up the first five digits, dividing by 10 and taking the
remainder.
For example, 5 + 1 + 2 + 4 + 3 divided by 10 gives a remainder of 5 so the six-digit
identification number would be 512435
(a) (i)
Calculate the check digit for 69321
…
… [1]
Working space …
…
…
(ii)
State which of these identification numbers have incorrect check digits.
A 123455
B 691400
C 722855
D 231200
…
… [2]
Working space …
…
…
(b) (i)
Describe an input error that would not be found using this check digit.
…
…
…
… [2]
(ii)
Describe a more suitable algorithm to calculate the check digit for this identification
number.
…
…
…
… [2]
(c) Identify two other validation checks that could be used when inputting this identification
number.
1 …
…
2 …
…
[2]

Advertisement
99
0478/23/O/N/22 · Question 4Oct/Nov 2022Paper 237 marks
Loading question…
Question text

4
This algorithm makes sure that there are enough wheelbarrows in stock.
START
Stock
10
Total
0
INPUT Sale
Yes
Is Sale =
OUTPUT Total
"N"?
No
STOP
Stock
Stock – 1
Yes
OUTPUT
Is Stock
"Add new stock"
< 5?
No
Total
Total + 1
Stock
Stock + 10
(a) Complete the trace table for the algorithm using this input data:
“Y”, “Y”, “Y”, “Y”, “Y”, “Y”, “N”
Sale
Stock
Total
OUTPUT
[4]
(b) Explain how you could extend the algorithm to allow for the sale of more than one wheelbarrow
at a time.
…
…
…
…
…
…
… [3]

100
0478/21/M/J/22 · Question 3May/June 2022Paper 214 marks
Loading question…
Question text

3
Give one piece of normal test data and one piece of erroneous test data that could be used to
validate the input of an email address.
State the reason for your choice in each case.
Normal test data …
…
Reason …
…
…
…
Erroneous test data …
…
Reason …
…
…
…
[4]

101
0478/21/M/J/22 · Question 4May/June 2022Paper 2110 marks
Loading question…
Question text

4
The flowchart shows an algorithm that should allow 60 test results to be entered into the variable
Score. Each test result is checked to see if it is 50 or more. If it is, the test result is assigned to the
Pass array. Otherwise, it is assigned to the Fail array.
(a) Complete this flowchart:
START
PassCount
0
FailCount
0
Count
0
Yes
No
Count
Count + 1
No
Yes
END
[6]
(b) Write a pseudocode routine that will check that each test result entered into the algorithm is
between 0 and 100 inclusive.
…
…
…
…
…
…
…
…
…
… [4]

102
0478/23/M/J/22 · Question 2May/June 2022Paper 234 marks
Loading question…
Question text

2
Tick (3) one or more boxes in each row to match the type(s) of test data to each description.
Types of test data
Description
Erroneous /
Boundary
Extreme
Normal
Abnormal
test data that is always on the limit of
acceptability
test data that is either on the limit of
acceptability or test data that is just
outside the limit of acceptability
test data that will always be rejected
test data that is within the limits of
acceptability
[4]

103
0478/23/M/J/22 · Question 5May/June 2022Paper 236 marks
Loading question…
Question text

5
The flowchart shows an algorithm that should:
•
allow 100 numbers to be entered into the variable Number
•
total the numbers as they are entered
•
output the total and average of the numbers after they have all been entered.
Complete this flowchart:
START
Total
0
Counter
0
No
Yes
END
[6]

Advertisement
104
0478/22/F/M/22 · Question 3Feb/March 2022Paper 224 marks
Loading question…
Question text

3
Four validation checks and five descriptions are shown.
Draw a line from each validation check to the most appropriate description.
Validation check
Description
checks that the data input is
between two values
length check
checks that the data input is
an integer
check digit
checks that the data input has
three digits
range check
checks that the data has
been input
type check
checks that the data input has
the correct digits
[4]

105
0478/22/F/M/22 · Question 4Feb/March 2022Paper 2212 marks
Loading question…
Question text

4
This flowchart inputs a whole number. The function INT returns the integer value of a number. For
example, INT (7.5) is 7
An input of -1 ends the routine.
START
INPUT Number
Yes
IS Number
END
= –1?
No
C
0
D
INT(Number/2)
IS
Yes
INT(Number/D)
= Number/D?
No
C
C + 1
D
D – 1
No
IS D =
1?
Yes
Yes
IS C =
0?
No
OUTPUT C
(a) Complete the trace table for the given algorithm using this input data:
7, 6, 5, 4, –1, 12, 34
Number
C
D
OUTPUT
[6]
(b) Describe the purpose of this algorithm.
…
…
…
… [2]
(c) (i)
Describe the problem that occurs if a whole number smaller than 4 and not equal to –1
is input.
…
…
…
… [2]
(ii)
Explain how to change the flowchart to prevent this problem occurring.
…
…
…
… [2]

Advertisement