A Level Computer Science 9618 Paper 43, Oct/Nov 2025

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/43 · Oct/Nov 2025

Download PDF
1

A program stores data for a board game using Object-Oriented Programming (OOP). The game has objects that are placed on the board. Each object has a string code (for example "A") and an integer value (for example, 2). The class BoardObject stores the data about the objects that can be placed on the board: BoardObject Code : String | stores the board object's code Value : Integer | stores the integer value of the board object Constructor() | initialises the attributes to the parameter values GetCode() | returns Code GetValue() | returns Value

a(i)

(a) (i) Write program code to declare the class BoardObject and its constructor. Do not declare the other methods. Use your programming language appropriate constructor. If you are writing in Python, include attribute declarations using comments. Save your program as Question1_N25. Copy and paste the program code into part 1(a)(i) in the evidence document.

[5]
a(ii)

(ii) The methods GetCode() and GetValue() return the appropriate attribute. Write program code for GetCode() and GetValue() Save your program. Copy and paste the program code into part 1(a)(ii) in the evidence document.

[3]
a(iii)

(iii) The table shows the code and value of five board objects. The table has the variable identifier where each of the objects are stored. Variable identifier | Code | Value Object1 | "A" | 2 Object2 | "B" | 3 Object3 | "C" | 5 Object4 | "D" | 2 Object5 | "E" | 7 Write program code for the main program to instantiate each of the five board objects and store them in the variables with the identifiers given. Save your program. Copy and paste the program code into part 1(a)(iii) in the evidence document.

[3]
b(i)

(b) The board objects are placed on a board that is represented by a 0-indexed 2D array: • the board is a 10 x 10 grid • each position on the board is identified by a row and column number • rows are numbered 0 to 9 • columns are numbered 0 to 9 • board objects can be placed at a row and column position • each board position is initialised with an empty BoardObject, an empty BoardObject has Code = "-" and Value = 0 For example, the element highlighted in the given board is in row 1 and column 3. The class Board stores the data about the board and where the board objects are placed. Board TheBoard : ARRAY[0:9, 0:9] of BoardObject | stores the board contents as a 2D array of 10 x 10 elements of type BoardObject Constructor() | initialises each of TheBoard elements to an empty BoardObject with Code = "-" and Value = 0 GetObject() | takes a row and column number as parameters and returns the BoardObject at the row, column position SetObject() | takes a BoardObject, row number and column number as parameters. Stores the BoardObject in TheBoard at the given row, column position DisplayBoard() | outputs the code of each BoardObject stored in TheBoard, one row at a time (i) Write program code to declare the class Board and its constructor. Do not declare the other methods. Use your programming language appropriate constructor. If you are writing in Python, include attribute declarations using comments. Save your program. Copy and paste the program code into part 1(b)(i) in the evidence document.

[4]
b(ii)

(ii) The method GetObject() takes a row number and column number as parameters. The method returns the BoardObject stored at the parameter position. Write program code for GetObject() Save your program. Copy and paste the program code into part 1(b)(ii) in the evidence document.

[2]
b(iii)

(iii) The method SetObject() takes three parameters: a BoardObject, row number and column number. The method stores the BoardObject parameter in the row, column position in TheBoard Write program code for SetObject() Save your program. Copy and paste the program code into part 1(b)(iii) in the evidence document.

[2]
b(iv)

(iv) The method DisplayBoard() outputs the Code of each BoardObject stored in TheBoard using GetCode() Each row in TheBoard is output on one line with a space between each Code For example, the following board contains these four board objects: • one object has code "A" in row 0 column 7 • one object has code "B" in row 0 column 9 • one object has code "C" in row 1 column 1 • one object has code "E" in row 6 column 5 The other board objects are empty. The output for this board will be: - - - - - - - A - B - C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - E - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Write program code for DisplayBoard() Save your program. Copy and paste the program code into part 1(b)(iv) in the evidence document.

[3]
c(i)

(c) (i) The table gives the row and column position on the board to store each of the five objects created in part 1(a)(iii). Object identifier | row position | column position Object1 | 0 | 0 Object2 | 9 | 9 Object3 | 4 | 5 Object4 | 2 | 2 Object5 | 8 | 7 Write program code to amend the main program to: • declare a new instance of Board() • store each BoardObject in the position given in the table • call DisplayBoard() for the new board object. Save your program. Copy and paste the program code into part 1(c)(i) in the evidence document.

[3]
c(ii)

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

[1]
d(i)

(d) (i) Amend the main program to: • repeatedly take a row position as input until it is between 0 and 9 inclusive • repeatedly take a column position as input until it is between 0 and 9 inclusive • use the appropriate method(s) to identify if there is an object in the array position input • output "Miss" if there is an empty BoardObject in that position • output the Code and Value if there is a non-empty BoardObject in that position. All outputs must include appropriate messages. Save your program. Copy and paste the program code into part 1(d)(i) in the evidence document.

[4]
d(ii)

(ii) Test your program by entering this test data in the order given: Row position first input: 10 Row position second input: 4 Column position first input: –1 Column position second input: 5 Take a screenshot of the output(s). Save your program. Copy and paste the screenshot(s) into part 1(d)(ii) in the evidence document.

[1]
2

A program reads string data from a text file into a linear queue and then compresses the data. The queue is created using the global 1D array Queue. The queue can store up to 100 elements. Each element is initialised to the empty string "" The queue has two pointers that are global to the program: • QueueHead that points to the index of the first element in the queue, initialised to –1 • QueueTail that points to the index of the last element in the queue, initialised to –1 The global variable NumberItems stores the number of elements stored in the queue, initialised to 0

a

(a) Write program code to declare and initialise Queue, QueueHead, QueueTail and NumberItems Save your program as Question2_N25. Copy and paste the program code into part 2(a) in the evidence document.

[2]
b

(b) The function Enqueue() takes a string as a parameter. The function checks if the queue is full, and returns Boolean FALSE if the queue is full. If the queue is not full, the parameter is inserted into the next position in Queue. The function updates the appropriate pointer(s), updates NumberItems and then returns Boolean TRUE Write program code for Enqueue() Save your program. Copy and paste the program code into part 2(b) in the evidence document.

[5]
c

(c) The function Dequeue() returns the string "False" if the queue is empty. If the queue is not empty, the function returns the next element in the queue. The function updates the appropriate pointer(s) and updates NumberItems Write program code for Dequeue() Save your program. Copy and paste the program code into part 2(c) in the evidence document.

[3]
d

(d) The text file BinaryData.txt stores individual binary digits, '1' and '0'. Each digit is on a new line. For example, the first line in the text file stores '1', the second line stores '1' The procedure ReadData() reads in each line from the text file BinaryData.txt and inserts it into the queue using the appropriate method. The procedure needs to work for a text file with any number of lines up to a maximum of 100. Write program code for ReadData() Save your program. Copy and paste the program code into part 2(d) in the evidence document.

[5]
e

(e) The string data in the text file is compressed. The compression algorithm counts the number of times each binary digit appears consecutively, then stores the binary digit followed by the number of times it appears. The algorithm stores the compressed data in a single string. For example, if the text file contains the data: 1 1 0 0 0 1 1 1 The compression algorithm will create the string "120313" because there are two '1' digits, followed by three '0' digits, followed by three '1' digits. The procedure Compress() uses Dequeue() to remove each element from the queue in turn. The procedure then compresses the data following the compression algorithm described. The new compressed string is stored in the global variable NewString You can assume that one binary digit will never appear more than nine times consecutively in the sequence. You can assume that there will always be at least one item in the queue. Write program code for Compress() Save your program. Copy and paste the program code into part 2(e) in the evidence document.

[6]
f(i)

(f) (i) Write program code for the main program to: • call ReadData() • call Compress() • output the content of the compressed string. Save your program. Copy and paste the program code into part 2(f)(i) in the evidence document.

[2]
f(ii)

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

[1]
3

A program is written to perform different individual processes using arrays.

a(i)

(a) A 1D array stores 10 integers. (i) A recursive function RecursiveCount() takes three parameters: • ArrayCopy, an array of integers • NumberElements, the number of elements in the array of integers • DataToFind, an integer data to find in the array. The function counts and returns the number of times DataToFind is in ArrayCopy The recursive algorithm: • returns 0 if there are no elements in ArrayCopy • compares the first element in ArrayCopy with DataToFind ◦ if the element matches, the function returns 1 added to the return value from a recursive call (passing the array without the first element) ◦ if the element does not match, the function returns the return value from a recursive call (passing the array without the first element). Write program code for RecursiveCount() Save your program as Question3_N25. Copy and paste the program code into part 3(a)(i) in the evidence document.

[6]
a(ii)

(ii) The main program stores the following data in a 1D array of integers in the order given: 0 5 1 2 5 9 9 6 5 0 The main program calls RecursiveCount() with the parameters: • 0 as the data to find • 10 as the number of elements • the array of 10 integers. The return value is output. Write program code for the main program. Save your program. Copy and paste the program code into part 3(a)(ii) in the evidence document.

[3]
a(iii)

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

[1]
b(i)

(b) The program stores the following string. The string has four statements that are each terminated by a semi-colon ';' "x=0;y=1;x=x+y;y++;" (i) Write program code to amend the main program to store the string "x=0;y=1;x=x+y;y++;" in a local variable. Save your program. Copy and paste the program code into part 3(b)(i) in the evidence document.

[1]
b(ii)

(ii) The function SplitData() splits a string parameter into four individual lines of code. The function creates an array of the strings where each line is stored in a new array element without the semi-colon. The function returns the array of strings. Do not use an inbuilt function to split the string. Write program code for SplitData() Save your program. Copy and paste the program code into part 3(b)(ii) in the evidence document.

[6]
b(iii)

(iii) The main program needs to call SplitData() with the string from part 3(b)(i). The main program then needs to output each element from the returned array on a new line. Write program code to amend the main program. Save your program. Copy and paste the program code into part 3(b)(iii) in the evidence document.

[2]
b(iv)

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

[1]

Mark scheme

9618/43 · Oct/Nov 2025

Download PDF

1a(i) · 5 marks

  • 1 mark

    Class header (and end where appropriate)

  • 1 mark

    Declaring Code as string and Value as integer

  • 1 mark

    Constructor header (and end where appropriate) within class …

  • 1 mark

    … taking two parameters …

  • 1 mark

    … assigning parameters to attributes

1a(ii) · 3 marks

  • 1 mark

    1 get header (and end where appropriate) with no parameter …

  • 1 mark

    … returning correct value without overriding

  • 1 mark

    2nd correct get method

1a(iii) · 3 marks

  • 1 mark

    Creating one instance of BoardObject and storing in correct variable …

  • 1 mark

    … with correct parameters

  • 1 mark

    Remaining four created correctly and stored

1b(i) · 4 marks

  • 1 mark

    Class header (and end where appropriate)

  • 1 mark

    Constructor header (and end where appropriate) within class

  • 1 mark

    Declaration of 2D array with 10  10 elements of type BoardObject

  • 1 mark

    Storing BoardObject object with Code "-" and Value 0 in each array element

1b(ii) · 2 marks

  • 1 mark

    Get method header taking 2 (integer) parameters …

  • 1 mark

    … returning the BoardObject at Board position of parameters

1b(iii) · 2 marks

  • 1 mark

    Set method header taking three parameters (TheObject, row, column) …

  • 1 mark

    … storing parameter TheObject in TheBoard at parameters row and column

1b(iv) · 3 marks

  • 1 mark

    Method DisplayBoard() header (and end where appropriate) and using GetCode()

  • 1 mark

    Outputting Code of all BoardObject elements in both indices (10  10)

  • 1 mark

    … with each row on one line and space between each value

1c(i) · 3 marks

  • 1 mark

    Creating instance of Board and storing it

  • 1 mark

    Storing all 5 objects in correct positions

  • 1 mark

    Calling DisplayBoard()

1c(ii) · 1 mark

  • 1 mark

    1 mark for screenshot showing board contents

1d(i) · 4 marks

  • 1 mark

    Taking x-axis and y-axis as input repeatedly until each value is between 0 and 9 (inclusive)

  • 1 mark

    Calling Board.GetObject() with input x-axis and y-axis values …

  • 1 mark

    … checking if object exists e.g. if Code is "-"

  • 1 mark

    … outputting "Miss" if no BoardObject and outputting Code and Value in an appropriate message if there is a BoardObject

1d(ii) · 1 mark

  • 1 mark

    1 mark for screenshot showing inputs and correct output Row 10 4 Column -1 5 Output C 5

2a · 2 marks

  • 1 mark

    Queue declared as a (global) 1D array of 100 string elements all initialised to ""

  • 1 mark

    QueueHead and QueueTail initialised with –1, NumberItems initialised to 0

2b · 5 marks

  • 1 mark

    Function header (and end where appropriate) taking one (string) parameter and checking full and returning FALSE

  • 1 mark

    (otherwise) Storing parameter in QueueTail + 1

  • 1 mark

    Incrementing QueueTail and NumberItems

  • 1 mark

    (Dealing with first element) If QueueHead = –1 store 0 in QueueHead / increment QueueHead

  • 1 mark

    Return TRUE in all cases when inserted

2c · 3 marks

  • 1 mark

    Function header (and end), checking if Queue is empty (NumberItems = 0 or QueueHead > QueueTail) and returning "False"

  • 1 mark

    (otherwise) returning Queue[QueueHead]

  • 1 mark

    Incrementing QueueHead, decrementing NumberItems

2d · 5 marks

  • 1 mark

    Procedure header (and end where appropriate)

  • 1 mark

    Opening the file and closing the file (in appropriate place)

  • 1 mark

    Looping until EOF // looping through each line …

  • 1 mark

    … read in each value …

  • 1 mark

    … calling Enqueue() with read in value and store/use return value

  • 1 mark

    Exception handling with try except and appropriate output with all file access within try

2e · 6 marks

  • 1 mark

    Procedure header (and end where appropriate), storing final string compressed data in global variable

  • 1 mark

    Call Dequeue() and storing return value …

  • 1 mark

    … repeatedly until the return value == "False"

  • 1 mark

    Comparing new value with previous …

  • 1 mark

    … maintaining counter of number of occurrences …

  • 1 mark

    … appending digit and number of occurrences to a string without overriding

2f(i) · 2 marks

  • 1 mark

    Calling ReadData() then Compress()

  • 1 mark

    Outputting compressed string

2f(ii) · 1 mark

  • 1 mark

    1 mark for screenshot showing output

3a(i) · 6 marks

  • 1 mark

    Function header (and end) taking three parameters

  • 1 mark

    Checking number of elements for 0 and returning 0 (e.g. ArrayCopy = [] // len(ArrayCopy) == 0)

  • 1 mark

    (otherwise) comparing first array element to parameter DataToFind …

  • 1 mark

    … if match return recursive call adding 1

  • 1 mark

    … if no match return recursive call without adding 1

  • 1 mark

    … all recursive calls have array without first element, NumberElements-1 and DataToFind

3a(ii) · 3 marks

  • 1 mark

    Storing the correct data in an array

  • 1 mark

    Calling RecursiveCount() with the correct parameters

  • 1 mark

    Outputting the return value

3a(iii) · 1 mark

  • 1 mark

    1 mark for screenshot showing correct output of 2

3b(i) · 1 mark

  • 1 mark

    1 mark for storing the string in a variable

3b(ii) · 6 marks

  • 1 mark

    Function header, taking one string parameter

  • 1 mark

    Loop e.g. four times/through each character in parameter

  • 1 mark

    Comparing character from parameter to ';' …

  • 1 mark

    … concatenate current character to a string until ';' is found

  • 1 mark

    … when ';' found storing string in array

  • 1 mark

    Returning string array without semicolons

3b(iii) · 2 marks

  • 1 mark

    Calling SplitData() with array as argument and storing/using return value

  • 1 mark

    Outputting each element of the returned array on a new line

3b(iv) · 1 mark

  • 1 mark

    1 mark for output x=0 y=1 x=x+y y++

Questions

  1. 1
    Question 131 marks
    Mark scheme ›
  2. 2
    Question 224 marks
    Mark scheme ›
  3. 3
    Question 320 marks
    Mark scheme ›

More 9618 papers

Other papers from Oct/Nov 2025

Solve it on ExamPalStart