Algorithm design and problem-solving – A Level Computer Science (9618)
Quick quiz: 10 random questions from this topic. Answer them all, then open the Summary.
Question text
4
An algorithm is expressed as:
•
A user inputs a sequence of integers.
•
The user will input value –1 to indicate there are no more integers to be input.
•
The program will calculate the total number of integers greater than 120.
•
Output the total number of integers greater than 120 after the –1 terminator is input.
Write a structured English description for this algorithm as a sequence of steps.
Do not include pseudocode statements in your description.
Your answer might not require all six steps shown.
step 1 …
…
step 2 …
…
step 3 …
…
step 4 …
…
step 5 …
…
step 6 …
…
[4]
© Cambridge University Press & Assessment 2026
Question text
1
A program uses many complex algorithms.
One algorithm is repeated in several places. The code for the algorithm is the same wherever it is
used, but the calculations within the algorithm may operate on different data.
The result of each calculation is used by the code that follows it.
It is decided to modify the program and implement the algorithm as a separate module.
(a) (i)
State two benefits of this modification to the existing program.
1 …
…
2 …
…
[2]
(ii)
Describe how the modification would be implemented.
…
…
…
…
…
…
…
… [3]
,
,
(b) Four of the expressions used in the program are represented by pseudocode in the table.
Complete each pseudocode expression with a function or operator so that it evaluates to the
value shown.
Any functions and operators used must be defined in the insert.
Pseudocode expression
Evaluates to
"and"
… ("Random", 2, 3)
15
5 + … (10/11/2023)
TRUE
… ("45000")
3
(20 … 3) + 1
[4]
Question text
2
(a) An algorithm will:
1.
input an integer value
2.
jump to step 6 if the value is zero
3.
sum and count the positive values
4.
sum and count the negative values
5.
repeat from step 1
6.
output the two sum values and the two count values.
Draw a program flowchart on the following page to represent the algorithm.
Note that variable declarations are not required in program flowcharts.
[5]
(b) A software company is working on a project to develop a website for a school.
The school principal has some ideas about the appearance of the website but is unclear
about all the details of the solution. The principal would like to see an initial version of the
website.
(i)
Identify a life cycle method that would be appropriate in this case.
Give a reason for your choice.
Life cycle method …
Reason …
…
…
…
[2]
(ii)
The website project has progressed to the design stage.
State three activities that will take place during the design stage of the program
development life cycle.
1 …
2 …
3 …
[3]
Question text
4
An algorithm is expressed as:
•
A user inputs a sequence of integer values.
•
The process will calculate the number of positive integers.
•
The user will input value 0 to indicate there are no more numbers to be input.
•
Output the number of positive integers after the terminating 0 is input.
Write a structured English description for this algorithm as a sequence of steps.
Do not include pseudocode statements in your description.
Your answer might not require all six steps shown.
step 1 …
…
step 2 …
…
step 3 …
…
step 4 …
…
step 5 …
…
step 6 …
…
[4]
© Cambridge University Press & Assessment 2026
Question text
3
Customers collect points every time they make a purchase at a store.
A program is used to manage the points system and the table lists some of the information stored
for one customer.
Information
Data type required
Name
String
Number of points collected
Integer
Date of birth
Date
(a) (i)
Identify a suitable structure for storing the information for one customer. Explain the
advantage of using this structure.
Structure …
Advantage …
…
…
…
…
…
[4]
(ii)
Describe a data structure that could be used to store the information for all customers.
…
… [2]
(b) Customers receive points depending on the amount they spend. The number of points
depends on the band that the amount falls into:
Band
Amount
Points
1
Less than $10
5 per whole dollar ($)
2
Between $10 and $100 inclusive
7 per whole dollar ($)
3
Over $100
10 per whole dollar ($)
For example, if the amount is $99.77, this amount is in band 2 and therefore the number of
points is 7 × 99, which is 693 points.
The algorithm to calculate the points from a given amount is expressed as follows:
•
work out the appropriate band
•
calculate and output the number of points.
Apply the process of stepwise refinement to increase the detail of the algorithm. Structure
your algorithm into a sequence of five steps that could be used to produce pseudocode.
Write the five steps.
1 …
…
…
2 …
…
…
3 …
…
…
4 …
Question text
1
A shop sells car accessories. A customer order is created if an item cannot be supplied from
current stock. A program is being developed to create and manage the customer orders.
(a) The following identifier table shows some of the data that will be stored for each order.
Complete the identifier table by adding meaningful variable names and appropriate data
types.
Example
Explanation
Variable name
Data type
value
"Mr Khan"
The name of the customer
3
The number of items in the order
TRUE
To indicate whether this is a new customer
15.75
The deposit paid by the customer
[4]
(b) Other variables in the program have example values as shown:
Variable
Example value
Total
124.00
DepRate
2.00
Description
"AB12345:Cleaning Brush (small)"
Complete the table by evaluating each expression using the example values.
Expression
Evaluates to
(Total * DepRate) + 1.5
RIGHT(Description, 7)
(LENGTH(Description) - 8) > 16
NUM_TO_STR(INT(DepRate * 10)) & '%'
[4]
(c) The data that needs to be stored for each customer order in part (a) is not all of the same
type.
Describe an effective way of storing this data for many customer orders while the program is
running.
…
…
…
…
…
… [3]
Question text
5
Each line of a text file contains data organised into fixed-length fields as shown:
<Field 1><Field 2><Field 3>
An algorithm is required to search for the first instance of a given value of Field 2 and, if found, to
output the corresponding values for Field 1 and Field 3.
Describe the algorithm needed.
Do not include pseudocode statements in your answer.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
Question text
2
Data is a global 1D array containing 30 elements of type STRING
An algorithm will output:
•
all non-blank elements (elements that do not contain an empty string)
•
the final total of the number of elements output.
Complete the program flowchart to represent the algorithm:
START
END
[5]
ĬÕĊ®Ġ´íÈõÏĪÅĊÝû¸Ā×
Question text
6
(a) An algorithm will:
•
output each integer value between 100 and 200 that ends with the digit 7, for example,
107
•
output a final count of the number of values that are output.
Write pseudocode for this algorithm.
Any variables used must be declared.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [5]
(b) Study the following pseudocode.
CASE OF MySwitch
'a'
1: ThisChar
'y'
2: ThisChar
'7'
3: ThisChar
'*'
OTHERWISE: ThisChar
ENDCASE
Write pseudocode with the same functionality without using a CASE structure.
…
…
…
…
…
…
…
…
…
Question text
1
A program will calculate the tax payable based on the cost of an item.
Calculations will occur at many places in the program and these involve the use of one of three tax
rates.
Tax rate values represent a percentage. For example, a tax rate value of 5.23 represents 5.23%.
In this case, the tax payable on an item costing $100 would be $5.23.
Tax rate values are used at several places within the program. One example is given in pseudocode
as follows:
←
HighRate
FALSE
CASE OF ItemCost
← 3.75
<= 50 : TaxRate
// tax rate of 3.75%
← 5.23
<= 200 : TaxRate
// tax rate of 5.23%
← 6.25
> 200 : TaxRate
// tax rate of 6.25%
← TRUE
HighRate
ENDCASE
←
* TaxRate // tax payable
TaxPayable
ItemCost
(a) The pseudocode contains a logical error.
Identify the error and suggest a correction.
Error …
…
Correction …
…
[2]
(b) During the design of the program, tax rate values have been used wherever they are needed
as shown in the pseudocode example above. Tax rates do not change while the program runs.
(i)
Identify a more appropriate way of representing the tax rate values in the final program.
… [1]
(ii)
Describe the benefits of your answer to part (b)(i) with reference to this program.
…
…
…
…
…
… [3]
ĬÕĊ®Ġ´íÈõÏĪÅĊÞü·þ×
,
,
(c) Give the appropriate data type for the variables in the following table, as used in the
pseudocode:
Variable name
Data type
HighRate
TaxPayable
[2]
(d) The final CASE condition (> 200) in the pseudocode example could be replaced with a
keyword.
Give the keyword.
… [1]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊÞú·þ×