Data Structures & AlgorithmsHardTCS NQT · Accenture

Starting from an empty deque, the operations are: push front 1, push back 2, push front 3, pop back, push back 4. Let the deque contents after these operations be D. What is the value of sum(D) * 10 + D[0] (front first)?

  1. A. 93
  2. B. 76
  3. C. 83
  4. D. 166

Correct answer: C. 83

Track the front and back carefully: push front 3 places it before 1, pop back removes 2, and push back 4 ends the list. The front element of the final deque is 3.

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

Exams that ask this topic