ITPEC IP April 2022 Question 5
ITPEC IP April 2022 — Question 5 of 100
A queue is first-in, first-out, so the two retrieved elements are 33 and then 27. After enqueueing 45, the queue order from front to rear is 33, 27, 12, 45. The first dequeue removes 33, and the second dequeue removes 27.
Answer (b)
Why not others:
- 12 would be removed third
- 33 is the first retrieved element
- 45 was added last and would be removed fourth
Key rule: Enqueue adds at the rear and dequeue removes from the front. A queue is FIFO, unlike a stack, which is LIFO.
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 IP past-paper collection or Report an issue.