ITPEC IP October 2018 Question 7

Source exam: ITPEC IP October 2018Topic: Algorithm and Programming

ITPEC IP October 2018 — Question 7 of 100

The second element dequeued is 27. A queue uses first-in, first-out order. After 45 is enqueued, the queue from front to rear is 33, 27, 12, 45. The first dequeue returns 33, and the second returns 27.

Answer (b)

Why not others:
- 33 is the first element retrieved

- 12 is the third element retrieved

- 45 was added last and would be retrieved fourth

Key rule: In a FIFO queue, insertion occurs at the rear and retrieval occurs at the front.

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.