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

Download PDF
1

A program stores nine lower-case strings in a 1D array TheData. The following strings are stored in the order shown: laptop tablet printer computer processor monitor memory cable touchscreen

a

Write program code to declare the array TheData in the main program. Store the given strings in the array. Save your program as Question1_J26. Copy and paste the program code into 1(a) in the evidence document.

[2]
b(i)

The procedure FindLongestShortest(): • takes an array of strings as a parameter • finds and outputs the longest string in the array of strings • finds and outputs the shortest string in the array of strings. All outputs must have appropriate messages. Do not use in-built functions to find the longest and shortest string in the array. You may use an in-built length function to find the length of a string. You can assume that there will only be one string that has the shortest length. You can assume that there will only be one string that has the longest length. Write program code for FindLongestShortest() Save your program. Copy and paste the program code into 1(b)(i) in the evidence document.

[5]
b(ii)

Write program code to extend the main program to call FindLongestShortest() with TheData Save your program. Copy and paste the program code into 1(b)(ii) in the evidence document.

[1]
b(iii)

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

[1]
c(i)

The function InsertionSort(): • takes an array of strings as a parameter • sorts the strings in the array into ascending alphabetical order using an insertion sort • returns the sorted array. The function must work for an array of any length. Do not use an in-built function to sort the array. Write program code for InsertionSort() Save your program. Copy and paste the program code into 1(c)(i) in the evidence document.

[5]
c(ii)

Write program code to extend the main program to perform the following in the order shown: • output the string "Before sorting" • output the contents of the array TheData • call InsertionSort() with TheData as a parameter • output the string "After sorting" • output the contents of the returned sorted array. Save your program. Copy and paste the program code into 1(c)(ii) in the evidence document.

[3]
c(iii)

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

[1]
2

A program stores data about avatars in a program using Object-Oriented Programming (OOP). An avatar is a character that a user can control in a game. The class Avatar stores the data about avatars. Avatar TheName : String Glasses : Boolean Hair : String Age : Integer stores the name of the avatar stores TRUE if the avatar wears glasses stores FALSE if the avatar does not wear glasses stores the colour of the avatar's hair stores the age of the avatar Constructor() GetName() GetAge() MeetCriteria() initialises all attributes to its parameter values returns the name of the avatar returns the age of the avatar takes the glasses choice and hair choice as parameters and returns whether the avatar matches the choices

a(i)

Write program code to declare the class Avatar and its constructor. All attributes must be private. 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 Question2_J26. Copy and paste the program code into 2(a)(i) in the evidence document.

[4]
a(ii)

The get methods GetName() and GetAge() each return the relevant attribute. Write program code for GetName() and GetAge() Save your program. Copy and paste the program code into 2(a)(ii) in the evidence document.

[3]
a(iii)

The method MeetCriteria() takes two parameters: • a Boolean value to identify whether the avatar wears glasses • a string value to identify the hair colour. The method checks whether this avatar's attributes match both of the parameters. Boolean TRUE is returned when both of the attributes match the parameters, otherwise Boolean FALSE is returned. Write program code for MeetCriteria() Save your program. Copy and paste the program code into 2(a)(iii) in the evidence document.

[2]
b(i)

The text file AvatarFile.txt stores data for 30 avatars. Each avatar is on a new line in the file. The data is stored in the order: name, glasses, hair colour, age. Each value is separated by a space. For example, the first line in the file is: Kit True blonde 21 The name of the avatar is Kit, the avatar wears glasses, the avatar has blonde hair, the avatar is 21 years old. The procedure LoadAvatars() reads the data from the text file into the program. The function creates a new object for each avatar in the file and stores the avatar objects in a global array with the identifier AvailableAvatars The procedure uses exception handling when opening and reading from the file. Write program code for LoadAvatars() Save your program. Copy and paste the program code into 2(b)(i) in the evidence document.

[7]
b(ii)

Write program code for the main program to call LoadAvatars() Save your program. Copy and paste the program code into 2(b)(ii) in the evidence document.

[1]
c(i)

The procedure EnterChoices() prompts the user to enter whether they want an avatar that wears glasses and the hair colour they want. The procedure takes these two values as input until they are valid: • wearing glasses can only be yes or no • the hair colour can be black, blonde, brown, pink, red or green. The procedure calls the method MeetCriteria() for each avatar in AvailableAvatars and stores the avatars that match the criteria in a global array. Write program code for EnterChoices() Save your program. Copy and paste the program code into 2(c)(i) in the evidence document.

[6]
c(ii)

Write program code to extend the main program to: • call EnterChoices() • output the quantity of avatars that match the criteria • output the name and age of each avatar that matches the criteria. All outputs must include an appropriate message. Save your program. Copy and paste the program code into 2(c)(ii) in the evidence document.

[5]
d(i)

Test your program with the following data as input: Glasses choice: yes Hair colour first input: blue Hair colour second input: black Take a screenshot of the output(s). Save your program. Copy and paste the screenshot into 2(d)(i) in the evidence document.

[1]
d(ii)

Test your program with the following data as input: Glasses choice: no Hair colour: green Take a screenshot of the output(s). Save your program. Copy and paste the screenshot into 2(d)(ii) in the evidence document.

[1]
3

A 2D array is used to store the linked list, LinkedList. The linked list stores a maximum of eight data items. Each data item is an integer. The array elements not currently used in the linked list are stored as the empty list. LinkedList has two pointers: • StartLinkedList stores a pointer to the first node in the linked list • StartEmptyList stores a pointer to the first node in the empty list. A data value of -1 indicates there is no data in the node. A pointer of -1 indicates it is the end of the linked list, or the end of the empty list. The linked list and pointers all have global scope. The linked list already has the following data stored: array index | data | pointer 0 | 9512 | 5 1 | 5541 | 3 2 | 1999 | 0 3 | 6651 | -1 4 | -1 | 6 5 | 5612 | 1 6 | -1 | -1 7 | -1 | 4 StartLinkedList currently stores 2 StartEmptyList currently stores 7

a

Write program code to declare and initialise the linked list and the pointers. Save your program as Question3_J26. Copy and paste the program code into 3(a) in the evidence document.

[5]
b(i)

The procedure PrintListItems() outputs the data in each node of the linked list. The procedure starts with the first node in the linked list and follows the pointers until it has reached the end of the linked list. Write program code for PrintListItems() Save your program. Copy and paste the program code into 3(b)(i) in the evidence document.

[4]
b(ii)

The procedure PrintEmptyList() outputs the index of each node in the empty list. The procedure starts with the first node in the empty list and follows the pointers until it has output the index of each node in the empty list. Write program code for PrintEmptyList() Save your program. Copy and paste the program code into 3(b)(ii) in the evidence document.

[3]
b(iii)

Write program code to extend the main program to: • output "Linked list" and then call PrintListItems() • output "Empty list" and then call PrintEmptyList() Save your program. Copy and paste the program code into 3(b)(iii) in the evidence document.

[2]
b(iv)

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

[2]
c(i)

New nodes are inserted at the end of the linked list. The procedure AddItem() takes an integer parameter, inserts the parameter in the space identified by StartEmptyList and updates the appropriate pointer(s). If there is no space in the linked list, the procedure outputs "List is full" Write program code for AddItem() Save your program. Copy and paste the program code into 3(c)(i) in the evidence document.

[8]
c(ii)

Write program code to extend the main program to: • use AddItem() to insert a new node into the linked list with the data 8451 • output the new contents of the linked list using PrintListItems() with a suitable heading • output the new contents of the empty list using PrintEmptyList() with a suitable heading. Save your program. Copy and paste the program code into 3(c)(ii) in the evidence document.

[2]
c(iii)

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

[1]

Mark scheme

9618/42 · May/June 2026

Download PDF

1a · 2 marks

  • 1 mark

    Declaration of array with space for 9 strings (through declaration/initialisation)

  • 1 mark

    Storing the correct data in the order given

1b(i) · 5 marks

  • 1 mark

    Procedure header (and end where appropriate) taking one (string array) parameter

  • 1 mark

    Looping through each string in the array

  • 1 mark

    Finding the shortest string

  • 1 mark

    Finding the longest string

  • 1 mark

    Output the longest and shortest string in appropriate messages

1b(ii) · 1 mark

  • 1 mark

    calling FindLongestShortest with array as parameter

1b(iii) · 1 mark

  • 1 mark

    1 mark for screenshot of output

1c(i) · 5 marks

  • 1 mark

    Function header (and end where appropriate) taking (string array) parameter

  • 1 mark

    Looping through each element in the array…

  • 1 mark

    …using insertion sort method e.g. taking element out and moving down

  • 1 mark

    Using appropriate string comparison function/methods

  • 1 mark

    Returning a correctly sorted array

1c(ii) · 3 marks

  • 1 mark

    Outputting "Before sorting" and the array contents before sorting

  • 1 mark

    Calling InsertionSort() with array and storing/using returned array

  • 1 mark

    Outputting "After sorting" and the array contents after sorting

1c(iii) · 1 mark

  • 1 mark

    1 mark for output showing unsorted and then sorted array

2a(i) · 4 marks

  • 1 mark

    Four private attributes with correct data types

  • 1 mark

    Class Avatar header (and end where appropriate)

  • 1 mark

    Constructor header (and end where appropriate) within class taking 4 parameters (Python 5)

  • 1 mark

    Assigning parameters to attributes within constructor

2a(ii) · 3 marks

  • 1 mark

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

  • 1 mark

    … returning correct attribute

  • 1 mark

    2nd get method

2a(iii) · 2 marks

  • 1 mark

    Method header (and end where appropriate) taking two parameters (Boolean and string) and returning a Boolean in all cases

  • 1 mark

    Comparing parameters to correct attributes returning TRUE and FALSE correctly

2b(i) · 7 marks

  • 1 mark

    Procedure header (and end where appropriate) and appropriate exception handling with output

  • 1 mark

    Opening text file (to read) and closing file

  • 1 mark

    Looping until EOF/30 times…

  • 1 mark

    … reading in each line

  • 1 mark

    Splitting each line by space

  • 1 mark

    Instantiating object with correct values

  • 1 mark

    Storing each object in appropriate global array

2b(ii) · 1 mark

  • 1 mark

    1 mark for calling LoadAvatars()

2c(i) · 6 marks

  • 1 mark

    Procedure header (and end where appropriate) and prompting for 2 inputs and reading 2 inputs …

  • 1 mark

    … and validating appropriately

  • 1 mark

    Looping through each avatar in the array …

  • 1 mark

    … calling MeetCriteria() for each avatar and storing/using the return value

  • 1 mark

    … with correct values for glasses and hair

  • 1 mark

    … if return value is true, avatar is stored in a global array // reverse and delete

2c(ii) · 5 marks

  • 1 mark

    Calling EnterChoices()

  • 1 mark

    Counting/calculating the number of avatars and outputting

  • 1 mark

    Looping through each avatar that meets the criteria …

  • 1 mark

    …outputting the name and age in an appropriate message …

  • 1 mark

    …using get methods.

2d(i) · 1 mark

  • 1 mark

    1 mark for inputs and output For blue accept any invalid data

2d(ii) · 1 mark

  • 1 mark

    1 mark for inputs and output of 0 avatars

3a · 5 marks

  • 1 mark

    LinkedList 2D array with 8  2 elements (integer global)

  • 1 mark

    StartLinkedList (int) initialised with 2

  • 1 mark

    StartEmptyList (int) initialised with 7

  • 1 mark

    LinkedList initialised with correct data …

  • 1 mark

    … in correct indices

3b(i) · 4 marks

  • 1 mark

    Procedure header (and end where appropriate) and starting at StartLinkedList

  • 1 mark

    Following pointers ….

  • 1 mark

    … outputting data of each node

  • 1 mark

    Stopping when empty node found // stopping when null pointer

3b(ii) · 3 marks

  • 1 mark

    Procedure header and starting at StartEmptyList

  • 1 mark

    Following pointers and outputting data

  • 1 mark

    Stopping correctly

3b(iii) · 2 marks

  • 1 mark

    Outputting Linked list then calling PrintListItems()

  • 1 mark

    Outputting Empty list then calling PrintEmptyList()

3b(iv) · 2 marks

  • 1 mark

    1 mark for output of linked list data

  • 1 mark

    1 mark for output of empty list data

3c(i) · 8 marks

  • 1 mark

    Procedure header taking one (integer) parameter

  • 1 mark

    Checking if list is full (e.g. if StartEmptyList != -1) …

  • 1 mark

    …and outputting "List is full"

  • 1 mark

    Storing node in StartEmptyList index …

  • 1 mark

    …with pointer -1 (may be done at separate position in algorithm)

  • 1 mark

    Starting at first node (StartLinkedList) …

  • 1 mark

    …following pointers until empty node

  • 1 mark

    Changing last pointer to StartEmptyList (or temp)

  • 1 mark

    Updating StartEmptyList to previous (could be temp) node's pointer

3c(ii) · 2 marks

  • 1 mark

    Calling AddItem() with parameter 8451

  • 1 mark

    Calling both output procedures with suitable headings

3c(iii) · 1 mark

  • 1 mark

    1 mark for output showing updated linked list contents and empty list

Questions

  1. 1
    Question 118 marks
    Mark scheme ›
  2. 2
    Question 230 marks
    Mark scheme ›
  3. 3
    Question 327 marks
    Mark scheme ›

More 9618 papers

Other papers from May/June 2026

Solve it on ExamPalStart