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

200 questions · page 5 of 14

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
61
0478/23/M/J/24 · Question 6May/June 2024Paper 235 marks
Loading question…
Question text

6
A program is to be written that will accept integers that are between the values of 1 and 80
inclusive.
(a) Give examples of normal, abnormal and extreme test data that could be used to make sure
the program only accepts valid data.
Normal test data …
Abnormal test data …
Extreme test data …
[3]
(b) Describe what is meant by extreme test data.
…
…
…
… [2]

62
0478/22/F/M/24 · Question 1Feb/March 2024Paper 221 marks
Loading question…
Question text

1
Tick (✓) one box to show which task is part of the analysis stage of the program life cycle.
A
coding
B
decomposition
C
design
D
testing
[1]

63
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]

Advertisement
64
0478/22/F/M/24 · Question 3Feb/March 2024Paper 228 marks
Loading question…
Question text

3
A linear search and a bubble sort are standard methods of solution.
Fifty numbers are already stored in the array Values[1:50]
(a) Write an algorithm in pseudocode to input a number, MyNumber, and use a linear search to
test if that number is stored in the array. If the number is found in the array, the position in the
array is output. If the number is not found in the array, “Not found” is output.
…
…
…
…
…
…
…
…
…
…
…
…
… [4]
(b) Write an algorithm in pseudocode to sort the array Values[1:50] into ascending order
using a bubble sort.
…
…
…
…
…
…
…
…
…
…
…

65
0478/22/F/M/24 · Question 5Feb/March 2024Paper 2210 marks
Loading question…
Question text

5
An algorithm has been written in pseudocode to calculate the profit when an item is sold. Values
for cost price and selling price are input, the profit is calculated (selling price – cost price) and
output. The input of zero for either value stops the algorithm.
01 REPEAT
02
OUTPUT "Enter cost price "
03
INPUT Cost
04
OUTPUT "Enter selling price "
05
OUTPUT Sell
06
IF Cost <> 0 OR Sell <> 0
07
THEN
←
Sell - Cost
08
Profit
09
OUTPUT "Profit is ", Profit
10
NEXT
11 UNTIL Cost = 0 OR Sell = 0
(a) Identify the line numbers of three errors in the pseudocode and suggest corrections.
Error 1 line number …
Correction …
…
Error 2 line number …
Correction …
…
Error 3 line number …
Correction …
…
[3]
(b) This algorithm needs to be improved with a range check.
(i)
Write pseudocode to reject the input of values less than zero for variables Cost and
Sell
…
…
…
…
…
…
…
…
…
…
…
…
…
… [3]
(ii)
Des

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

8
This flowchart represents an algorithm to find the average size of groups of visitors to an attraction.
START
NumberGroups
0
Total
0
INPUT
GroupSize
IS
Yes
GroupSize
Average
DIV(Total, NumberGroups)
= 0?
No
OUTPUT
"Average group
NumberGroups
NumberGroups + 1
size ", Average
Total
Total + GroupSize
STOP
Complete the trace table using this data:
7, 10, 2, 8, 3, 9, 0, 6
NumberGroups
Total
GroupSize
Average
OUTPUT
[4]

67
0478/21/O/N/23 · Question 5Oct/Nov 2023Paper 217 marks
Loading question…
Question text

5
The first stage of the program development life cycle is analysis. Two of the tasks in analysis are
abstraction and decomposition.
(a)
Describe what is meant by abstraction.
…
…
…
… [2]
(b) Identify three of the component parts when a problem has been decomposed at the analysis
stage.
1 …
2 …
3 …
[3]
(c) Identify and describe one other stage of the program development life cycle.
…
…
…
… [2]

68
0478/21/O/N/23 · Question 8Oct/Nov 2023Paper 2116 marks
Loading question…
Question text

8
A programmer is designing an algorithm to calculate the cost of a length of rope.
The program requirements are:
•
input two values: the length of rope in metres Length and the cost of one metre Cost
•
perform a validation check on the length to ensure that the value is between 0.5 and 6.0
inclusive
•
calculate the price Price
•
output the price rounded to two decimal places.
Use the variable names given.
(a) State the name of the validation check.
… [1]
(b) Complete the flowchart for this algorithm.
START
STOP
[6]
(c) Give two different sets of test data for this algorithm and state the purpose of each set.
Set 1 …
Purpose …
…
…
Set 2 …
Purpose …
…
…
[4]
(d) Complete the headings for the trace table to show a dry-run for this algorithm.
You do not need to trace the algorithm.
… … … …
[3]
(e) Describe an improvement that should be made to the requirements for this algorithm.
…
…
…
… [2]

Advertisement
69
0478/22/O/N/23 · Question 1Oct/Nov 2023Paper 221 marks
Loading question…
Question text

1
Tick (✓) one box to complete the sentence.
Verification is used to make sure that a value entered
A
has not changed during input.
B
is an integer.
C
is correct.
D
is not a string.
[1]

70
0478/22/O/N/23 · Question 2Oct/Nov 2023Paper 227 marks
Loading question…
Question text

2
A type of validation check is a length check. Another type of validation check is used to make sure
that any date entered is in the dd/mm/yyyy style:
dd means day, mm means month and yyyy means year.
(a) State the type of validation check used.
… [1]
(b) Give one example of normal test data and one example of abnormal test data you should
use to make sure the check in part (a) is working properly.
State a reason for each of your choices of test data.
Normal …
Reason …
…
Abnormal …
Reason …
…
[4]
(c) Describe how a length check could be used with the date entered.
…
…
…
… [2]

71
0478/22/O/N/23 · Question 3Oct/Nov 2023Paper 228 marks
Loading question…
Question text

3
Four pseudocode statements and five pseudocode uses are shown.
(a) Draw one line to link each pseudocode statement to the most appropriate pseudocode use.
Not all pseudocode uses will be required.
Pseudocode use
Pseudocode statement
CALL Colour(NewColour)
counting
finding an average
Value
(A1 + A2 + A3) / 3
totalling
Loop1
Loop1 + 1
using a conditional statement
IF Count > 7 THEN X1
0
using a procedure
[4]
(b) A one‑dimensional (1D) array called Temperatures[] has 25 elements beginning at
index 1. It holds values that range between –20 and 100 inclusive.
Write a pseudocode algorithm using a single loop to find the lowest value in this array and
output the result only once.
You do not need to declare or populate this array.
…
…
…
…
…
…
…
…
…
…
…
… [4]

72
0478/22/O/N/23 · Question 6Oct/Nov 2023Paper 227 marks
Loading question…
Question text

6
The flowchart represents an algorithm that performs a process on groups of values that are input.
The algorithm will fail if the first value of any group is 0.
An input of –1 will terminate the algorithm.
START
Total
0
OUTPUT
"Average is ",
Average
Count
0
OUTPUT
INPUT
"Total is ",
Value
Total
IS
Yes
Value =
Average
Total / Count
0 ?
No
IS
Yes
STOP
Value =
–1 ?
No
Total
Total + Value
Count
Count + 1
(a) Complete the trace table for the input data:
25, 35, 3, 0, 57, 20, 25, 18, 0, –1, 307, 40, 0
Value
Average
Total
Count
OUTPUT
[5]
(b) Describe the purpose of the algorithm.
…
…
…
… [2]

73
0478/23/O/N/23 · Question 1Oct/Nov 2023Paper 231 marks
Loading question…
Question text

1
Tick (3) one box to show which term is an example of a verification check.
A
Double entry check
B
Format check
C
Length check
D
Presence check
[1]

Advertisement
74
0478/23/O/N/23 · Question 3Oct/Nov 2023Paper 236 marks
Loading question…
Question text

3
(a) Four pseudocode descriptions and five pseudocode keywords are shown.
Draw one line to link each pseudocode description to the most appropriate pseudocode
keyword. Not all pseudocode keywords will be used.
Pseudocode description
Pseudocode keyword
OUTPUT
stores data in a file
WRITE
retrieves data from a file
READ
displays data on a screen
OPEN
enters data from a keyboard
INPUT
[4]
(b) Give two reasons for storing data in a file.
1 …
…
2 …
…
[2]

75
0478/23/O/N/23 · Question 4Oct/Nov 2023Paper 239 marks
Loading question…
Question text

4
A programmer is writing a data entry program for booking theatre seats.
The programmer needs the program to accept only whole numbers that are greater than or equal
to one and less than or equal to six.
(a) Give the names of two validation checks that are required for this program.
1 …
2 …
[2]
(b) Complete this pseudocode to perform your two validation checks, using your answers given
in (a):
OUTPUT "Please enter the number of seats you want to book "
INPUT Seats
…
…
…
…
…
…
…
…
…
[5]
(c) Give one item of test data to use when testing this program.
State the reason for your choice of test data.
Test data …
Reason for choice …
…
[2]

Advertisement