May/June 2026 Paper 41

2026 · 3 questions · 23 parts · 75 marks

0/75 marks
0Correct0Partial0Wrong23Unattempted
Filters0 active
Context for question 1
A program stores integer data in a linear queue.
The queue is created as a global 1D array with space for 10 elements.
The queue has a global head pointer, initialised to -1, that points to the first element in the queue.
The queue has a global tail pointer, initialised to -1, that points to the last element in the queue.
1(a)Stacks QueuesMedium3 marks
The main program initialises the 10 elements of the queue to -1 and initialises the two pointers.
Write program code to declare the global variables and initialise the queue and its pointers.

Answer

0 words
1(b)Stacks QueuesHard7 marks
The function Enqueue() performs these tasks:
  • takes an integer parameter
  • checks if the queue is full
  • returns Boolean FALSE, if the queue is full
  • stores the parameter in the queue, updates the appropriate pointer(s) and returns Boolean TRUE, if the queue is not full
Write program code for Enqueue().

Answer

0 words
1(c)(i)Stacks QueuesMedium5 marks
Write program code to extend the main program to:
  • take 11 integers as input from the user
  • use the appropriate function to insert each integer into the queue
  • output a message if at any point the queue is full
  • output the final content of the queue array. Do not dequeue the data.
You do not need to validate the data input.

Answer

0 words
1(c)(ii)Stacks QueuesEasy1 mark
Run your program with the following 11 inputs, entered in this order: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.
Describe exactly what your program outputs, in the order it is produced.

Answer

0 words
1(d)Stacks QueuesHard6 marks
The function Dequeue():
  • returns -1 if the queue is empty
  • updates the pointer(s) and returns the next item from the queue if the queue is not empty
Write program code for Dequeue().

Answer

0 words
1(e)(i)Stacks QueuesMedium3 marks
Write program code to amend the main program to:
  • take 6 integers as input from the user and store them in the queue using the appropriate function
  • use the appropriate function to remove 4 elements from the queue
  • output each removed element from the queue

Answer

0 words
1(e)(ii)Stacks QueuesEasy1 mark
Run your amended program with the following 6 inputs, entered in this order: 100, 10, 5, 6, 18, 68.
Describe exactly what your program outputs, in the order it is produced.

Answer

0 words