To perform enqueue and dequeue efficiently on a queue, which of the following operations are required?
A) isEmpty
B) peek
C) isfull
D) update
To perform enqueue and dequeue efficiently on a queue, which of the following operations are required?
A) isEmpty
B) peek
C) isfull
D) update
Solution
Efficient enqueue and dequeue need the supporting operations isEmpty, isFull and peek.
isEmpty checks that the queue has an element before a dequeue, which avoids underflow. isFull checks that there is space before an enqueue, which avoids overflow in a fixed-size queue. peek reads the front element without removing it.
Options 1, 3 and 4: "update" is not a standard queue operation. A queue gives access only at its two ends (insert at rear, remove from front), so changing an arbitrary element goes against the FIFO idea.
Related questions:
2026: 20 May Shift 1
2026: 19 May Shift 1