Question:medium

The elements to be inserted in the Deque are 10, 20, 30, 40, 50, 60, starting from 10.
What will be the sequence of elements after the following operations are performed on a Deque:
INSERTFRONT(), INSERTREAR(), INSERTFRONT(), DELETEREAR(), DELETEFRONT(), INSERTFRONT(), INSERTREAR(), INSERTFRONT()
A. 10
B. 40
C. 50
D. 60
Choose the correct answer from the options given below:

Show Hint

Trace Deque operations using a simple list on paper:
- Add/remove on the left for FRONT operations.
- Add/remove on the right for REAR operations.
Keep a pointer index on your input sequence (10, 20, 30...) to remember which number is being enqueued next!
Updated On: Jun 11, 2026
  • D, B, A, C
  • B, D, A, C
  • B, A, C, D
  • D, C, A, B
Show Solution

The Correct Option is A

Solution and Explanation


Step 1: Understanding the Concept:

A Deque (Double-Ended Queue) allows insertion and deletion at both ends.

Step 2: Detailed Explanation:

Initial: Empty
1. INSERTFRONT(10): [10]
2. INSERTREAR(20): [10, 20]
3. INSERTFRONT(30): [30, 10, 20]
4. DELETEREAR(): [30, 10]
5. DELETEFRONT(): [10]
6. INSERTFRONT(40): [40, 10]
7. INSERTREAR(50): [40, 10, 50]
8. INSERTFRONT(60): [60, 40, 10, 50]
Final sequence is 60 (D), 40 (B), 10 (A), 50 (C).

Step 3: Final Answer:

The sequence is 60, 40, 10, 50, which corresponds to D, B, A, C.
Was this answer helpful?
0


Questions Asked in CUET (UG) exam