A Level Computer Science 9618 Paper 21, 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/21 · May/June 2025

Download PDF
1

Refer to the insert for the list of pseudocode functions and operators. 1 A program is being developed to help the manager of a shop control the stock.

a

An identifier table has been used during the design stage. Complete the identifier table:

Example valueExplanationVariable nameData type
"Fruit"a category of stock that is sold in the shop
20/02/2025when an item was sold
12.67the cost of an item
TRUEto indicate if an item is in stock
[4]
b

A module Sales() is part of the stock control program. The table contains pseudocode extracts from the module Sales() Each extract may include all or part of: • assignment • selection • iteration (repetition). Complete the table by placing one or more ticks (✓) in each row:

Pseudocode extractAssignmentSelectionIteration
Result ← CalculateTotal()
WHILE IsClosed
REPEAT<br> INPUT Value<br>UNTIL Sales[4] > Value
IF Sales[Current] <= 150 THEN<br> Discount ← TRUE<br>ENDIF
CASE OF Option
[5]
c

Decomposition has been used to design the program to help the shop manager control the stock. Describe decomposition.

[3]
2

A program is being developed to calculate the pay of employees working for a company. A function CalculateBonus() calculates bonus pay based on the value of sales. Bonus pay is calculated as shown in the table.

Value of sales (in dollars)Bonus pay (in dollars)
below 20000
between 2000 and 4000 inclusive10
above 4000100

A flowchart for the function CalculateBonus() has been designed.

Figure 1 of 1 for question 2
a(i)

The flowchart contains logic errors. One logic error is that BonusPay will not be set to 10 although the ValueOfSales input is between 2000 and 4000 inclusive. Explain why this error occurs.

[1]
a(ii)

Explain how this error could be corrected.

[1]
b(i)

There are different ways to reduce the risk of errors when developing the new program, such as the use of constants. State a value that could be replaced by a constant in the function CalculateBonus()

[1]
b(ii)

Explain how the use of constants helps to reduce the risk of programming errors.

[2]
b(iii)

One other way that can reduce the risk of errors when writing the program is the use of library routines. Explain how library routines can reduce the risk of programming errors.

[1]
c

All the logic errors have been corrected, and the program has been coded. Identify and describe two other types of error that the program could contain. Type of error ............................................................................................................................. Description ................................................................................................................................ ................................................................................................................................................... ................................................................................................................................................... Type of error ............................................................................................................................. Description ................................................................................................................................ ................................................................................................................................................... ...................................................................................................................................................

[4]
3

A student has been asked to create a simple guessing game program. This program will generate a random integer value between 1 and 100. It will then repeatedly prompt the user to input an integer value until they input the randomly generated value. The student has written a structured English description: step 1 – randomly generate an integer value between 1 and 100 inclusive step 2 – prompt the user to input an integer value step 3 – output an appropriate message if the value input was too high; then repeat from step 2 step 4 – output an appropriate message if the value input was too low; then repeat from step 2 step 5 – output an appropriate message if the value input was the same value that was randomly generated; then end the program. Write a pseudocode algorithm from this structured English description. Assume no input validation is needed.

[8]
4

Study the algorithm: DECLARE Chars : ARRAY[1:4] OF CHAR DECLARE I, J : INTEGER DECLARE Key : CHAR I ← 2 Chars[1] ← 'D' Chars[2] ← 'T' Chars[3] ← 'H' Chars[4] ← 'R' WHILE I <= 4 //Outer loop Key ← Chars[I] J ← I – 1 WHILE J >= 0 AND Chars[J] > Key //Inner loop Chars[J + 1] ← Chars[J] J ← J – 1 ENDWHILE Chars[J + 1] ← Key I ← I + 1 ENDWHILE

a

The outer loop structure used in the algorithm is not the most appropriate one to use. State the type of loop structure that would be the most appropriate to use and justify why it is the most appropriate. Loop structure ........................................................................................................................... Justification ............................................................................................................................... ...................................................................................................................................................

[2]
b

Complete the trace table by dry running the algorithm. The first row has been completed.

IKeyJChars[J]Chars [1]Chars [2]Chars [3]Chars [4]
2'D''T''H''R'
[6]
5

Stacks and queues are both abstract data types. A stack uses a top-of-stack pointer to indicate the location of the last item added to the stack. A queue uses two pointers: • a front pointer to indicate the location of the next item to be removed from the queue • a rear pointer to indicate the location of the next item to be added to the queue. A queue can be used to reverse the items stored on a stack. For example, if a stack contains six items: Initial state of the stack: [top-of-stack pointer -> item 6, item 5, item 4, item 3, item 2, item 1] Final state of the stack when the items have been reversed: [top-of-stack pointer -> item 1, item 2, item 3, item 4, item 5, item 6] Describe how the queue could be used to reverse the items that are currently stored on the stack. Your description must include how the pointers are used in both the stack and queue. Assume: • The stack initially contains an unknown number of items. • The queue can store all the items currently stored on the stack. • The queue is initially empty.

[7]
6

A program monitors the speed of vehicles as they move around a large building site. Each vehicle contains a sensor which reads an integer value that represents the speed of the vehicle. The value is expected to be in the range 0 to 60 inclusive. The sensors cannot read values less than 0. A program module has been written to validate the values read by the sensors.

a

A test plan is needed to fully test the module. Complete the table. The first line has been completed for you. Assume the sensors generate only integer values.

Type of test dataTest data valueExpected outcome
normal36data item is accepted
[4]
b

Each sensor used in the system has a unique sensor ID number in the range 1 to 50. The program that is used to monitor the speed of each vehicle reads each sensor value every second and stores this value along with the sensor’s unique ID into a global 2D array Reading The global array Reading has been declared as follows: DECLARE Reading : ARRAY[1:2000, 1:2] OF INTEGER The array contains 4000 elements organised as 2000 rows and 2 columns. Column 1 contains the sensor value, and column 2 contains the sensor ID. When 2000 sensor readings have been taken, the array is full and the system stops taking any more sensor readings until the array has been processed. A procedure Sort() is needed to sort the array into ascending order of sensor value using an efficient bubble sort algorithm. Write efficient pseudocode for the procedure Sort()

[8]
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
pointsan integer value that is increased by one for every cup of coffee the customer orders

When a customer visits the shop and orders coffee, the scheme operates as follows: • The total number of points is increased by the number of coffees ordered. • If just one cup of coffee is ordered and the number of points goes above 10, then: ◦ the cup of coffee they have just ordered is given to them free of charge ◦ the number of points is reduced by 11. • If the order is for multiple coffees and the number of points goes above 10, then: ◦ they get one coffee free of charge for every 11 points ◦ the number of points is reduced by 11 for each free coffee. For example, the: • customer currently has 9 points • customer orders 16 cups of coffee • total number of points now becomes 25 • customer gets 2 free coffees and now has 3 points left. The programmer has defined a program module that is called every time a customer places an order:

ModuleDescription
CustomerOrder()• called with two integer parameters:<br> ◦ the number of coffees ordered<br> ◦ the current number of points<br>• output a suitable message giving the number of free coffees<br>• return a value for the new points total.
a

Write pseudocode for module CustomerOrder()

[6]
b(i)

A text file Loyalty.txt will be used to store the data items for the loyalty scheme. The data items for each customer will be stored on a separate line of the text file where each data item is separated by a comma: <CustomerID>,<Points> The contents of the text file Loyalty.txt will always be stored in ascending order by customer ID. When the data items are read from or written to the text file Loyalty.txt, they may need to be converted to the appropriate data type. Each customer has a unique customer ID starting at "100001" with this value increasing by one each time a new customer joins the loyalty scheme. When a customer joins the loyalty scheme, they are assigned the next customer ID and value of points is set to 0. For example, if the loyalty scheme has 204 customers and a new customer joins the loyalty scheme, the following line is added to the text file Loyalty.txt: "100205,0" You can assume that the number of customers in the loyalty scheme will never be more than 9000. The programmer has defined a program module as follows:

ModuleDescription
AddNewCustomers()• called with an integer parameter representing the number of new customers to be added to the loyalty scheme<br>• adds a new line, containing the required information, to the text file Loyalty.txt for each customer added to the loyalty scheme<br>• outputs each new customer ID added to the loyalty scheme

Write pseudocode for module AddNewCustomers() Assume that there is at least one customer already in the loyalty scheme.

[8]
b(ii)

The requirements for AddNewCustomers() are changed. There may be no existing customers in the loyalty scheme. Explain the changes that will need to be made to the module AddNewCustomers()

[4]

Mark scheme

9618/21 · May/June 2025

Download PDF

1a · 4 marks

  • 1 mark

    Category : STRING

  • 1 mark

    DateSold : DATE

  • 1 mark

    (Item)Cost/Price : REAL

  • 1 mark

    (Item)InStock : BOOLEAN

1b · 5 marks

  • 1 mark

    Result ← CalculateTotal() : Assignment

  • 1 mark

    WHILE IsClosed : Iteration

  • 1 mark

    REPEAT ... UNTIL Sales[4] > Value : Assignment and Iteration

  • 1 mark

    IF Sales[Current] <= 150 THEN ... ENDIF : Assignment and Selection

  • 1 mark

    CASE OF Option : Selection

1c · 3 marks

  • 1 mark

    Breaking down a problem into sub problems

  • 1 mark

    In order to explain / understand the process/task of how a (stock control) can be managed in more detail

  • 1 mark

    Leading to the concept of the program designed as a series of modules / procedures / functions // or by example of different stock control modules

  • 1 mark

    Makes the program easier to test / debug

2a(i) · 1 mark

  • 1 mark

    The two decision boxes are in the wrong order // The first decision symbol is wrong

  • 1 mark

    The first decision should check for values greater than or equal to 2000

2a(ii) · 1 mark

  • 1 mark

    Swap around the two decision boxes

  • 1 mark

    The first decision box should check for values greater than or equal to 2000 and the second decision box should check for values above 4000

2b(i) · 1 mark

  • 1 mark

    2000 / 4000 / 10 / 100

2b(ii) · 2 marks

  • 1 mark

    The value cannot be changed // avoids being different in two places

  • 1 mark

    Makes the program easier to understand

  • 1 mark

    Avoids repeatedly writing the same value throughout the program

  • 1 mark

    A change to the value requires a change in only one statement

2b(iii) · 1 mark

  • 1 mark

    (The code is) tried and tested so error free

  • 1 mark

    Provides functionality / code that the programmer may find difficult to code themselves

2c · 4 marks

  • 1 mark

    Syntax (error)

  • 1 mark

    Rules of programming language // the language grammar was not followed

  • 1 mark

    Run-time (error)

  • 1 mark

    The program performs an illegal operation

3 · 8 marks

  • 1 mark

    Declare all variables used

  • 1 mark

    Uses RAND() function

  • 1 mark

    Uses INT() function

  • 1 mark

    Correct syntax for random number between 1 and 100

  • 1 mark

    Conditional loop until correct number guessed

  • 1 mark

    Prompt and input a guess in a loop

  • 1 mark

    Check if guess is too high in a loop

  • 1 mark

    Check if guess is too low in a loop

  • 1 mark

    Output appropriate message (x2) when the number is not guessed correctly (in the loop) and output correct guess message

4a · 2 marks

  • 1 mark

    Count-controlled

  • 1 mark

    The number of iterations required is known

4b · 6 marks

  • 1 mark

    MP1 enclosure (I=2 row entries: Key='T', J=1, Chars[J]='D')

  • 1 mark

    MP2 enclosure (I=3 first parts: Key='H', J=2, Chars[J]='T', Chars[3]='T')

  • 1 mark

    MP3 enclosure (I=3 continuation: J=1, Chars[J]='D', Chars[2]='H')

  • 1 mark

    MP4 enclosure (I=4 row entries: Key='R', J=3, Chars[J]='T', Chars[4]='T'; J=2, Chars[J]='H', Chars[3]='R')

  • 1 mark

    MP5 enclosure (I=5 loop termination)

  • 1 mark

    MP6: Chars array final values: 'D', 'H', 'R', 'T'

5 · 7 marks

  • 1 mark

    Pop an item off the stack

  • 1 mark

    Update Stack pointer

  • 1 mark

    Add it to the queue

  • 1 mark

    Update Rear pointer

  • 1 mark

    Repeat until the stack is empty

  • 1 mark

    Remove an item from the queue

  • 1 mark

    Update Front pointer

  • 1 mark

    Push it onto the stack

  • 1 mark

    Update the Stack pointer

  • 1 mark

    Repeat until the queue is empty

6a · 4 marks

  • 1 mark

    boundary/extreme/normal : 0 / 1 : data item is accepted

  • 1 mark

    boundary/extreme/normal : 59 / 60 : data item is accepted

  • 1 mark

    abnormal : >= 61 : data item is rejected

  • 1 mark

    normal : 15 : data item is accepted

6b · 8 marks

  • 1 mark

    Procedure heading and ending

  • 1 mark

    Conditional loop correctly formed including Boolean flag declared and initialised

  • 1 mark

    An inner loop

  • 1 mark

    Correct range 1 to 1999 for inner loop

  • 1 mark

    Comparison of element J with J+1 in a loop

  • 1 mark

    Declare Temp variable and swap elements in a loop

  • 1 mark

    Both SensorID and Speed values were swapped in a loop

  • 1 mark

    'No-Swap' mechanism: Conditional outer loop including flag reset, and Flag set in inner loop to indicate swap

7a · 6 marks

  • 1 mark

    Function header and ending and parameters and return type

  • 1 mark

    Number of coffees ordered added to points

  • 1 mark

    Correct calculation of one free coffee

  • 1 mark

    Attempted calculation of multiple free coffees and reduced NewPoints

  • 1 mark

    Output number of free drinks with suitable message

  • 1 mark

    Return of NewPoints

7b(i) · 8 marks

  • 1 mark

    All variables used are declared using the correct type including a string and an integer

  • 1 mark

    Open file in read mode and close (before opening in append mode)

  • 1 mark

    Conditional loop with EOF("Loyalty.txt")

  • 1 mark

    Read Line from file // Count number of records in the file

  • 1 mark

    Open the file in append mode and subsequently close

  • 1 mark

    Extract CustomerID from Line and convert to integer // use count from MP4 to generate last CustomerID stored

  • 1 mark

    A (count controlled) loop for the number of customers to add

  • 1 mark

    Increment CustomerID and output the new CustomerID in loop

  • 1 mark

    Create string for new CustomerID and write to file in loop

7b(ii) · 4 marks

  • 1 mark

    Check if the text file loyalty.txt exists / is empty

  • 1 mark

    If file does not exist it must be created (using write mode)

  • 1 mark

    If the file has to be created / is empty then set the first CustomerID to 100001

  • 1 mark

    Write "100001,0" to loyalty.txt (using write mode)

  • 1 mark

    For all but the first customer (to be added to the empty file) use the existing code / module

Questions

  1. 1
    Question 112 marks
    Mark scheme ›
  2. 2
    Question 210 marks
    Mark scheme ›
  3. 3
    Question 38 marks
    Mark scheme ›
  4. 4
    Question 48 marks
    Mark scheme ›
  5. 5
    Question 57 marks
    Mark scheme ›
  6. 6
    Question 612 marks
    Mark scheme ›
  7. 7
    Question 718 marks
    Mark scheme ›

More 9618 papers

Other papers from May/June 2025

Solve it on ExamPalStart