Question:

Which of the following statements is true in the context of a Deque?

Show Hint

Remember: Deque stands for Double-Ended Queue.
If restricted at one end, it becomes an Input-Restricted or Output-Restricted Deque.
By default, operations are available at both the front and rear ends.
Updated On: Sep 7, 2026
  • Insertion is done from front and deletion is done from rear.
  • Insertion and deletion can be done at both ends.
  • Insertion is done from front and deletion is done from front.
  • Insertion is done from rear and deletion is done from rear.
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Concept:
A double-ended queue, commonly abbreviated as a Deque (pronounced “deck”), is a generalized linear data structure.
Unlike a standard queue which strictly follows the First-In-First-Out (FIFO) principle, a Deque allows elements to be added or removed from either the front or the rear end.
Because of this flexibility, it can be configured to act either as a First-In-Last-Out (FILO) stack or as a standard FIFO queue.

Step 1: Understanding the Structure of a Deque:

A Deque supports four primary operations for inserting and deleting elements:
1. insertFront(): Inserts an item at the front of the Deque.
2. insertRear(): Inserts an item at the rear of the Deque.
3. deleteFront(): Removes an item from the front of the Deque.
4. deleteRear(): Removes an item from the rear of the Deque.
These capabilities confirm that both insertion and deletion operations are entirely permissible at both ends.

Step 2: Evaluation of Options:

Restricting insertion to the rear and deletion to the front defines a standard linear queue, not a general Deque.
Restricting both operations exclusively to one end (either purely the front or purely the rear) models a stack.
Therefore, the defining and accurate statement regarding a Deque is that insertion and deletion can be carried out at both boundaries.
Final Answer:
Hence, the correct option is (B), stating that insertion and deletion can be done at both ends.
Was this answer helpful?
0
0