Standard difficulty · 20 questions · 40 marks · Time: 40 minutes
Show your working for Sections B and C. Answers are on the last page — try every question first!
Queue · AW-12CS-QUE-2026-V1 · For parents — fold back or tear off before handing the sheet to your child.
| Q | Answer | Working |
|---|---|---|
| 1 | (d) First In, First Out (FIFO) | — |
| 2 | (a) [81, 63, 83] | items leave from the front in the order they joined (FIFO) |
| 3 | (a) 55 | dequeue() removes the item at the front: the earliest one still waiting |
| 4 | (d) [94, 97] | append() adds at the rear, insert(0, x) at the front; pop() removes from the rear, pop(0) from the front |
| 5 | (d) stack | — |
| 6 | (c) 35 | the first 10 values leave; the next one is at the front |
| 7 | (c) True | pop(0) and pop() take the two ends; a palindrome matches all the way |
| 8 | (b) 4 | 9 − 8 + 3 |
| 9 | A linear data structure in which items join at the rear and leave from the front (FIFO); e.g. people in a line at a ticket counter. | — |
| 10 | 28, 67, Underflow, 11, [21, 10] | FIFO: each dequeue takes the earliest item still in the queue |
| 11 | [99, 91, 95, 47, 87] | append() adds at the rear, insert(0, x) at the front; pop() removes from the rear, pop(0) from the front |
| 12 | True | compare the front and rear letters until they meet |
| 13 | 13, 75 | the earliest item still waiting leaves first |
| 14 | 47, 65 | pop() takes the rear item, pop(0) the front item |
| 15 | 1 | the 1 values ahead of it must leave first |
| 16 | stack | plates piled one on another: stack |
| 17 | q = []; enqueue: q.append(x); dequeue: if q: print(q.pop(0)) else print('Underflow'); peek: q[0] if q else 'Empty'; display: print(q). A while loop shows the menu. | — |
| 18 | (a) 71, 96; (b) [12, 26, 92]; (c) 12 | FIFO; dequeue() on an empty queue returns Underflow |
| 19 | (a) [16, 23, 66], [23, 66], [23], [95, 23]; (b) [95, 23]; (c) append() and pop() (add and remove at the same end). | append/pop work on the rear; insert(0, x)/pop(0) on the front |
| 20 | (a) True; (b) pop(0) removes from the front and pop() from the rear, so the two ends are compared and removed until one or no letter is left; (c) True. | a palindrome reads the same from both ends |