Skip to main content
A-LevelComputer ScienceData types and structures9618/41 · May/June 2021 · Q124 Marks

An unordered linked list uses a 1D array to store the data. Each item in the linked list is of a record type, node, with a field data and a field nextNode. The current contents of the linked list are: startPointer 0 emptyList 5 Index data nextNode 0 1 1 1 5 4 2 6 7 3 7 -1 4 2 2 5 0 6 6 0 8 7 56 3 8 0 9 9 0 -1

  1. (a)The following is pseudocode for the record type node. TYPE node DECLARE data : INTEGER DECLARE nextNode : INTEGER ENDTYPE Write program code to declare the record type node. Save your program as question1. Copy and paste the program code into part 1(a) in the evidence document.[2]
  2. (b)Write program code for the main program. Declare a 1D array of type node with the identifier linkedList, and initialise it with the data shown in the table on page 2. Declare the pointers. Save your program. Copy and paste the program code into part 1(b) in the evidence document.[4]
  3. (c)(i)The procedure outputNodes() takes the array and startPointer as parameters. The procedure outputs the data from the linked list by following the nextNode values. Write program code for the procedure outputNodes(). Save your program. Copy and paste the program code into part 1(c)(i) in the evidence document.[6]
  4. (c)(ii)Edit the main program to call the procedure outputNodes(). Take a screenshot to show the output of the procedure outputNodes(). Save your program. Copy and paste the screenshot into part 1(c)(ii) in the evidence document.[1]
  5. (d)(i)The function, addNode(), takes the linked list and pointers as parameters, then takes as input the data to be added to the end of the linkedList. The function adds the node in the next available space, updates the pointers and returns True. If there are no empty nodes, it returns False. Write program code for the function addNode(). Save your program. Copy and paste the program code into part 1(d)(i) in the evidence document.[7]
  6. (d)(ii)Edit the main program to: • call addNode() • output an appropriate message depending on the result returned from addNode() • call outputNodes() twice; once before calling addNode() and once after calling addNode(). Save your program. Copy and paste the program code into part 1(d)(ii) in the evidence document.[3]
  7. (d)(iii)Test your program by inputting the data value 5 and take a screenshot to show the output. Save your program. Copy and paste the screenshot into part 1(d)(iii) in the evidence document.[1]

Mark scheme

Marking points from the official mark scheme (May/June 2021). The mark or mark type is shown in brackets.

  1. [2] 1 mark per bullet point • Declaring record/class with name node... • ...declaring data and next node (both as Integers)
  2. [4] 1 mark per bullet point • Declaring array named linkedList with data type node • Assigning all nodes correctly as record/object nodes ... • ...with correct values stored • declaring startPointer as 0, emptyList as 5
  3. [6] 1 mark per bullet point • Procedure outputNodes ...taking linked list and start pointer as parameters • Looping until nextNode/pointer is –1 • Outputting the node data in the correct order, i.e. following pointers • Updating pointer to current node’s nextNode • Using the correct record/class field/properties throughout
  4. [1] Screenshot showing: 1 5 2 6 56 7
  5. [7] 1 mark per bullet point to max 7 • Function taking list and both pointers as parameters • Taking (integer) data as input • Checking if list is full ... and returning False • Insert the input data to the empty list node's data • Following pointers to find last node in Linked List ...and updating last node’s pointer to empty list/location where new node is added • Updating empty list to it’s first elements pointer • Returning true when added successfully
  6. [3] 1 mark per bullet point • Call addNode () with list, start and empty pointers and store/check return value ...output appropriate message if True returned and if False returned • Calling outputNodes() with list and start pointer before and after addNode()
  7. [1] 1 mark for screenshot showing : • Linked list output • 5 input • Message saying Successfully added or equivalent • Linked list output with 5 at the end. Example: 1 5 2 6 56 7 5 (being input) 1 5 2 6 56 7 5

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Data types and structures, A-Level Computer Science (syllabus 9618). Structured question, 24 marks.
Source
A-Level Computer Science, May/June 2021 Paper 4 Variant 1, question 1.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep