A Level Computer Science 9618 Paper 23, May/June 2025

Question paper and mark scheme75 marks7 questions

Solve it on ExamPal

Practise

Untimed. Write on the paper and check as you go.

Start

Exam

Timed, with a clock you set, like sitting the real paper.

Start

Opens full screen.

Opening the question paper

Read as textThe questions and the mark scheme as plain text. Easier to read on a phone.

Question paper

9618/23 · May/June 2025

Download PDF
1

A program is being developed for the management of a sports centre.

a(i)

The programmer developing the software decides to use modules (procedures or functions) and local variables. They also decide not to use global variables. State two reasons why the programmer decides to use modules.

[2]
a(ii)

State one difference between local and global variables.

[1]
a(iii)

State two benefits of using local variables.

[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.

ExpressionEvaluates to
................................(68)'D'
................................(04/02/2025)2
................................TRUEFALSE
................................(................................ ("Court1.4Upper" ,..........,...........))1.4
[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.

VariableUse of variableData type
MemberCountstores how many members have used the sports centre each day
TotalTakingsstores the total amount of money taken each day
BookingConfirmedstores the state of a booking for an exercise class; a booking is either confirmed or not confirmed
MemberDOBto calculate when to send an email with a birthday message to a member
[4]
2

A programmer uses a number of Abstract Data Types (ADT) in the programs that she is developing.

a(i)

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. 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]
a(ii)

The diagram shows the current state of the stack. 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.

[3]
b(i)

In a different program, the programmer decides to implement a linked list using an array of records. 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.

IndexDataPointer
0"Neptune"
1"Jupiter"
2"Saturn"
3"Earth"
4"Mercury"
5"Uranus"
[3]
b(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

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

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:

ParameterString returnedExplanation
"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'

[8]
6

Study the structure chart: 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.

Figure 1 of 1 for question 6
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.

SymbolExplanation
\raisebox{-0.5\totalheight}{ ♢}
\raisebox{-0.5\totalheight}{ ↶}
[3]
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 itemDescription
customer IDa unique six-digit string
loyalty pointsan integer value that depends on how often the customer visits the coffee shop
last visit datethe date the customer last visited the coffee shop
a(i)

The programmer has defined a program module:

ModuleDescription
UpdateVisit()• 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 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()

Write pseudocode for module UpdateVisit() Assume the customer has made at least one previous visit.

[5]
a(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(i)

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 shop on a Monday, the value of their loyalty points is increased by 10. The programmer has defined two more program modules:

ModuleDescription
FindCustomer() (is already written)• called with a parameter of type STRING that represents a customer ID • returns the line of data read from the text file Loyalty.txt containing the data items for that customer
MondayCheck()• called with a parameter of type STRING that represents the customer ID of a customer • calls FindCustomer() • extracts the loyalty points from the string returned by FindCustomer() • increases the loyalty points for the current customer by 10 if the day visited is a Monday • returns an integer value representing the loyalty points

Write pseudocode for module MondayCheck() The module FindCustomer() must be used and assume it returns a valid string for the current customer.

[8]
b(ii)

A date is stored in LastVisitDateString in the format: DDMMYYYY DD is a 2-digit string MM is a 2-digit string YYYY is a 4-digit string. For example, the date 03/09/2024 is stored as "03092024" An algorithm is needed to convert the string stored in LastVisitDateString to data type DATE which is then stored in the variable LastVisitDate. Complete the pseudocode for this algorithm: Assume that LastVisitDateString has been declared and contains valid data. DECLARE DayInt, MonthInt, YearInt : INTEGER DECLARE LastVisitDate : DATE

[4]

Mark scheme

9618/23 · May/June 2025

Download PDF

1a(i) · 2 marks

  • 1 mark

    When a task/module is repeated / reused / called // performed in several places

  • 1 mark

    A specific task can be identified /coded as a module / subroutine / procedure / function.

  • 1 mark

    Reduces complexity of program / code // Program / code is simplified

  • 1 mark

    Module / subroutine / procedure / function already available.

  • 1 mark

    Testing / debugging / maintenance is easier

1a(ii) · 1 mark

  • 1 mark

    Local variables are used within a module // are accessible only within the module (in which they are declared)

  • 1 mark

    Global variables are accessible to all parts of the program /

  • 1 mark

    Local variables use memory only while the module in is executing // Global variables use memory for the whole time the program is running

1a(iii) · 2 marks

  • 1 mark

    The same variable name can be reused in other parts of the program

  • 1 mark

    Using local variables makes modules self-contained // cannot accidentally change the same identifier outside of the module

  • 1 mark

    Using local variables aids modularisation.

  • 1 mark

    Memory allocated to local variables can be reused when module not in use

1b · 5 marks

  • 1 mark

    CHR(68) evaluates to 'D'

  • 1 mark

    MONTH(04/02/2025) // -2 + DAY(04/02/2025) // -2023 + YEAR(04/02/2025) evaluates to 2

  • 1 mark

    NOT TRUE // FALSE = TRUE evaluates to FALSE

  • 1 mark

    Row 4: STR_TO_NUM

  • 1 mark

    Row 4: MID("Court1.4Upper",6,3)

1c · 4 marks

  • 1 mark

    MemberCount: INTEGER

  • 1 mark

    TotalTakings: REAL

  • 1 mark

    BookingConfirmed: BOOLEAN

  • 1 mark

    MemberDOB: DATE

2a(i) · 2 marks

  • 1 mark

    400

  • 1 mark

    6

2a(ii) · 3 marks

  • 1 mark

    TopOfStack pointing to 'Y' and value 'Y' in location 408

  • 1 mark

    Values 'C' and 'Z' in 406 and 407

  • 1 mark

    Values 'D' to 'F' unchanged in 400 to 405 and 409 is empty

2b(i) · 3 marks

  • 1 mark

    Earth pointer 1

  • 1 mark

    Uranus pointer -1

  • 1 mark

    Other four correct pointers

2b(ii) · 1 mark

  • 1 mark

    3

2c · 2 marks

  • 1 mark

    First value added to queue is the first value removed // FIFO // LILO

  • 1 mark

    Two pointers needed to indicate the start and end of the queue

  • 1 mark

    May behave as a circular queue

  • 1 mark

    Manipulated using enqueue() / dequeue() operations // by description

3 · 7 marks

  • 1 mark

    Declare all variables used and initialise Sum to 0

  • 1 mark

    Loop for ‘number of times’ parameter

  • 1 mark

    Use RAND() function with Integer parameter in a loop

  • 1 mark

    Use INT() function in a loop

  • 1 mark

    Generate a random integer between 1 and 6 in a loop

  • 1 mark

    Output each value generated in a loop

  • 1 mark

    Calculate Sum and if Average used check declared as REAL and return Average and check function header returns REAL

4a · 5 marks

  • 1 mark

    Open the file (Sales.txt) in read mode and subsequently close

  • 1 mark

    Read a line (from the text file)

  • 1 mark

    Convert the line read (string) to a number

  • 1 mark

    If the number is greater than 500 and then output week number

  • 1 mark

    Increment week number (must have been Initialised …)

  • 1 mark

    Repeat from step 2 for 52 times // Repeat from step 2 until end of file

4b · 3 marks

  • 1 mark

    Going through the program a line / statement at a time // doing a dry run // single-stepping (at run-time with an IDE) // Peer testing/review is carried out

  • 1 mark

    Creating a trace table

  • 1 mark

    Draw up test data // draw up list of inputs with expected output // boundary, normal, abnormal data is used

  • 1 mark

    Errors will be indicated when a variable / output gives an unexpected value

  • 1 mark

    Faults in the logic of the program can be detected // Errors may be indicated by an unexpected path through the program

5 · 8 marks

  • 1 mark

    Function heading and ending and parameter (STRING) and return type STRING

  • 1 mark

    Loop for length of BitString

  • 1 mark

    Extract current character in a loop

  • 1 mark

    Compare current character to '1' or '0' in a loop

  • 1 mark

    Increment count and was Initialised earlier in a loop

  • 1 mark

    Check if even/odd number of 1s

  • 1 mark

    Append '1' or '0' as appropriate

  • 1 mark

    Return amended BitString

6a · 1 mark

  • 1 mark

    A function returns a (single) value and a procedure does not

  • 1 mark

    A procedure can pass parameters by ByRef

6b · 5 marks

  • 1 mark

    Sub_Part1A: PROCEDURE Sub_Part1A(R: INTEGER)

  • 2 marks

    Sub_Part2A: FUNCTION Sub_Part2A(T : REAL) RETURNS BOOLEAN

  • 2 marks

    Sub_Part3A: PROCEDURE Sub_Part3A(V: INTEGER, W: BOOLEAN, BYREF U : STRING)

6c · 3 marks

  • 1 mark

    Shape1: reference to selection

  • 1 mark

    Shape2: reference to repetition // iteration

  • 1 mark

    Descption (×2) including correct use of all module names in both parts

7a(i) · 5 marks

  • 1 mark

    Procedure heading and ending and two parameters of correct type

  • 1 mark

    … both passed BYREF

  • 1 mark

    Use of TODAY() function to obtain current date

  • 1 mark

    Use MONTH function (×2) and one parameter is the header parameter and 2nd parameter is TODAY() / assigned variable

  • 1 mark

    If visit is same month, increase LoyaltyPoints by 4 otherwise increase by 1

  • 1 mark

    LastVisitDate set to TODAY() / ‘current date’ variable (assigned or unassigned)

7a(ii) · 1 mark

  • 1 mark

    DAYINDEX(LastVisitDate) = DAYINDEX(TODAY())

7b(i) · 8 marks

  • 1 mark

    Value is returned from FindCustomer(CustomerID) and stored

  • 1 mark

    Function MID used

  • 1 mark

    Attempt to extract LoyaltyPoints from the string returned by FindCustomer()

  • 1 mark

    Correct extraction of LoyaltyPoints from the string returned by FindCustomer()

  • 1 mark

    Conversion of LoyaltyPoints extracted to an integer

  • 1 mark

    Check - is today’s date a Monday using TODAY()

  • 1 mark

    … increase LoyaltyPoints by 10

  • 1 mark

    Return LoyaltyPoints

7b(ii) · 4 marks

  • 1 mark

    Use of one substring function

  • 1 mark

    DayInt, MonthInt and YearInt all correctly extracted

  • 1 mark

    Use of STR_TO_NUM x 3

  • 1 mark

    SETDATE() function used to convert to a date type and assigned to LastVisitDate

Questions

  1. 1
    Question 114 marks
    Mark scheme ›
  2. 2
    Question 211 marks
    Mark scheme ›
  3. 3
    Question 37 marks
    Mark scheme ›
  4. 4
    Question 48 marks
    Mark scheme ›
  5. 5
    Question 58 marks
    Mark scheme ›
  6. 6
    Question 69 marks
    Mark scheme ›
  7. 7
    Question 718 marks
    Mark scheme ›

More 9618 papers

Other papers from May/June 2025

Solve it on ExamPalStart