ITPEC IP October 2019 Question 6

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

ITPEC IP October 2019 — Question 6 of 100

The second removal returns 1. A queue is first-in, first-out, so after inserting 8, 1, 6, and 3, removal proceeds in the same order: the first removal returns 8 and the second returns 1.

Answer (a)

Why not others:
- 3 is the last value inserted and would be removed fourth

- 6 would be removed third

- 8 is returned by the first removal, not the second

Key rule: A FIFO queue inserts at the rear and removes from the front; the earliest enqueued remaining value is always removed next.

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.