A Level Computer Science 9618 Paper 41, May/June 2026

Question paper and mark scheme75 marks3 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/41 · May/June 2026

Download PDF
1

A program stores integer data in a linear queue. The queue is created as a global 1D array with space for 10 elements. The queue has a global head pointer, initialised to –1, that points to the first element in the queue. The queue has a global tail pointer, initialised to –1, that points to the last element in the queue.

a

The main program initialises the 10 elements of the queue to –1 and initialises the two pointers. Write program code to declare the global variables and initialise the queue and its pointers. Save your program as Question1_J26. Copy and paste the program code into 1(a) in the evidence document.

[3]
b

The function Enqueue() performs these tasks: • takes an integer parameter • checks if the queue is full • returns Boolean FALSE, if the queue is full • stores the parameter in the queue, updates the appropriate pointer(s) and returns Boolean TRUE, if the queue is not full. Write program code for Enqueue() Save your program. Copy and paste the program code into 1(b) in the evidence document.

[7]
c(i)

Write program code to extend the main program to: • take 11 integers as input from the user • use the appropriate function to insert each integer into the queue • output a message if at any point the queue is full • output the final content of the queue array. Do not dequeue the data. You do not need to validate the data input. Save your program. Copy and paste the program code into 1(c)(i) in the evidence document.

[5]
c(ii)

Test your program. Enter the following data as input in the order given: 1 2 3 4 5 6 7 8 9 10 11 Take a screenshot of the output(s). Save your program. Copy and paste the screenshot into 1(c)(ii) in the evidence document.

[1]
d

The function Dequeue(): • returns –1 if the queue is empty • updates the pointer(s) and returns the next item from the queue if the queue is not empty. Write program code for Dequeue() Save your program. Copy and paste the program code into 1(d) in the evidence document.

[6]
e(i)

Write program code to amend the main program to: • take 6 integers as input from the user and store them in the queue using the appropriate function • use the appropriate function to remove 4 elements from the queue • output each removed element from the queue. Save your program. Copy and paste the program code into 1(e)(i) in the evidence document.

[3]
e(ii)

Test your program. Enter the following data as input in the order given: 100 10 5 6 18 68 Take a screenshot of the output(s). Save your program. Copy and paste the screenshot into 1(e)(ii) in the evidence document.

[1]
2

A program stores data about toys that are made from bricks. The toys are stored in a record structure with four fields: • ToyName: the string name of the toy • NumberBricks: the integer number of bricks in the toy • Difficulty: the string difficulty level of the toy (easy, medium or expert) • Category: the string category of the toy (for example town, display, play).

a

Write program code to declare a record structure with the identifier ToyRecord and the four fields. Save your program as Question2_J26. Copy and paste the program code into 2(a) in the evidence document.

[2]
b(i)

The text file Toys.txt stores data about 16 toys. Each toy is on a new line in the file. The data is stored in the order: toy name, number of bricks, difficulty, category. Each value is separated by a comma. For example, the first line in the file is: Fire Station,3981,Expert,Town The name of the toy is Fire Station. The toy has 3981 bricks. The difficulty level is Expert. The category is Town. The function ReadData(): • takes an array of type ToyRecord as a parameter • opens the file Toys.txt and reads in the data • creates a new record of type ToyRecord for each toy read from the file • stores each record in the parameter array • returns the populated array. The function uses exception handling when opening and reading from the file. Write program code for ReadData() Save your program. Copy and paste the program code into 2(b)(i) in the evidence document.

[8]
b(ii)

The procedure OutputToys() takes an array of type ToyRecord as a parameter and outputs the data for each toy in the array. Write program code for OutputToys() Save your program. Copy and paste the program code into 2(b)(ii) in the evidence document.

[3]
b(iii)

Write program code for the main program to: • declare an array of type ToyRecord with space for 16 elements • call the function ReadData() with the empty array and store the returned array • call OutputToys() with the returned array. Save your program. Copy and paste the program code into 2(b)(iii) in the evidence document.

[3]
b(iv)

Test your program. Take a screenshot of the output(s). Save your program. Copy and paste the screenshot into 2(b)(iv) in the evidence document.

[1]
c(i)

The program needs to allow a user to enter the difficulty level of a toy and then write all toys that match that difficulty level to an external text file. The function SearchToys(): • takes an array of type ToyRecord as a parameter • prompts the user to enter the difficulty level • takes the difficulty level as input until it is valid • creates a new array containing the ToyRecord objects that match the difficulty level input • returns the populated array. Write program code for SearchToys() Save your program. Copy and paste the program code into 2(c)(i) in the evidence document.

[5]
c(ii)

The procedure WriteToys(): • takes an array of type ToyRecord as a parameter • creates and opens the file SelectedToys.txt to write • writes each record from ToyRecord to SelectedToys.txt with each field separated by a comma and each record on a new line. For example: <ToyName>,<NumberBricks>,<Difficulty>,<Category> Write program code for WriteToys() Save your program. Copy and paste the program code into 2(c)(ii) in the evidence document.

[3]
c(iii)

Write program code to extend the main program to: • call SearchToys() with the populated array and store the return array • call WriteToys() with the returned array. Save your program. Copy and paste the program code into 2(c)(iii) in the evidence document.

[2]
c(iv)

Test your program. Enter the appropriate input for a medium difficulty level when prompted. Take one screenshot of the text file the program produces with the contents and filename clearly visible. Save your program. Copy and paste the screenshot into 2(c)(iv) in the evidence document.

[1]
3

A prototype for a game is designed using Object-Oriented Programming (OOP). The game will allow a character to move along a path (for example a road or sidewalk). The prototype requires the classes setting up and the path creating ready for the character to be implemented. (a) Each space in the path can contain an object. The path and objects are created as classes. The class TheObject stores the data about the objects. The attributes are public. TheObject ObjectType : String | stores the type of object, either "Money" or "Experience" Amount : Integer | stores the amount of the object, for example 200 Constructor() | initialises the attributes to the parameter values The class Path stores the data about the objects. The attributes are public. Path BoardArray[0:99] : TheObject | an array of 100 objects of type TheObject NumberSpaces : Integer | stores the number of spaces in the path Constructor() | initialises NumberSpaces to the parameter value. Initialises all 100 array objects to an empty object of type TheObject. An empty object has the values ObjectType = "" and Amount = –1 GetNumberSpaces() | returns NumberSpaces InitialiseData() | takes an array of objects of type TheObject as a parameter and stores them in BoardArray ReturnPath() | returns a string created using data from each object in BoardArray GetPathObject() | takes a number as a parameter and returns the object in that index in BoardArray

a(i)

Write program code to declare the class TheObject and its constructor. Use your programming language appropriate constructor. If you are writing in Python, include attribute declarations using comments. Save your program as Question3_J26. Copy and paste the program code into 3(a)(i) in the evidence document.

[4]
a(ii)

Write program code to declare the class Path, its constructor and method GetNumberSpaces() Use your programming language appropriate constructor. Do not declare the other methods. If you are writing in Python, include attribute declarations using comments. Save your program. Copy and paste the program code into 3(a)(ii) in the evidence document.

[4]
a(iii)

The method InitialiseData() takes an array of type TheObject as a parameter. The method stores each element from the parameter array into the array BoardArray in the same order. If there are more objects in the parameter array than in NumberSpaces, the method does not store the data and returns FALSE. Otherwise, it returns TRUE Write program code for InitialiseData() Save your program. Copy and paste the program code into 3(a)(iii) in the evidence document.

[3]
a(iv)

The method ReturnPath() creates and returns a string containing the type and amount of each object that is not a null object in BoardArray, in the format: <ObjectType>-<Amount> For example, an array with two not null objects produces the string: Money-100 Experience-50 You can assume that there will always be an object that is not null in BoardArray Write program code for ReturnPath() Save your program. Copy and paste the program code into 3(a)(iv) in the evidence document.

[2]
a(v)

The method GetPathObject() takes an integer index as a parameter and returns the object at the parameter index in BoardArray Write program code for GetPathObject() Save your program. Copy and paste the program code into 3(a)(v) in the evidence document.

[1]
b(i)

Write program code for the main program to: • create a new array, ArrayOfObjects, of type TheObject with five spaces • store the following objects in each space in ArrayOfObjects in the order given: money with amount 50 experience with amount 100 money with amount 200 money with amount 20 experience with amount 30 • create a new object, Path1, of type Path with five spaces • call InitialiseData() for Path1 with ArrayOfObjects • call ReturnPath() for Path1 and output the return value. Save your program. Copy and paste the program code into 3(b)(i) in the evidence document.

[6]
b(ii)

Test your program. Take a screenshot of the output(s). Save your program. Copy and paste the screenshot into 3(b)(ii) in the evidence document.

[1]

Mark scheme

9618/41 · May/June 2026

Download PDF

1a · 3 marks

  • 1 mark

    (Global) array of 10 integers

  • 1 mark

    (Global) head pointer and tail pointer both initialised to –1

  • 1 mark

    Queue values are initialised to –1

1b · 7 marks

  • 1 mark

    Enqueue header taking 1 (integer) parameter

  • 1 mark

    Checking if the queue is full …

  • 1 mark

    … returning False

  • 1 mark

    (otherwise) Storing parameter in tail pointer +1

  • 1 mark

    Incrementing tail pointer

  • 1 mark

    … returning True

  • 1 mark

    Dealing with first element and changing head pointer to be 0

1c(i) · 5 marks

  • 1 mark

    Taking 11 (integer) values as input

  • 1 mark

    … calling Enqueue() with each input

  • 1 mark

    Checking/storing return value …

  • 1 mark

    … output message if False is returned

  • 1 mark

    Output content of array in any form

1c(ii) · 1 mark

  • 1 mark

    1 mark for ss showing inputs and output

1d · 6 marks

  • 1 mark

    Dequeue header taking no parameter

  • 1 mark

    Checking if queue is empty (e.g. TailPointer == -1 or HeadPointer > TailPointer) …

  • 1 mark

    … returning –1

  • 1 mark

    (otherwise) accessing data at head pointer …

  • 1 mark

    … and returning

  • 1 mark

    Incrementing HeadPointer (before any return)

1e(i) · 3 marks

  • 1 mark

    Taking 6 integers as input and storing in the queue

  • 1 mark

    Calling Dequeue() 4 times and storing/using return value

  • 1 mark

    Outputs each removed element from the queue

1e(ii) · 1 mark

  • 1 mark

    1 mark for ss showing inputs and output

2a · 2 marks

  • 1 mark

    Record structure / class with identifier ToyRecord

  • 1 mark

    Four fields declared/initialised

2b(i) · 8 marks

  • 1 mark

    Function header taking parameter and returning populated array

  • 1 mark

    Exception handling with suitable output (all file handling inside try)

  • 1 mark

    Opening the file

  • 1 mark

    …closing the file in an appropriate place

  • 1 mark

    Looping until EOF/16 times and reading in each line

  • 1 mark

    Splitting data by comma (and removing new line)

  • 1 mark

    Creating new ToyRecord with data // updating pre-existing record

  • 1 mark

    Appending each record to array

2b(ii) · 3 marks

  • 1 mark

    Procedure header, taking array parameter

  • 1 mark

    Looping through each array element …

  • 1 mark

    …outputting the data

2b(iii) · 3 marks

  • 1 mark

    Declaring array of (16 ToyRecord elements)

  • 1 mark

    Calling ReadData() with empty array parameter and storing return array

  • 1 mark

    Calling OutputToys() with returned array

2b(iv) · 1 mark

  • 1 mark

    1 mark for screenshot showing the toy data output

2c(i) · 5 marks

  • 1 mark

    Function header taking array of ToyRecord and returning a populated array

  • 1 mark

    Prompt to enter a difficulty level and reading as input …

  • 1 mark

    … repeatedly until valid

  • 1 mark

    Iterating through each element in array and comparing difficulty to input …

  • 1 mark

    … appending those that match to the new array

2c(ii) · 3 marks

  • 1 mark

    Procedure header taking array of type ToyRecord, opening and closing text file

  • 1 mark

    Looping through array and formatting the data correctly

  • 1 mark

    …writing each line to the file

  • 1 mark

    Exception handling with suitable catch and output

2c(iii) · 2 marks

  • 1 mark

    Calling SearchToys() with populated array and storing return array

  • 1 mark

    Calling WriteToys() with returned array

2c(iv) · 1 mark

  • 1 mark

    1 mark for screenshot of text file with correct name and content

3a(i) · 4 marks

  • 1 mark

    Class declaration (and end) with attributes

  • 1 mark

    Constructor header (and end)

  • 1 mark

    … taking 2 parameters …

  • 1 mark

    … assigning parameters to attributes

3a(ii) · 4 marks

  • 1 mark

    Class header (and end) and attributes including array

  • 1 mark

    Constructor taking 1 parameter and storing in NumberSpaces…

  • 1 mark

    … initialising empty objects to 100 spaces in BoardArray

  • 1 mark

    Get method with no parameter, returning attribute

3a(iii) · 3 marks

  • 1 mark

    Method header taking array as parameter

  • 1 mark

    If more elements, returning FALSE

  • 1 mark

    (otherwise) storing parameter elements in array and returning TRUE

3a(iv) · 2 marks

  • 1 mark

    Method header and returning string

  • 1 mark

    Creating string of all not null path objects type and amount

3a(v) · 1 mark

  • 1 mark

    Method header (and end) taking one parameter and returning array element at parameter

3b(i) · 6 marks

  • 1 mark

    Creating 5 objects of type TheObject

  • 1 mark

    …with correct values …

  • 1 mark

    … and storing in ArrayOfObjects

  • 1 mark

    Creating new instance of Pathwith 5 elements

  • 1 mark

    Calling InitialiseData for the path with ArrayOfObjects

  • 1 mark

    Outputting the path using return path

3b(ii) · 1 mark

  • 1 mark

    1 mark for screenshot showing the path

Questions

  1. 1
    Question 126 marks
    Mark scheme ›
  2. 2
    Question 228 marks
    Mark scheme ›
  3. 3
    Question 321 marks
    Mark scheme ›

More 9618 papers

Other papers from May/June 2026

Solve it on ExamPalStart