Past paper – A Level Computer Science (9618)

Cambridge International AS & A Level · 9618

Computer Science · Paper 23

May/June 2025 · 9618/23/M/J/25

Questions7
Marks75
TypeWritten

Answer on paper, open each mark scheme and give yourself marks, then open the Summary.

0 / 0Answer a question to start your score.
Saved 0
Advertisement
1
9618/23/M/J/25 · Question 1May/June 2025Paper 2314 marks
Loading question…
Question text

1
A program is being developed for the management of a sports centre.
(a) The programmer developing the software decides to use modules (procedures or functions)
and local variables. They also decide not to use global variables.
(i)
State two reasons why the programmer decides to use modules.
1 …
…
2 …
…
[2]
(ii)
State one difference between local and global variables.
…
… [1]
(iii)
State two benefits of using local variables.
1 …
…
2 …
…
[2]
(b) The pseudocode design contains a number of expressions.
Complete each pseudocode expression so that it evaluates to the value shown.
Refer to the insert for the list of pseudocode functions and operators.
Expression
Evaluates to
'D'
… (68)
2
… (04/02/2025)
FALSE
… TRUE
1.4
… ( … ("Court1.4Upper" , … , … ))
[5]
ĬÕĊ®Ġ´íÈõÏĪÅĊàú·þ×
,
,
(c) The table lists some of the variables used in the program.
Complete the table by writing the most appropriate data type for each variable.
Variable
Use of variable
Data type
stores how many members have used the sports
MemberCount
centre each day
TotalTakings
stores the total amount of money taken each day
stores the state of a booking for an exercise class;
BookingConfirmed
a booking is either confirmed or not confirmed
to calculate when to send an email with a birthday
MemberDOB
message to a member
[4]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊàü·þ×

2
9618/23/M/J/25 · Question 2May/June 2025Paper 2311 marks
Loading question…
Question text

2
A programmer uses a number of Abstract Data Types (ADT) in the programs that she is developing.
(a) A stack using memory locations 400 to 409 is used in one program.
The diagram represents the current state of the stack.
A variable TopOfStack pointer indicates the last value added to the stack.
Stack
Memory
Value
location
409
408
407
406
405
404
TopOfStack
403
'P'
402
'X'
401
'D'
400
'B'
(i)
Complete the answer column in the following table:
Answer
the memory location of the value that has been on the stack for
the longest time
the number of consecutive push operations that will result in the
TopOfStack variable containing 409
[2]
ĬÕĊ®Ġ´íÈõÏĪÅĊÞú·Ā×
,
,
(ii)
The diagram shows the current state of the stack.
Stack
Memory
Value
location
409
408
TopOfStack
407
'A'
406
'C'
405
'F'
404
'K'
403
'B'
402
'S'
401
'R'
400
'D'
The following sequence of operations are performed:
PUSH 'T'
POP
POP
PUSH 'Z'
PUSH 'X'
POP
PUSH 'Y'
Complete the following diagram to show the state of the stack after the operations have
been performed.
Stack
Memory
Value
location
409
408
407
406
405
404
403
402
401
400
[3]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊÞü·Ā×
,
,
(b) In a different program, the programmer decides to implement a linked list using an array of
records.
(i)
The array is represented in the diagram.
A pointer value of –1 indicates the end of the linked list.
Complete the pointer field to produce a linked list that is in alphabetical order.
Index
Data
Pointer
0
"Neptune"
1
"Jupiter"
2
"Saturn"
3
"Earth"
4
"Mercury"
5
"Uranus"
[3]
(ii)
The variable StartPointer contains the index of the first item in the linked list.
State the value of the variable StartPointer
… [1]
(c) A third program is also being created to manage a queue.
Describe two features of a queue.
Feature one …
…
Feature two …
…
[2]
ĬÙĊ®Ġ´íÈõÏĪÅĊßü¶þ×

3
9618/23/M/J/25 · Question 3May/June 2025Paper 237 marks
Loading question…
Question text

3
A programmer has been asked to create a module RollDice() to simulate multiple rolls of a
dice. This module will be used as part of a program for a game.
The module will:
step 1 – take a positive integer parameter representing the number of times the dice will be rolled
step 2 – simulate one roll of the dice by generating a random integer between 1 and 6 inclusive
step 3 – output the integer generated
step 4 – repeat, as required from step 2
step 5 – calculate the average value of the random integers generated
step 6 – return the average value.
Write pseudocode for the module RollDice()
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [7]
ĬÛĊ®Ġ´íÈõÏĪÅĊßú¶þ×

Advertisement
4
9618/23/M/J/25 · Question 4May/June 2025Paper 238 marks
Loading question…
Question text

4
A programmer is developing a new stock control program for a shop owner to produce sales
reports.
(a) A text file Sales.txt stores strings representing the number of items sold.
The file contains 52 lines, each representing the number of items sold in each week of the
year.
For example:
File line number
File data
1
"350"
2
"502"
3
"434"
49
"492"
50
"872"
51
"772"
52
"201"
The example shows that 502 items were sold in week 2.
The owner requires a module to output all week numbers where the number of items sold is
greater than 500.
Describe an algorithm that produces the required module.
Do not include pseudocode statements in your answer.
…
…
…
…
…
…
…
…
…
…
…
… [5]
ĬÙĊ®Ġ´íÈõÏĪÅĊÝü¶Ā×
,
,
(b) Once the program has been completed, it is tested using the walkthrough method.
Describe the walkthrough method and explain how it can be used to identify errors.
…
…
…
…
…
…
…
… [3]
ĬÛĊ®Ġ´íÈõÏĪÅĊÝú¶Ā×

5
9618/23/M/J/25 · Question 5May/June 2025Paper 238 marks
Loading question…
Question text

5
A module Parity() takes a string as a parameter. The parameter has the identifier BitString
and it represents a binary value.
The module will concatenate a single character to the end of BitString by applying one of the
two rules:
•
'0' if Bitstring contains an even number of 1s
•
'1' if Bitstring contains an odd number of 1s.
The modified value of BitString is then returned.
For example:
Parameter
String returned
Explanation
"0010010110"
"00100101100"
there are an even number of 1s in the string
passed to Parity() so a '0' is concatenated
to the end of BitString
"101010"
"1010101"
there are an odd number of 1s in the string
passed to Parity() so a '1' is concatenated
to the end of BitString
Write pseudocode for the module Parity()
Assume the parameter BitString can only contain the characters '0' and '1'
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
ĬÙĊ®Ġ´íÈõÏĪÅĊàü¸þ×
,
,
…
…
…
…
…
…

6
9618/23/M/J/25 · Question 6May/June 2025Paper 239 marks
Loading question…
Question text

6
Study the structure chart:
Main
M
P
Sub_A
Sub_B
V
R
X
W
T
U
Sub_Part1A
Sub_Part2A
Sub_Part3A
Sub_Part1B
Sub_Part2B
Some of the parameter data types are:
•
R and V are of type INTEGER
•
T is of type REAL
•
U is of type STRING
•
W is of type BOOLEAN.
Some of the modules in the structure chart are functions, others are procedures.
(a) Explain one difference between functions and procedures.
…
… [1]
(b) Write the pseudocode to define the module headers:
Sub_Part1A
…
…
Sub_Part2A
…
…
Sub_Part3A
…
…
[5]
ĬÙĊ®Ġ´íÈõÏĪÅĊÞü¸Ā×
,
,
(c) The structure chart uses the two symbols shown.
Complete the table to explain what each symbol means and how the relevant modules in the
structure chart are affected.
Symbol
Explanation
…
…
…
…
…
…
[3]
ĬÛĊ®Ġ´íÈõÏĪÅĊÞú¸Ā×

7
9618/23/M/J/25 · Question 7May/June 2025Paper 2318 marks
Loading question…
Question text

7
A program is being developed to implement a customer loyalty scheme for a coffee shop.
The programmer has decided that the following data items need to be stored for each customer:
Data item
Description
customer ID
a unique six-digit string
loyalty points
an integer value that depends on how often the customer visits the coffee shop
last visit date
the date the customer last visited the coffee shop
The programmer has defined a program module:
Module
Description
• called with two parameters:
1. loyalty points of type INTEGER
2. last visit date of type DATE
•
change the loyalty points:
 increase by four if the last visit date and the current date are in the
UpdateVisit()
same month
 otherwise increase by one
•
change the last visit date to the current date
•
the changed values must be available to the code that follows the call
to UpdateVisit()
(a) (i)
Write pseudocode for module UpdateVisit()
Assume the customer has made at least one previous visit.
…
…
…
…
…
…
…
…
…
…
…
…
…
[5]
ĬÕĊ®Ġ´íÈõÏĪÅĊÝùµĂ×
,
,
(ii)
The programmer decides to amend the UpdateVisit() module so that loyalty points
are further increased if the customer visits the coffee shop the same day of the week as
their last visit.
Write the pseudocode for this condition.
…
… [1]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊÝûµĂ×
,
,
(b) A text file Loyalty.txt will be used to store the data items for the loyalty scheme.
The text file Loyalty.txt contains only one line of data for each customer.
Each data item is separated by a comma:
<CustomerID>,<LoyaltyPointsString>,<LastVisitDateString>
LastVisitDateString is always eight characters in length in the format: DDMMYYYY.
An example of how a line of data will be stored in the text file Loyalty.txt is:
"100123,132,05032025"
This example shows that the customer with an ID of 100123 had 132 loyalty points following
their last visit to the coffee shop on 05/03/2025.
If a customer visits the coffee sh

Advertisement