Skip to main contentSkip to solution

In a deque, if any insertion and deletion of elements is done from the same end, it will behave as____________ .

Solution

✅ Correct Option: 1

A deque (double-ended queue) allows insertion and deletion at both the front and the rear. If both operations are done at the same end, the element added last is the first one removed. This is LIFO (Last In, First Out) behaviour, which is exactly how a stack works.


Queue: needs insertion at one end and deletion at the other end (FIFO), so it is the opposite of using the same end.

A deque used at both ends can imitate a queue or a stack, so the same-end condition is what decides it.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question