ITPEC IP October 2020 Question 5

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

ITPEC IP October 2020 — Question 5 of 100

A queue is first in, first out, so the second value retrieved is 27. After enqueuing 33, 27, 12, and then 45, the queue order from front to rear is 33, 27, 12, 45. The first dequeue removes 33 and the second removes 27.

Answer (b)

Why not others:
- 12 is the third item and would be retrieved third

- 33 is retrieved first

- 45 was enqueued last and would be retrieved fourth

Key rule: A queue uses FIFO order: enqueue adds at the rear, and dequeue removes from 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.