Перейти к содержанию

Labs · 9618 AS 10.4 · A2 19.1

Pointer Lab

Push, pop, queue, link and branch. Run stacks, circular queues, linked lists and binary trees held in arrays, and watch every pointer move.

19 levelsFree bench

In the exam

Exam questions on what this lab teaches, with the points that gain marks.

9618/23 May/June 2026 · Question 6(c)(ii) and 6(d)8 marks

A linked list stores animal names in alphabetical order. (c)(ii) To delete a data item, the algorithm has special cases; one is that the list is empty. Describe two other special cases. (d) Describe how the data item 'BAT' is inserted into the linked list.

Points that gain marks

  1. (c)(ii) The item is not in the list.
  2. The item is the only item in the list, or the first item in the list.
  3. (d) Store 'BAT' at the next free location in the Data array.
  4. Start at the node the start pointer points to and compare 'BAT' with its data ('ANT').
  5. If 'BAT' is not less than it, remember this position and move to the next node ('BISON'); repeat until 'BAT' is less than the current value.
  6. Point the previous node ('ANT') to 'BAT' …
  7. … and point 'BAT' to the current node ('BISON').

In this lab: 'Insert in order' walks the list and moves the two pointers; 'Delete a node' and 'A new first node' are the special cases.

9618/21 May/June 2022 · Question 4(a)–(b)6 marks

A stack uses memory locations 200 to 207; TopOfStack points to the last value added. (a) State the value that has been on the stack longest, and where TopOfStack points after three POPs. (b) Starting from W (top) Y X Z N P, perform POP, POP, PUSH 'A', PUSH 'B', POP, PUSH 'C', PUSH 'D' and complete the diagram.

Points that gain marks

  1. (a) 'H' (the value at the bottom) has been on the stack longest; after three POPs TopOfStack points to 206.
  2. (b) TopOfStack points to 'D' in 201.
  3. (b) 'C' and 'A' are in 202 and 203.
  4. (b) 'X' to 'P' are unchanged in 204 to 207.

In this lab: Levels 'Exam operations' and 'Read the stack'.

9618/22 May/June 2023 · Question 3(a)5 marks

A circular queue has 10 locations (0–9). Front of Queue Pointer is at 5 (Red), End of Queue Pointer at 8 (Pink). (i) Describe how Orange and Yellow are added. (ii) In a second state, the end pointer is at 1 and the front pointer at 5: state the number of data items in the queue.

Points that gain marks

  1. (i) Check that the queue is not full.
  2. (i) The end pointer moves to 9 and Orange is stored there.
  3. (i) The end pointer wraps round to 0 and Yellow is stored there.
  4. (ii) 7 (locations 5 to 9, then 0 and 1).

In this lab: Levels 'Round the corner' and 'Read the queue'.

9618/22 October/November 2022 · Question 3(b)5 marks

Explain how the stack can be implemented using an array.

Points that gain marks

  1. Declare a 1D array; its number of elements is the size of the stack.
  2. Declare an integer StackPointer and use it as the index into the array.
  3. Initialise the pointer to show an empty stack.
  4. Each item on the stack is one array element.
  5. Push and Pop move the pointer, and must check for a full or an empty stack.

In this lab: Levels 'Last in, first out' and 'Exam operations'.

The question as printed in the exam paper

More real experiments

All labs →

Войти или создать аккаунт

IGCSE, A-Level & AP