Skip to content
Activities · Activity 4.4

Q.In a deque, if insertion and deletion of elements is done from the opposite end, it will behave as

​1) Queue
​2) Stack
​3) List
​4) None of the above
Uttar Pradesh UpmspTextbookSubjective· 1mImportance★★★★★
29% · 4/14 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

A deque allowing insertion at one end and deletion at the opposite end enforces FIFO order, making it behave as a queue.

A deque (double-ended queue) is a linear data structure that permits insertion and deletion at both ends. The question asks what happens when we restrict operations to opposite ends — specifically, when we insert at one end and delete from the other.

The key is to recognize the order in which elements are processed.

Understanding the behavior

Suppose we insert elements at the rear and delete from the front:

OperationDeque stateElement processed
Insert A (rear)[A]—
Insert B (rear)[A, B]—
Insert C (rear)[A, B, C]—
Delete (front)[B, C]A removed
Delete (front)[C]B removed

The first element inserted (A) is the first one removed. This is FIFO (First-In-First-Out) behavior, which defines a queue.

Contrast this with a stack, where insertion and deletion happen at the same end, giving LIFO (Last-In-First-Out) order. If we inserted and deleted both from the rear:

OperationDeque stateElement processed
Insert A (rear)[A]—
Insert B (rear)[A, B]—
Delete (rear)[A]B removed (last in, first out)

That would be stack behavior — but the question specifies opposite ends. …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.