Worked solution from the Data Types and Structures Paper 2 Problem-solving and Programming booklet, Part 4 of 4.
The data type of the items to be stored (for example INTEGER) [1]
Write two operations, each with its check:
Operation 1: Enqueue (add an item to the queue) [1]
Check 1: the queue is not full (there are unused elements in the array) [1]
Operation 2: Dequeue (remove an item from the queue) [1]
Check 2: the queue is not empty (there are items in the array) [1]
Any five of these:
Declare a 1D array of at least 10 elements with data type CHAR [1]
Declare an integer for the front of queue pointer [1]
Declare an integer for the end of queue pointer [1]
Declare an integer for the number of items in the queue (or the size of the queue) [1]
Initialise the pointers and count so the queue is empty [1]
▶ Whole paper
Video solution of the whole paper · by Zafar Ali Khan (ZAK). Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.