May/June 2026 Paper 42

2026 · 3 questions · 24 parts · 75 marks

0/75 marks
0Correct0Partial0Wrong24Unattempted
Filters0 active
Context for question 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:
Data already stored in LinkedList
array indexdatapointer
095125
155413
219990
36651-1
4-16
556121
6-1-1
7-14
StartLinkedList currently stores 2. StartEmptyList currently stores 7.
3(a)Linked ListsMedium5 marks
Write program code to declare and initialise the linked list and the pointers.

Answer

0 words
3(b)(i)Linked ListsMedium4 marks
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().

Answer

0 words
3(b)(ii)Linked ListsMedium3 marks
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().

Answer

0 words
3(b)(iii)Linked ListsEasy2 marks
Write program code to extend the main program to:
  • output "Linked list" and then call PrintListItems()
  • output "Empty list" and then call PrintEmptyList()

Answer

0 words
3(b)(iv)Linked ListsEasy2 marks
Run your program.
Describe exactly what your program outputs, in the order it is produced.

Answer

0 words
Context for 3(c)
New nodes are inserted at the end of the linked list.
3(c)(i)Linked ListsHard8 marks
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().

Answer

0 words
3(c)(ii)Linked ListsEasy2 marks
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.

Answer

0 words
3(c)(iii)Linked ListsEasy1 mark
Run your program.
Describe exactly what your program outputs, in the order it is produced.

Answer

0 words