ITPEC FE Subject B April 2026 Question 8
ITPEC FE Subject B April 2026 — Question 8 of 20
A is < capacity and B is (front + 1) mod capacity.
This is a circular queue held in a fixed array:
- •Blank A —
enqueuemay append only while the queue is not full, that is whilecount < capacity; otherwise it returns false - •Blank B — after the front element is removed, the front marker steps forward one place and wraps around the end of the array, exactly as
reardoes inenqueue
The figure confirms it: with front = 3, dequeue clears index 3 and the next front becomes index 4.
Answer (e)
Why not others:
- (a) and (b) — test count < 0, which is never true, so nothing could ever be enqueued
- (g) and (h) — test count > capacity, also never true
- (c) and (d) — test count > 0, which lets an enqueue proceed on a full queue and blocks it on an empty one, both backwards
- (b), (d), (f) and (h) — move the front backwards with front - 1, revisiting the slot just vacated instead of advancing
Key rule: Both markers in a circular buffer advance the same way — add one, then take mod capacity. The fullness test is on count, which is why the array indices alone never tell you whether the queue is full.
AI-generated — may contain errors
The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.