Data Structures & AlgorithmsEasyTCS NQT · Wipro pattern

An empty deque performs push_front(1), push_front(2), push_front(3) and then pop_back(). Which value is removed?

  1. A. 3
  2. B. 2
  3. C. 1
  4. D. The deque is empty

Correct answer: C. 1

After three push_front calls the deque reads 3, 2, 1 from front to back. pop_back removes from the back, which is the first value pushed: 1. '3' would be pop_front.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic