Past paper – A Level Computer Science (9618)
Cambridge International AS & A Level · 9618
Computer Science · Paper 21
May/June 2026 · 9618/21/M/J/26
Answer on paper, open each mark scheme and give yourself marks, then open the Summary.
Question text
1
Study this pseudocode:
3 TO 12 STEP 3
FOR i
OUTPUT i, i * i
NEXT i
(a) Identify the type of construct used in this pseudocode.
… [1]
(b) State how many iterations are performed by this pseudocode.
… [1]
© Cambridge University Press & Assessment 2026
Question text
2
A washing machine contains:
•
two trays for the washing powder
•
a user interface display
•
five sensors.
The washing machine control program includes the following variables:
variable
description
MainsOn
TRUE when the mains power is on
WaterOn
TRUE when the water supply to the machine is turned on
DisplayOn
TRUE when the user interface display is active
Tray1
TRUE when it detects washing powder in tray 1
Tray2
TRUE when it detects washing powder in tray 2
(a) (i)
Identify the data type used for the five variables.
… [1]
(ii)
The display is only active when both the mains power is on and the water supply is
turned on.
Complete the pseudocode statement.
…
DisplayOn
[1]
(iii)
The washing machine control program will start when a new variable WashStart is
assigned the value TRUE
WashStart is assigned the value TRUE when the mains power is switched on and
there is washing powder in tray 1 or tray 2 or both trays.
Write the pseudocode statement for the given description.
…
… [3]
© Cambridge University Press & Assessment 2026
,
,
(b) The user will select from three possible wash options.
The pseudocode for the washing machine program contains a procedure WashCycle()
PROCEDURE WashCycle()
// declaration of variables has been omitted
// TimeSoFar is a global variable which changes
// as the procedure is executed
FALSE
Finished
0.0
TimeSoFar
OUTPUT "Option (1/2/3)"
INPUT OptionNumber
CASE OF OptionNumber:
// WashTime is the total wash time in minutes
60
1 : WashTime
90
2 : WashTime
120
3 : WashTime
ENDCASE
WHILE Finished = FALSE
WashTime – INT(TimeSoFar)
TimeRemaining
ENDWHILE
ENDPROCEDURE
(i)
The programmer uses an Integrated Development Environment (IDE) to develop and
run the washing machine program.
State the IDE feature to display the current value for any variable during the execution
of the program.
… [1]
© Cambridge University Press & Assessment 2026
,
,
(ii)
When option 3 is selected, the programmer interrupts execution when the TimeSoFar
is 17.6 minutes.
State the current value for TimeRemaining
… [1]
© Cambridge University Press & Assessment 2026
Question text
3
A business operates five call centres. The software currently in use in each call centre is to be
replaced; a new system will be developed by a software company.
(a) The analysis stage included a feasibility study.
State three other activities carried out during the analysis stage.
1 …
…
2 …
…
3 …
…
[3]
(b) The analysis stage has ended.
Complete the statements about the development of the new system.
Before any programming is started, the … stage for the
proposed new system must be completed.
For this large project, the tasks will be broken down into several
… ; each will be coded by a different programming team.
Once each team has completed its work, … testing must be
carried out.
Before the new system is delivered to the business, … testing
will be carried out in-house.
It is decided to install the software initially in only one of the call centres where
… testing will be carried out.
The new software is finally rolled out to all five call centres. In the first week of its use, staff
report that the software still requires extra features which were not originally agreed. The
software is withdrawn until … maintenance is completed.
[6]
© Cambridge University Press & Assessment 2026
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
5
Electric light bulbs are advertised online with the price showing:
$1.75 each or 20 bulbs for $30.00
A pseudocode function BulbCost()
•
takes the quantity of bulbs purchased as its single parameter
•
returns the total cost in dollars.
Pseudocode for the main program:
•
inputs the number of bulbs purchased
•
returns the total cost from the function BulbCost()
•
outputs the total cost.
(a) Write pseudocode for the function BulbCost()
…
…
…
…
…
…
…
…
…
… [4]
(b) The main program accepts a user input for the quantity of bulbs purchased and calls
function BulbCost()
Complete the pseudocode for the main program.
// Main program
DECLARE NumberPurchased : INTEGER
DECLARE TotalCost : REAL
OUTPUT "How many bulbs? "
INPUT NumberPurchased
…
TotalCost
OUTPUT '$' , TotalCost
// end main program
[1]
© Cambridge University Press & Assessment 2026
,
,
© Cambridge University Press & Assessment 2026
Question text
6
Fence parts are manufactured by a number of similar machines. The length of the part must fall
within a certain range. Parts not within the length range are rejected.
The data for each rejected part forms a data packet made up of three data items, each separated
by the ‘/’ character delimiter. The format of a data packet is:
<length>/<machine ID>/<description of the fault>
•
The length is 3 digits (in millimetres).
•
The machine ID is a single character (‘A’, ‘B’, or ‘C’).
•
The description of the fault is a variable length string.
A pseudocode program will process the data for several data packets.
The program contains the statement:
"563/B/the fence length is too long"
DataPacket
(a) Complete the two pseudocode expressions which extract the appropriate data item.
…
PartLength
…
MachineID
[2]
(b) The program will create a module RejectDescription() to return the fault description.
Write the pseudocode for the module RejectDescription()
…
…
…
…
…
… [4]
© Cambridge University Press & Assessment 2026
,
,
(c) The data packets for all rejected parts are saved in this format in a text file Rejects.txt.
The file stores one data packet per line.
Write pseudocode to:
•
find all the rejected parts with a length greater than 560 millimetres and that were
produced on machine ‘B’ or machine ‘C’
•
output the description for each matching rejected part.
Your pseudocode will include a module call to RejectDescription() and the answers
given for 6(a).
…
…
…
…
…
…
…
…
…
…
Question text
7
Different data structures will be suitable for different computing applications.
(a) (i)
Identify a computing application where a queue data structure is suitable.
…
… [1]
(ii)
Justify why a queue is suitable for your application identified in 7(a)(i).
…
…
… [2]
(b) A programmer designs a circular queue.
•
The data items are stored in a 1D array, MyQueue
•
The queue is managed using two pointers.
The diagram shows the circular queue populated with four items.
MyQueue
"PIG"
Front
1
"DOG"
2
"RAT"
3
"SPIDER"
Rear
4
5
6
7
8
(i)
Write three pseudocode declaration statements to implement this circular queue.
1 …
2 …
3 …
[2]
© Cambridge University Press & Assessment 2026
,
,
(ii)
Two program modules are available to add and remove items to and from the queue.
module
description
EnQueue(<value>)
when <value> is added to the queue
DeQueue()
when an item is removed from the queue
Complete the state of MyQueue after the following sequence of changes:
•
DeQueue()
•
EnQueue("HORSE")
•
EnQueue("CAT")
MyQueue
1
2
3
4
5
6
7
8
[2]
© Cambridge University Press & Assessment 2026
,
,
(iii)
On a different occasion, the state of MyQueue is:
MyQueue
1
2
3
Front
"LION"
4
"GIRAFFE"
5
"TIGER"
6
"ANT"
Rear
7
8
Complete the state of MyQueue after the following sequence of changes:
•
EnQueue("GERBIL")
•
EnQueue("MONKEY")
•
EnQueue("SNAKE")
•
DeQueue()
MyQueue
1
2
3
4
5
6
7
8
[2]
© Cambridge University Press & Assessment 2026
,
,
(c) MyQueue will be initially empty.
Write a pseudocode procedure InitialiseQueue() to set up the empty MyQueue, using
a loop.
The initial array contents will be set to empty strings.
You are not required to repeat the declaration statements in 7(b)(i).
PROCEDURE InitialiseQueue()
…
…
…
…
…
…
…
ENDPROCEDURE
[3]
© Cambridge University Press & Assessment 2026
9618/2
Question text
8
Global array MyData contains the values shown.
Study the pseudocode algorithm and array MyData
FUNCTION MyTrace(Target : INTEGER) RETURNS INTEGER
DECLARE LeftPointer, RightPointer, MidPointer : INTEGER
1
LeftPointer
MyData
RightPointer
15
WHILE LeftPointer <= RightPointer
2
1
MidPointer
(LeftPointer + RightPointer) DIV 2
8
2
IF MyData[MidPointer] = Target THEN
9
3
OUTPUT "Found " & NUM_TO_STR(MidPointer)
12
4
RETURN MidPointer
13
5
ELSE
15
6
IF Target > MyData[MidPointer] THEN
18
7
LeftPointer
MidPointer + 1
19
8
ELSE
20
9
RightPointer
MidPointer - 1
23
10
ENDIF
25
ENDIF
11
ENDWHILE
26
12
OUTPUT "Not found"
39
13
RETURN -1
38
14
ENDFUNCTION
40
15
© Cambridge University Press & Assessment 2026
,
,
(a) Complete the trace table for the function MyTrace when the following pseudocode
statement is executed.
MyTrace(15)
Result
LeftPointer
RightPointer
MidPointer
[4]
(b) Give the output.
… [1]
(c) Give the value assigned to Result
… [1]
Question text
9
A hotel has three floors numbered 0 to 2 (floor 0 is the ground floor). There are 15 rooms on
each floor.
The hotel gets many enquiries from customers to check if a room is available that day.
The availability data for that day is stored in a 2D array Version1
•
The first index is the floor number.
•
The second index is the room number.
•
On each of the three floors, the room numbers are 1 to 15.
Each cell of the array stores either:
•
‘A’ – the room is available
•
‘B’ – the room is already booked.
(a) Write the declaration statement for the 2D array Version1
… [2]
© Cambridge University Press & Assessment 2026
,
,
(b) An enquiry program will:
•
input a floor number
•
output all room numbers that are available on that floor
•
output the number of rooms that are available.
The output must be in the format shown in the two examples.
A wheelchair user makes an enquiry. She requires a room on the ground floor only.
Example program outputs:
Floor number: 0
0 room(s) available
There are no available rooms on
the ground floor.
Floor number: 0
Shows two rooms available on the
7
ground floor:
11
2 room(s) available
• rooms 7 and 11.
© Cambridge University Press & Assessment 2026
,
,
Write pseudocode for this enquiry program.
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
© Cambridge University Press & Assessment 2026
,
,
(c) Customers are becoming more selective with their enquiries when searching for an
available room.
A new program design is required. It will create a record to define the data for a room.
Each room:
•
may have a sea view
•
is classified as: single room (‘S’), double room (‘D’) or family room (‘F’)
•
is either standard (‘ST’) or deluxe (‘DL’).
(i)
Complete the pseudocode.
TYPE RoomData
…