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
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
Solution
✅ Correct Option: 1
Each insert takes the next unused element (10, 20, 30, 40, 50, 60), and the deque is written front to rear.
| Operation | Element | Deque after operation |
|---|---|---|
| INSERTFRONT | 10 | 10 |
| INSERTREAR | 20 | 10, 20 |
| INSERTFRONT | 30 | 30, 10, 20 |
| DELETEREAR | removes 20 | 30, 10 |
| DELETEFRONT | removes 30 | 10 |
| INSERTFRONT | 40 | 40, 10 |
| INSERTREAR | 50 | 40, 10, 50 |
| INSERTFRONT | 60 | 60, 40, 10, 50 |
The final sequence 60, 40, 10, 50 is D, B, A, C.
Deleted elements (20 and 30) still use up their place in the insertion order, so the next insert gets 40, not 20.
Related questions:
2026: 29 May Shift 1
2025: 22 May Shift 1
2026: 19 May Shift 1