Computer Science (9618) · May/June 2025 · Question paper 22
Cambridge Computer Science (9618) question paper for paper 22, May/June 2025 — 9618/22/M/J/25, file 9618_s25_qp_22.pdf.
Text of this paper
* 0000800000001 *
,
,
Cambridge International AS & A Level
¬W. 4mHuOªE_{5W
¬GqySomf~xI¥XY¤
¥5 uueU5EuE u UU
* 9 3 7 2 6 4 8 3 1 4 *
COMPUTER SCIENCE
Paper 2 Fundamental Problem‑solving and Programming Skills
9618/22
May/June 2025
2 hours
You must answer on the question paper.
You will need:
Insert (enclosed)
INSTRUCTIONS
●
Answer all questions.
●
Use a black or dark blue pen.
●
Write your name, centre number and candidate number in the boxes at the top of the page.
●
Write your answer to each question in the space provided.
●
Do not use an erasable pen or correction fluid.
●
Do not write on any bar codes.
●
You may use an HB pencil for any diagrams, graphs or rough working.
●
Calculators must not be used in this paper.
INFORMATION
●
The total mark for this paper is 75.
●
The number of marks for each question or part question is shown in brackets [ ].
●
No marks will be awarded for using brand names of software packages or hardware.
●
The insert contains all the resources referred to in the questions.
This document has 20 pages. Any blank pages are indicated.
DC (CJ) 342884/3
© UCLES 2025
[Turn over
2
,
,
Refer to the insert for the list of pseudocode functions and operators.
1
A program is being developed to control the production line in a factory.
(a) A number of different program life cycles are available for the development of a program.
(i)
Explain the need for different program development life cycles.
DO NOT WRITE IN THIS MARGIN
* 0000800000002 *
[1]
(ii)
Coding is a stage in a program development life cycle.
State one consideration that would influence the choice of programming language.
[1]
DO NOT WRITE IN THIS MARGIN
(i)
Give three reasons why adaptive maintenance may be required.
1
2
3
[3]
(ii)
As well as adaptive maintenance, other types of program maintenance may be needed.
DO NOT WRITE IN THIS MARGIN
(b) The program has been in use for a number of months and adaptive maintenance is required.
© UCLES 2025
ĬÕĊ®Ġ´íÈõÏĪÅĊÞù·þ×
ĬÇóúÒĪûěÍúüěñďĨġĬĂ
ĥĥĕĕµĕĥµąąåąąµĥĕµÕ
9618/22/M/J/25
DO NOT WRITE IN THIS MARGIN
[1]
DO NOT WRITE IN THIS MARGIN
Identify one other type of program maintenance.
DO NOT WRITE IN THIS MARGIN
* 0000800000003 *
3
,
,
(c) Pseudocode has been used to design modules for the program to control the production line.
The table shows four valid pseudocode expressions.
Complete the table by giving the data type of the evaluated expression.
Expression
Data type
DO NOT WRITE IN THIS MARGIN
RIGHT(MachineCode, 4)
Speed * 2.5
NOT Status
IS_NUM(Check)
[4]
(d) A global array Product is used as part of the pseudocode design being developed to control
the production line. Product is used to store the number of rejected items each day.
The following pseudocode statement is used to assign a value to an element of the array:
DO NOT WRITE IN THIS MARGIN
Product[x, y]
23
The lower and upper bound values are shown in the table:
Variable
Lower bound
Upper bound
x
0
99
y
0
9
(i)
State the number of dimensions of Product
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[1]
(ii)
State the total number of elements in array Product
[1]
(iii)
Give the pseudocode declaration for the array Product
[2]
© UCLES 2025
Ĭ×Ċ®Ġ´íÈõÏĪÅĊÞû·þ×
ĬÇôùÚĠ÷īìĀąÎåħ´ġĜĂ
ĥĥĥÕõõąÕĕõõąąÕąÕåÕ
9618/22/M/J/25
[Turn over
4
,
2
,
A program to calculate the pay of employees working for a company is being designed.
(a) Stepwise refinement has been used in the design of the program.
Describe stepwise refinement.
DO NOT WRITE IN THIS MARGIN
* 0000800000004 *
[2]
(b) One of the program modules used to calculate employees’ weekly bonus pay has been
completed. The amount of bonus pay they receive is based on the number of hours worked
and the value of sales made as shown in the table.
Bonus pay and value of sales are both in dollars.
Value of sales
Bonus pay
between 1 and 40 inclusive
2000 or less
0
between 1 and 40 inclusive
above 2000
50
above 40
2000 or less
10
above 40
above 2000
100
(i)
The module is tested using white‑box testing.
State two tests, using valid data, that can be used to test different paths through the
program.
DO NOT WRITE IN THIS MARGIN
Hours worked
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
Test one:
Hours worked
Value of sales
Bonus pay
Test two:
Hours worked
Bonus pay
© UCLES 2025
ĬÕĊ®Ġ´íÈõÏĪÅĊàù·Ā×
ĬÇôüÚĦąĞÏĂþÕćËĒñĤĂ
ĥÕµÕµõąõõÕąąÅÕåÕµÕ
9618/22/M/J/25
[2]
DO NOT WRITE IN THIS MARGIN
Value of sales
DO NOT WRITE IN THIS MARGIN
* 0000800000005 *
5
,
(ii)
,
The program to calculate pay uses a number of modules which are each called from
different places in the program.
The program is to be tested using stub testing before all the program modules have
been completed.
Describe stub testing.
DO NOT WRITE IN THIS MARGIN
[2]
(iii)
The program has been completed and compiles successfully.
The program is tested using black‑box testing.
Identify and describe one type of error that black‑box testing could detect.
DO NOT WRITE IN THIS MARGIN
Type of error
Description
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[2]
© UCLES 2025
Ĭ×Ċ®Ġ´íÈõÏĪÅĊàû·Ā×
ĬÇóûÒĤĉĎêøóĔÓ³ÆñĔĂ
ĥÕÅĕõĕĥĕĥåÕąÅµÅĕåÕ
9618/22/M/J/25
[Turn over
6
,
3
,
An algorithm is designed to generate and output two unique random integers. Each integer value
is between –10 and 10 inclusive.
If both integers output are negative, a third random integer between 30 and 35 inclusive will be
generated and output.
Write pseudocode for this algorithm.
DO NOT WRITE IN THIS MARGIN
* 0000800000006 *
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[8]
© UCLES 2025
ĬÙĊ®Ġ´íÈõÏĪÅĊÝû¶þ×
ĬÇôûÍĪġĘâóĂĩ³ËçÙĤĂ
ĥąĥĕõµĥµåÅõąąµĥÕõÕ
9618/22/M/J/25
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000007 *
7
,
4
,
An algorithm will:
•
•
•
•
input 100 integer values, one value at a time
store the first value input into the first location of the array Number
store the next input value in the next unused location of the array Number
output the contents of Number array in the opposite sequence to that in which the values
were input.
Variable declarations are not required.
START
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
Complete the program flowchart to represent the algorithm.
END
[6]
© UCLES 2025
ĬÛĊ®Ġ´íÈõÏĪÅĊÝù¶þ×
ĬÇóüÕĠĝĨ׹ïàħ³óÙĔĂ
ĥąĕÕµÕąÕµµåąąÕąĕĥÕ
9618/22/M/J/25
[Turn over
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
,
© UCLES 2025
ĬÙĊ®Ġ´íÈõÏĪÅĊßû¶Ā×
ĬÇóùÕĦďġäċøçÅďÑÉĬĂ
ĥµÅÕõÕąõÕĕÕąÅÕåĕõÕ
8
BLANK PAGE
9618/22/M/J/25
DO NOT WRITE IN THIS MARGIN
,
DO NOT WRITE IN THIS MARGIN
* 0000800000008 *
DO NOT WRITE IN THIS MARGIN
* 0000800000009 *
9
,
5
,
An automated digital camera system is used to take a sequence of pictures of animals in a garden.
During the design of the system, a state‑transition diagram is produced.
The table details the states in the automated digital camera system along with the events which
cause the states to change.
The system starts in standby mode. The sequence of pictures is taken when in active mode.
DO NOT WRITE IN THIS MARGIN
Current state
Event
Next state
standby mode
turn on
detect mode
detect mode
turn off
standby mode
detect mode
movement detected
active mode
active mode
20 seconds elapsed
sequence complete
active mode
turn off
standby mode
sequence complete
time saved
detect mode
start
standby mode
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
(a) Complete the state‑transition diagram for the automated digital camera system.
[4]
© UCLES 2025
ĬÛĊ®Ġ´íÈõÏĪÅĊßù¶Ā×
ĬÇôúÍĤēđÕíĉĢđħąÉĜĂ
ĥµµĕµµĥĕÅĥąąÅµÅÕĥÕ
9618/22/M/J/25
[Turn over
,
(b) At the end of each sequence of pictures, the time is saved as a string in the format
<HH><MM><SS> where:
•
•
•
HH represents the hours using two digits
MM represents the minutes using two digits
SS represents the seconds using two digits.
For example:
•
•
"081230" is stored to represent the time 8:12:30, in the morning
"152235" is stored to represent the time 15:22:35, in the afternoon.
Each string is stored on a new line in the text file TimeTaken.txt
An algorithm is required to process the content of the text file TimeTaken.txt once it has
been transferred to the computer.
For each hour when pictures are taken, output a suitable message showing the hour and the
total number of sequences of pictures taken within that hour.
DO NOT WRITE IN THIS MARGIN
10
,
DO NOT WRITE IN THIS MARGIN
* 0000800000010 *
Hour : 15
Hour : 18
Total : 32
Total : 1
Write pseudocode for this algorithm.
Assume the text file TimeTaken.txt contains at least one line.
DO NOT WRITE IN THIS MARGIN
Example outputs:
DO NOT WRITE IN THIS MARGIN
© UCLES 2025
ĬÙĊ®Ġ´íÈõÏĪÅĊÞû¸þ×
ĬÇòùÐĨė÷ÞĄïýéčµñĔĂ
ĥĥåĕõÕåõõåÕÅÅõåĕÅÕ
9618/22/M/J/25
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000011 *
11
,
,
DO NOT WRITE IN THIS MARGIN
[8]
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
© UCLES 2025
ĬÛĊ®Ġ´íÈõÏĪÅĊÞù¸þ×
ĬÇñúØĢěćÛöĂÌíĥġñĤĂ
ĥĥÕÕµµÅĕĥÕąÅÅĕÅÕÕÕ
9618/22/M/J/25
[Turn over
The contents of these two arrays are shown:
Data
Pointer
1
1018
1
7
2
1007
2
3
3
1010
3
1
4
1056
4
6
5
1092
5
-1
6
1062
6
5
7
1034
7
4
8
0
8
9
9
0
9
10
10
0
10
-1
Study the pseudocode:
PROCEDURE Place(Value : INTEGER, Start : INTEGER, Unused : INTEGER)
DECLARE New, Current, Last : INTEGER
CONSTANT NullPointer = -1
New
Unused
NullPointer
Last
Start
Current
WHILE Current <> NullPointer AND Data[Current] < Value
Current
Last
Pointer[Current]
Current
ENDWHILE
Pointer[Last]
Pointer[New]
New
Pointer[Last]
Value
Data[New]
ENDPROCEDURE
© UCLES 2025
ĬÙĊ®Ġ´íÈõÏĪÅĊàû¸Ā×
ĬÇñûØĬĩĂàüĉÃÏÉÃġĜĂ
ĥÕąÕõµÅµąõõÅąĕĥÕÅÕ
9618/22/M/J/25
DO NOT WRITE IN THIS MARGIN
Data and Pointer are both global arrays of type INTEGER
DO NOT WRITE IN THIS MARGIN
Two arrays Data and Pointer are accessed by the procedure Place()
DO NOT WRITE IN THIS MARGIN
6
,
DO NOT WRITE IN THIS MARGIN
12
,
DO NOT WRITE IN THIS MARGIN
* 0000800000012 *
13
,
(a) (i)
,
Complete the trace table below by dry running the procedure Place() when it is called
by the statement:
CALL Place(1043, 2, 8)
Value
Start
Unused
New
Last
Current
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000013 *
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[4]
(ii)
Complete the diagram showing the contents of the global arrays Data and Pointer
after the procedure Place() has run to completion when called as shown in part (a)(i).
Data
Pointer
1
1018
1
2
1007
2
3
1010
3
4
1056
4
5
1092
5
6
1062
6
7
1034
7
8
8
9
9
10
10
[3]
(b) The operation carried out by procedure Place() together with the arrays form part of the
implementation of an Abstract Data Type (ADT).
Identify the ADT and state the operation carried out by procedure Place()
[2]
ĬÛĊ®Ġ´íÈõÏĪÅĊàù¸Ā×
ĬÇòüÐĞĥòÙþøĆċ±ėġĬĂ
© UCLES 2025
9618/22/M/J/25
[Turn over
ĥÕõĕµÕåÕĕąåÅąõąĕÕÕ
14
,
7
,
A program is being developed to implement a customer loyalty scheme for a coffee shop.
Each customer has a unique customer ID starting at 10001 with this value increasing by one each
time a new customer joins the loyalty scheme.
For example, the third customer who joins the loyalty scheme is given the customer ID 10003
The loyalty scheme is limited to 1000 customers.
DO NOT WRITE IN THIS MARGIN
* 0000800000014 *
The programmer has decided to use a global 2D array Loyalty of type INTEGER. The array
Loyalty is made up of 1000 rows and 2 columns. Each row relates to one customer; column 1
contains the unique customer ID and column 2 contains the number of customer loyalty points.
Rows in the array Loyalty that are not currently being used have the value of Column 1 set to
99999
The array is sorted in ascending order by customer ID.
DO NOT WRITE IN THIS MARGIN
A customer is awarded a loyalty point every time they buy a coffee.
Module
Description
called with parameter of type INTEGER representing a customer ID
•
if the customer ID is found, return an integer value representing the
loyalty points, otherwise return -1
searches the Loyalty array for this customer ID
the search will stop as soon as the customer ID is found
the search should efficiently deal with the situation when the
customer ID is not stored in the Loyalty array
© UCLES 2025
ĬÕĊ®Ġ´íÈõÏĪÅĊßúµĂ×
ĬÇñúÍĤĚĊëČóéçĬēÑĤĂ
ĥõõÕõµĥõõĕåąÅµåÕąÕ
9618/22/M/J/25
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
FindCustomer()
•
•
•
•
DO NOT WRITE IN THIS MARGIN
The programmer has defined a program module:
DO NOT WRITE IN THIS MARGIN
* 0000800000015 *
15
,
,
(a) Write efficient pseudocode for module FindCustomer()
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[8]
© UCLES 2025
Ĭ×Ċ®Ġ´íÈõÏĪÅĊßüµĂ×
ĬÇòùÕĦĖúÎîþĠóĔÇÑĔĂ
ĥõąĕµÕąĕĥĥõąÅÕÅĕĕÕ
9618/22/M/J/25
[Turn over
,
(b) A customer can claim a free coffee for every 11 loyalty points.
The programmer has defined a second program module:
Module
PointsReport()
Description
•
output the customer ID for each customer who has 11 or
more loyalty points
•
output the average loyalty points for all customers in the
Loyalty array along with an appropriate message
Write efficient pseudocode for module PointsReport()
Assume the array contains the data for at least one customer.
DO NOT WRITE IN THIS MARGIN
16
,
DO NOT WRITE IN THIS MARGIN
* 0000800000016 *
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
© UCLES 2025
ĬÕĊ®Ġ´íÈõÏĪÅĊÝúµĄ×
ĬÇòüÕĠĨïéôąħѰĥÁĬĂ
ĥÅÕĕõÕąµąÅąąąÕĥĕąÕ
9618/22/M/J/25
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000017 *
17
,
,
DO NOT WRITE IN THIS MARGIN
[7]
(c) The programmer decides to amend the customer ID; it will be stored as a STRING instead of
an INTEGER. This means that the 2D array Loyalty can no longer be used.
DO NOT WRITE IN THIS MARGIN
(i)
Explain why the 2D array Loyalty can no longer be used.
[1]
(ii)
Explain how a 1D array could be used to store both the loyalty points and the amended
customer ID.
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[2]
© UCLES 2025
Ĭ×Ċ®Ġ´íÈõÏĪÅĊÝüµĄ×
ĬÇñûÍĪĬÿÐĆüâąÈ±ÁĜĂ
ĥÅåÕµµĥÕĕµÕąąµąÕĕÕ
9618/22/M/J/25
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
,
© UCLES 2025
ĬÕĊ®Ġ´íÈõÏĪÅĊàú·Ă×
ĬÇóüÐĞĠĩçûþ½®āùĔĂ
ĥĕµÕõÕåµåõąÅąõĥĕµÕ
18
BLANK PAGE
9618/22/M/J/25
DO NOT WRITE IN THIS MARGIN
,
DO NOT WRITE IN THIS MARGIN
* 0000800000018 *
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000019 *
,
© UCLES 2025
Ĭ×Ċ®Ġ´íÈõÏĪÅĊàü·Ă×
ĬÇôûØĬĤęÒýóČĩÆÕùĤĂ
ĥĕÅĕµµÅÕµąÕÅąĕąÕåÕ
,
19
BLANK PAGE
9618/22/M/J/25
20
,
,
Permission to reproduce items where third‑party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer‑related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.
© UCLES 2025
ĬÕĊ®Ġ´íÈõÏĪÅĊÞú·Ą×
ĬÇôúØĢĒĐåăüăËĪ÷ĩĜĂ
ĥåĕĕõµÅõÕååÅÅĕåÕµÕ
9618/22/M/J/25
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
BLANK PAGE
DO NOT WRITE IN THIS MARGIN
* 0000800000020 *