ITPEC FE Morning April 2023 Question 8
Source exam: ITPEC FE Morning April 2023Topic: Basic Theory & Math
ITPEC FE Morning April 2023 — Question 8 of 80
Queue (FIFO) operation trace — track element order through enqueue/dequeue sequence.
Trace the operations on an initially empty queue:
- •
ENQ 1, ENQ 2, ENQ 3→ queue:[1, 2, 3] - •
DEQ→ removes1→[2, 3] - •
ENQ 4, ENQ 5→[2, 3, 4, 5] - •
DEQ→ removes2→[3, 4, 5] - •
ENQ 6→[3, 4, 5, 6] - •
DEQ, DEQ→ removes3, then4→[5, 6]
Next DEQ removes 5.
Why not others:
- (a) 1 — already removed at step 4
- (b) 2 — already removed at step 7
- (d) 6 — would be removed after 5, not before
Key rule: Queue = FIFO. Elements leave in the same order they entered.
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.