ITPEC IP April 2025 Question 8

Source exam: ITPEC IP April 2025Topic: Algorithm and Programming

ITPEC IP April 2025 — Question 8 of 100

1 — a queue removes values in the same order in which they were inserted.

The enqueue order is 8, 1, 6, 3. With FIFO processing, the first removal returns 8 and the second consecutive removal returns 1. The question asks for the last of those two removed values, so it is 1. Values 6 and 3 remain in the queue.

Answer (a)

Why not others:
- (b) 3 would be removed first by a stack using LIFO, not by a queue

- (c) 6 is the third queued value and would be removed on the third operation

- (d) 8 is the first value removed, not the second and last requested removal

Key rule: A queue is FIFO: enqueue at the rear and dequeue from the front. A stack, by contrast, 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.