9618/42 · May/June 2026 · Worked solutions

Step-by-step solutions based on the mark scheme (not a mark-scheme dump).

Question 1

Part 1(a) — solution

  1. Declaration of array with space for 9 strings (through declaration/initialisation)
  2. Storing the correct data in the order given

Visual Basic (VB.NET)

Dim TheData(8) As String
                  TheData(0) = "laptop"
                  TheData(1) = "tablet"
                  TheData(2) = "printer"
                  TheData(3) = "computer"
                  TheData(4) = "processor"
                  TheData(5) = "monitor"
                  TheData(6) = "memory"
                  TheData(7) = "cable"
                  TheData(8) = "touchscreen"

Python

TheData = ["laptop", "tablet", "printer", "computer", "processor", "monitor", "memory", "cable",
                  "touchscreen"]

Mark points

  • Declaration of array with space for 9 strings (through declaration/initialisation)
  • Storing the correct data in the order given

Part 1(b)(i) — solution

  1. Procedure header (and end where appropriate) taking one (string array) parameter
  2. Looping through each string in the array
  3. Finding the shortest string
  4. Finding the longest string
  5. Output the longest and shortest string in appropriate messages

Visual Basic (VB.NET)

Sub FindLongestShortest(TheData())
                      Dim LongestLength As Integer = -1
                      Dim LongestWord As String = ""
                      Dim ShortestLength As Integer = 999
                      Dim ShortestWord As String = ""

                                 For x = 0 To TheData.Length() - 1
                                     If Len(TheData(x)) > LongestLength Then
                                         LongestLength = Len(TheData(x))
                                         LongestWord = TheData(x)
                                     End If
                                     If Len(TheData(x)) < ShortestLength Then
                                         ShortestLength = Len(TheData(x))
                                         ShortestWord = TheData(x)
                                     End If
                                 Next

                University Press & Assessment 2026                                                                         Page 8 of 41

Trace ID: PC-AB1FFDFB16
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/42 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                     9618/42 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/42                                                                                          Cambridge International AS & A Level – Mark Scheme                           May/June 2026

                     Guidance

                      Console.WriteLine("The longest word is " & LongestWord)
                      Console.WriteLine("The shortest word is " & ShortestWord)
                  End Sub

Python

def FindLongestShortest(TheData):
                       LongestLength = -1
                       LongestWord = ""
                       ShortestLength = 999999999
                       ShortestWord = ""

                                 for x in range(len(TheData)):
                                     if len(TheData[x]) > LongestLength:
                                         LongestLength = len((TheData[x]))
                                         LongestWord = TheData[x]
                                     if len(TheData[x]) < ShortestLength:
                                         ShortestLength = len(TheData[x])
                                         ShortestWord = TheData[x]
                                 print("The longest word is", LongestWord)
                                 print("The shortest word is", ShortestWord)

Mark points

  • Procedure header (and end where appropriate) taking one (string array) parameter
  • Looping through each string in the array
  • Finding the shortest string
  • Finding the longest string
  • Output the longest and shortest string in appropriate messages

Part 1(b)(ii) — solution

  1. calling FindLongestShortest with array as parameter

Visual Basic (VB.NET)

FindLongestShortest(TheData)

Python

FindLongestShortest(TheData)

Mark points

  • calling FindLongestShortest with array as parameter

Part 1(b)(iii) — solution

1 mark for screenshot of output 1 Example output

Mark points

  • Include the ideas shown in the solution above.

Part 1(c)(i) — solution

  1. Function header (and end where appropriate) taking (string array) parameter
  2. Looping through each element in the array…
  3. …using insertion sort method e.g. taking element out and moving down
  4. Using appropriate string comparison function/methods
  5. Returning a correctly sorted array

Visual Basic (VB.NET)

Function InsertionSort(TheData())
                      Dim ArrayLength As Integer = TheData.Length()
                      Dim Temp As String
                      Dim y As Integer
                      If ArrayLength <= 1 Then
                          Return TheData
                      End If
                      For x = 1 To ArrayLength - 1
                          Temp = TheData(x)
                          y = x - 1
                          While y >= 0
                              If Temp < TheData(y) Then
                                  TheData(y + 1) = TheData(y)
                                  y = y - 1
                              Else
                                  Exit While
                              End If
                          End While
                          TheData(y + 1) = Temp

                University Press & Assessment 2026                                                                       Page 11 of 41

Trace ID: PC-AB1FFDFB16
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/42 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/42 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/42                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

                      Next
                      Return TheData
                  End Function

Python

def InsertionSort(TheData):
                       ArrayLength = len(TheData)
                       if ArrayLength <= 1:
                           return TheData
                       for x in range(1, ArrayLength):
                           Temp = TheData[x]
                           y = x-1
                           while y >= 0 and Temp < TheData[y]:
                                TheData[y+1] = TheData[y]
                                y -= 1
                           TheData[y+1] = Temp
                       return TheData

Mark points

  • Function header (and end where appropriate) taking (string array) parameter
  • Looping through each element in the array…
  • …using insertion sort method e.g. taking element out and moving down
  • Using appropriate string comparison function/methods
  • Returning a correctly sorted array

Part 1(c)(ii) — solution

  1. Outputting "Before sorting" and the array contents before sorting
  2. Calling InsertionSort() with array and storing/using returned array
  3. Outputting "After sorting" and the array contents after sorting

Visual Basic (VB.NET)

Console.WriteLine("Before sorting")
                  For x = 0 To 8
                       Console.WriteLine(TheData(x))
                  Next
                  Console.WriteLine("After sorting")
                  TheData = InsertionSort(TheData)
                  For x = 0 To 8
                       Console.WriteLine(TheData(x))
                  Next

Python

print("Before Sorting")
                  print(TheData)
                  print("After sorting")
                  TheData = InsertionSort(TheData)
                  print(TheData)

Mark points

  • Outputting "Before sorting" and the array contents before sorting
  • Calling InsertionSort() with array and storing/using returned array
  • Outputting "After sorting" and the array contents after sorting

Part 1(c)(iii) — solution

1 mark for output showing unsorted and then sorted array 1 FT data in array and output messages University Press & Assessment 2026 Page 14 of 41 Trace ID: PC-AB1FFDFB16 Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable. Licensed for hosting on papacambridge.com only. PapaCambridge 9618/42 Mark Scheme June · papacambridge.com 2026 | Source: papacambridge.com 9618/42 Mark Scheme June 2026 Downloaded from PapaCambridge - https://papacambridge.com/ 9618/42 Cambridge International AS & A Level – Mark Scheme May/June 2026 Guidance

Mark points

  • Include the ideas shown in the solution above.

Part 1 — solution

mark for output of empty list data University Press & Assessment 2026 Page 36 of 41 Trace ID: PC-AB1FFDFB16 Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable. Licensed for hosting on papacambridge.com only. PapaCambridge 9618/42 Mark Scheme June · papacambridge.com 2026 | Source: papacambridge.com 9618/42 Mark Scheme June 2026 Downloaded from PapaCambridge - https://papacambridge.com/ 9618/42 Cambridge International AS & A Level – Mark Scheme May/June 2026 Guidance

Mark points

  • Include the ideas shown in the solution above.

Question 2

Part 2(a)(i) — solution

  1. Four private attributes with correct data types
  2. Class Avatar header (and end where appropriate)
  3. Constructor header (and end where appropriate) within class taking 4 parameters (Python 5)
  4. Assigning parameters to attributes within constructor

Visual Basic (VB.NET)

Class Avatar
                      Private TheName As String
                      Private Glasses As Boolean
                      Private Hair As String
                      Private Age As Integer

                      Public Sub New(pName, pGlasses, pHair, pAge)
                          TheName = pName
                          Glasses = pGlasses
                          Hair = pHair
                          Age = pAge
                      End Sub
                  End Class

Python

5)
                                                    • Assigning parameters to attributes within constructor

                University Press & Assessment 2026                                                                       Page 15 of 41

Trace ID: PC-AB1FFDFB16
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/42 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/42 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/42                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

                  Example program code
                  Python
                  class Avatar():
                       def __init__(self, pName, pGlasses, pHair, pAge):
                           self.__TheName = pName    #name as string
                           self.__Glasses = pGlasses #glasses as boolean
                           self.__Hair = pHair #hairColour as string
                           self.__Age = pAge    #age as integer

Mark points

  • Four private attributes with correct data types
  • Class Avatar header (and end where appropriate)
  • Constructor header (and end where appropriate) within class taking 4 parameters (Python 5)
  • Assigning parameters to attributes within constructor

Part 2(a)(ii) — solution

  1. 1 get method header (and end where appropriate) with no parameter…
  2. … returning correct attribute
  3. 2nd get method

Visual Basic (VB.NET)

Public Function GetName()
                      Return TheName
                  End Function
                  Public Function GetAge()
                      Return Age
                  End Function

Python

def GetName(self):
                       return self.__TheName
                  def GetAge(self):
                       return self.__Age

Mark points

  • 1 get method header (and end where appropriate) with no parameter…
  • … returning correct attribute
  • 2nd get method

Part 2(a)(iii) — solution

  1. Method header (and end where appropriate) taking two parameters (Boolean and string) and Meetcritera
  2. Comparing parameters to correct attributes returning TRUE and FALSE correctly

Visual Basic (VB.NET)

Public Function MeetCriteria(pGlasses, pHair)
                      If Glasses = pGlasses And Hair = pHair Then
                          Return True
                      Else
                          Return False
                      End If
                  End Function

Python

def MeetCriteria(self, Glasses, Hair):
                           if self.__Glasses == Glasses and Hair == self.__Hair:
                                return True
                           else:
                                return False

Mark points

  • Method header (and end where appropriate) taking two parameters (Boolean and string) and Meetcritera
  • Comparing parameters to correct attributes returning TRUE and FALSE correctly

Part 2(b)(i) — solution

  1. Procedure header (and end where appropriate) and appropriate exception handling with output
  2. Opening text file (to read) and closing file
  3. Looping until EOF/30 times…
  4. … reading in each line
  5. Splitting each line by space
  6. Instantiating object with correct values
  7. Storing each object in appropriate global array

Visual Basic (VB.NET)

Public Sub LoadAvatars()
                      Dim TempData() As String
                      NumberAvatars = 0
                      Try
                          Dim FileReader As New System.IO.StreamReader("AvatarFile.txt")
                          While Not FileReader.EndOfStream
                              TempData = (FileReader.ReadLine()).Split(" ")
                              AvailableAvatars(NumberAvatars) = New Avatar(TempData(0), Convert.ToBoolean(TempData(1)),
                  TempData(2), Convert.ToInt32(TempData(3)))
                              NumberAvatars = NumberAvatars + 1
                          End While
                          FileReader.Close()
                      Catch ex As Exception
                          Console.WriteLine("Cannot open or read from file")
                      End Try
                  End Sub

                University Press & Assessment 2026                                                                       Page 20 of 41

Trace ID: PC-AB1FFDFB16
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/42 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/42 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/42                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

Python

def LoadAvatars():
                       global AvailableAvatars
                       try:
                           TheFile = open("AvatarFile.txt")
                           for Line in TheFile:
                                DataSplit = (Line.strip()).split(" ")
                                if DataSplit[1] == "True":
                                     DataSplit[1] = True
                                else:
                                     DataSplit[1] = False
                                AvailableAvatars.append(Avatar(DataSplit[0], bool(DataSplit[1]), DataSplit[2],
                  int(DataSplit[3])))
                           TheFile.close()
                       except:
                           print("File not found")
                       return AvailableAvatars

Mark points

  • Procedure header (and end where appropriate) and appropriate exception handling with output
  • Opening text file (to read) and closing file
  • Looping until EOF/30 times…
  • … reading in each line
  • Splitting each line by space
  • Instantiating object with correct values
  • Storing each object in appropriate global array

Part 2(b)(ii) — solution

1 mark for calling LoadAvatars() 1 Example program code Python LoadAvatars() VB.NET LoadAvatars()

Visual Basic (VB.NET)

LoadAvatars()

Python

LoadAvatars()

Mark points

  • Include the ideas shown in the solution above.

Part 2(c)(i) — solution

  1. Procedure header (and end where appropriate) and prompting for 2 inputs and reading 2 inputs … Meetcritera
  2. … and validating appropriately
  3. Looping through each avatar in the array …
  4. … calling MeetCriteria() for each avatar and storing/using the return value
  5. … with correct values for glasses and hair
  6. … if return value is true, avatar is stored in a global array // reverse and delete

Visual Basic (VB.NET)

Public Sub EnterChoices()
                          Dim Chosen As Boolean = False
                          Dim Valid As Boolean = False
                          Dim GlassesChoice As String = ""
                          Dim TheGlasses As String = ""
                          Dim HairChoice As Integer
                          Dim TheHair As String = ""
                          While Valid = False
                              Console.WriteLine("Do you want them to wear glasses")
                              GlassesChoice = Console.ReadLine()
                              If GlassesChoice = "yes" Then
                                  Valid = True
                                  TheGlasses = True
                              ElseIf GlassesChoice = "no" Then
                                  Valid = True
                                  TheGlasses = False
                              Else
                                  Console.WriteLine("Invalid, enter yes or no")
                              End If
                          End While

                          HairChoice = -1
                          While HairChoice < 1 Or HairChoice > 6
                              Console.WriteLine("What colour hair? 1 for black, 2 for blonde, 3 for brown, 4 for pink, 5 for
                  red, 6 for green")
                              HairChoice = Console.ReadLine()
                              If HairChoice = 1 Then
                                  TheHair = "black"
                              ElseIf HairChoice = 2 Then
                                  TheHair = "blonde"
                              ElseIf HairChoice = 3 Then
                                  TheHair = "brown"
                              ElseIf HairChoice = 4 Then
                                  TheHair = "pink"

                University Press & Assessment 2026                                                                       Page 24 of 41

Trace ID: PC-AB1FFDFB16
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/42 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/42 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/42                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

                                                               ElseIf HairChoice = 5 Then
                                                                   TheHair = "red"
                                                               ElseIf HairChoice = 6 Then
                                                                   TheHair = "green"

                                                    End If
                                                End While
                                                OptionNumberAvatars = 0
                                                For x = 0 To 29
                                                    If AvailableAvatars(x).MeetCriteria(TheGlasses, TheHair) Then
                                                        OptionAvatars(OptionNumberAvatars) = AvailableAvatars(x)
                                                        OptionNumberAvatars = OptionNumberAvatars + 1
                                                    End If
                                                Next

                                 End Sub

Python

def EnterChoices():
                       global AvailableAvatars
                       global OptionAvatars
                       global NumberAvatars
                       global OptionNumberAvatars
                       Chosen = False
                       Valid = False
                       while Valid == False:
                           GlassesChoice = input("Do you want them to wear glasses? ")
                           if GlassesChoice.lower() == "yes":
                                Valid = True
                                TheGlasses = True
                           elif GlassesChoice.lower() == "no":
                                Valid = True
                                TheGlasses = False
                           else:
                                print("Invalid, enter yes or no")

                      HairChoice = -1
                      while HairChoice < 1 or HairChoice > 6:
                          HairChoice = int(input("What colour hair? 1 for black, 2 for blonde, 3 for brown, 4 for pink, 5 for
                  red, 6 for green "))
                      if HairChoice == 1: TheHair = "black"
                      elif HairChoice == 2: TheHair = "blonde"
                      elif HairChoice == 3: TheHair = "brown"
                      elif HairChoice == 4: TheHair = "pink"
                      elif HairChoice == 5: TheHair = "red"
                      elif HairChoice == 6: TheHair = "green"

                                 for x in range(len(AvailableAvatars)):
                                     if AvailableAvatars[x].MeetCriteria(TheGlasses, TheHair):
                                         OptionAvatars.append(AvailableAvatars[x])
                                         OptionNumberAvatars = OptionNumberAvatars + 1

                University Press & Assessment 2026                                                                       Page 23 of 41

Trace ID: PC-AB1FFDFB16
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/42 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/42 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/42                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

Mark points

  • Procedure header (and end where appropriate) and prompting for 2 inputs and reading 2 inputs … Meetcritera
  • … and validating appropriately
  • Looping through each avatar in the array …
  • … calling MeetCriteria() for each avatar and storing/using the return value
  • … with correct values for glasses and hair
  • … if return value is true, avatar is stored in a global array // reverse and delete

Part 2(c)(ii) — solution

  1. Calling EnterChoices()
  2. Counting/calculating the number of avatars and outputting
  3. Looping through each avatar that meets the criteria …
  4. …outputting the name and age in an appropriate message …
  5. …using get methods

Visual Basic (VB.NET)

EnterChoices()
                   Console.WriteLine("There are" & OptionNumberAvatars & "avatars that meet your criteria")
                   If OptionNumberAvatars > 0 Then
                       For x = 0 To OptionNumberAvatars - 1
                           Console.WriteLine(OptionAvatars(x).GetName() & " who is " & OptionAvatars(x).GetAge() & " years
                  old")
                       Next
                   End If

Python

EnterChoices()
                  print("There are", len(OptionAvatars), "avatars that meet your criteria")
                  if len(OptionAvatars) > 0:
                       for x in range(len(OptionAvatars)):
                           print(OptionAvatars[x].GetName(),"who is", OptionAvatars[x].GetAge(), "years old")

Mark points

  • Calling EnterChoices()
  • Counting/calculating the number of avatars and outputting
  • Looping through each avatar that meets the criteria …
  • …outputting the name and age in an appropriate message …
  • …using get methods

Part 2(d)(i) — solution

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

Mark points

  • Include the ideas shown in the solution above.

Part 2(d)(ii) — solution

1 mark for inputs and output of 0 avatars 1 FT appropriate message University Press & Assessment 2026 Page 28 of 41 Trace ID: PC-AB1FFDFB16 Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable. Licensed for hosting on papacambridge.com only. PapaCambridge 9618/42 Mark Scheme June · papacambridge.com 2026 | Source: papacambridge.com 9618/42 Mark Scheme June 2026 Downloaded from PapaCambridge - https://papacambridge.com/ 9618/42 Cambridge International AS & A Level – Mark Scheme May/June 2026 Guidance

Mark points

  • Include the ideas shown in the solution above.

Question 3

Part 3(a) — solution

  1. LinkedList 2D array with 8  2 elements (integer global)
  2. StartLinkedList (int) initialised with 2
  3. StartEmptyList (int) initialised with 7
  4. LinkedList initialised with correct data …
  5. … in correct indices

Visual Basic (VB.NET)

Dim LinkedList(7, 1) As Integer
                  Dim StartLinkedList As Integer
                  Dim StartEmptyList As Integer
                  LinkedList(0, 0) = 9512
                  LinkedList(0, 1) = 5
                  LinkedList(1, 0) = 5541
                  LinkedList(1, 1) = 3
                  LinkedList(2, 0) = 1999
                  LinkedList(2, 1) = 0
                  LinkedList(3, 0) = 6651
                  LinkedList(3, 1) = -1
                  LinkedList(4, 0) = -1
                  LinkedList(4, 1) = 6
                  LinkedList(5, 0) = 5612
                  LinkedList(5, 1) = 1
                  LinkedList(6, 0) = -1
                  LinkedList(6, 1) = -1
                  LinkedList(7, 0) = -1
                  LinkedList(7, 1) = 4
                  StartLinkedList = 2
                  StartEmptyList = 7

                University Press & Assessment 2026                                                                       Page 30 of 41

Trace ID: PC-AB1FFDFB16
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/42 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/42 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/42                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

Python

LinkedList = []
                  LinkedList.append([9512,5])
                  LinkedList.append([5541,3])
                  LinkedList.append([1999,0])
                  LinkedList.append([6651,-1])
                  LinkedList.append([-1,6])
                  LinkedList.append([5612,1])
                  LinkedList.append([-1,-1])
                  LinkedList.append([-1,4])
                  StartLinkedList = 2
                  StartEmptyList = 7

Mark points

  • LinkedList 2D array with 8  2 elements (integer global)
  • StartLinkedList (int) initialised with 2
  • StartEmptyList (int) initialised with 7
  • LinkedList initialised with correct data …
  • … in correct indices

Part 3(b)(i) — solution

  1. Procedure header (and end where appropriate) and starting at StartLinkedList
  2. Following pointers …
  3. … outputting data of each node
  4. Stopping when empty node found // stopping when null pointer

Visual Basic (VB.NET)

Sub PrintListItems()
                      Dim TempPosition As Integer = StartLinkedList
                      While (LinkedList(TempPosition, 1) <> -1)
                          Console.WriteLine(LinkedList(TempPosition, 0))
                          TempPosition = LinkedList(TempPosition, 1)
                      End While
                      Console.WriteLine(LinkedList(TempPosition, 0))
                  End Sub

                University Press & Assessment 2026                                                                       Page 32 of 41

Trace ID: PC-AB1FFDFB16
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/42 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/42 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/42                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

Python

def PrintListItems():
                       global LinkedList
                       global StartEmptyList
                       global StartLinkedList
                       TempPosition = StartLinkedList
                       while LinkedList[TempPosition][1] != -1:
                           print(LinkedList[TempPosition][0])
                           TempPosition = LinkedList[TempPosition][1]
                       print(LinkedList[TempPosition][0])

                  Alternative Python:
                  def PrintListItems():
                        global StartLinkedList, LinkedList
                        node = StartLinkedList
                        while node != -1:
                             print(LinkedList[node][0])
                             node = LinkedList[node][1]

Mark points

  • Procedure header (and end where appropriate) and starting at StartLinkedList
  • Following pointers …
  • … outputting data of each node
  • Stopping when empty node found // stopping when null pointer

Part 3(b)(ii) — solution

  1. Procedure header and starting at StartEmptyList
  2. Following pointers and outputting data
  3. Stopping correctly

Visual Basic (VB.NET)

Sub PrintEmptyList()
                      Dim TempPosition = StartEmptyList
                      Dim Flag As Boolean = True

                      While Flag = True
                          If LinkedList(TempPosition, 1) = -1 Then
                              Flag = False
                          End If
                          Console.WriteLine(TempPosition)
                          TempPosition = LinkedList(TempPosition, 1)
                      End While
                  End Sub

                University Press & Assessment 2026                                                                       Page 34 of 41

Trace ID: PC-AB1FFDFB16
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/42 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/42 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/42                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

Python

def PrintEmptyList():
                       global LinkedList
                       global StartEmptyList

                                 TempPosition = StartEmptyList
                                 Flag = True
                                 while Flag == True:
                                     if LinkedList[TempPosition][1] == -1:
                                         Flag = False
                                     print(TempPosition)
                                     TempPosition = LinkedList[TempPosition][1]

Mark points

  • Procedure header and starting at StartEmptyList
  • Following pointers and outputting data
  • Stopping correctly

Part 3(b)(iii) — solution

  1. Outputting Linked list then calling PrintListItems()
  2. Outputting Empty list then calling PrintEmptyList()

Visual Basic (VB.NET)

Console.WriteLine("Linked list")
                  PrintListItems()
                  Console.WriteLine("Empty list")
                  PrintEmptyList()

Python

print("Linked list")
                  PrintListItems()
                  print("Empty list")
                  PrintEmptyList()

Mark points

  • Outputting Linked list then calling PrintListItems()
  • Outputting Empty list then calling PrintEmptyList()

Part 3(b)(iv) — solution

1 mark for output of linked list data 2

Mark points

  • Include the ideas shown in the solution above.

Part 3(c)(i) — solution

  1. Procedure header taking one (integer) parameter
  2. Checking if list is full (e.g. if StartEmptyList != -1) …
  3. …and outputting "List is full"
  4. Storing node in StartEmptyList index …
  5. …with pointer -1 (may be done at separate position in algorithm)
  6. Starting at first node (StartLinkedList) …
  7. …following pointers until empty node
  8. Changing last pointer to StartEmptyList (or temp)
  9. Updating StartEmptyList to previous (could be temp) node's pointer

Visual Basic (VB.NET)

Sub AddItem(ByVal Item)
                        Dim TempPosition As Integer = 0
                        Dim NewEmptylist As Integer = 0
                        If StartEmptyList <> -1 Then
                            LinkedList(StartEmptyList, 0) = Item
                            NewEmptylist = LinkedList(StartEmptyList, 1)
                            LinkedList(StartEmptyList, 1) = -1
                            TempPosition = StartLinkedList
                            While (LinkedList(TempPosition, 1) <> -1)
                                TempPosition = LinkedList(TempPosition, 1)
                            End While
                            LinkedList(TempPosition, 1) = StartEmptyList
                            StartEmptyList = NewEmptylist
                        Else
                            Console.WriteLine("List is full")
                        End If
                    End Sub

                University Press & Assessment 2026                                                                       Page 38 of 41

Trace ID: PC-AB1FFDFB16
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/42 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/42 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/42                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

Python

def AddItem(Item):
                       global LinkedList
                       global StartEmptyList
                       global StartLinkedList
                       TempPosition = 0
                       if StartEmptyList != -1:
                           LinkedList[StartEmptyList][0] = Item
                           NewEmptyList = LinkedList[StartEmptyList][1]
                           LinkedList[StartEmptyList][1] = -1
                           TempPosition = StartLinkedList
                           while LinkedList[TempPosition][1] != -1:
                                TempPosition = LinkedList[TempPosition][1]
                           LinkedList[TempPosition][1] = StartEmptyList
                           StartEmptyList = NewEmptyList
                       else:
                           print("List is full")

Mark points

  • Procedure header taking one (integer) parameter
  • Checking if list is full (e.g. if StartEmptyList != -1) …
  • …and outputting "List is full"
  • Storing node in StartEmptyList index …
  • …with pointer -1 (may be done at separate position in algorithm)
  • Starting at first node (StartLinkedList) …
  • …following pointers until empty node
  • Changing last pointer to StartEmptyList (or temp)
  • Updating StartEmptyList to previous (could be temp) node's pointer

Part 3(c)(ii) — solution

  1. Calling AddItem() with parameter 8451
  2. Calling both output procedures with suitable headings

Visual Basic (VB.NET)

AddItem(8451)
                  Console.WriteLine("Linked list")
                  PrintListItems()
                  Console.WriteLine("Empty list")
                  PrintEmptyList()

Python

AddItem(8451)
                  print("Linked list")
                  PrintListItems()
                  print("Empty list")
                  PrintEmptyList()

Mark points

  • Calling AddItem() with parameter 8451
  • Calling both output procedures with suitable headings

Part 3(c)(iii) — solution

1 mark for output showing updated linked list contents and empty list 1 University Press & Assessment 2026 Page 41 of 41 Trace ID: PC-AB1FFDFB16 Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable. Licensed for hosting on papacambridge.com only. PapaCambridge 9618/42 Mark Scheme June · papacambridge.com 2026 | Source: papacambridge.com 9618/42 Mark Scheme June 2026 Downloaded from PapaCambridge - https://papacambridge.com/

Mark points

  • Include the ideas shown in the solution above.