🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Queues and Deques: questions with answers

13 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does this print? (code)
  2. Q2. Why should you not use list.pop(0) as a queue in Python?
  3. Q3. In a circular queue of capacity 5 with head = 3 and size = 4, where does the next element go?
  4. Q4. A queue built from two stacks: what is the cost of each operation?
  5. Q5. In sliding window maximum, the deque holds indexes whose values are:
  6. Q6. What does windowmax([4, 2, 12, 3], 2) return?
  7. Q7. Which data structure does breadth-first search use?
  8. Q8. Which Java class is the recommended general-purpose queue and stack?
  9. Q9. What does this print? (code)
  10. Q10. In a circular queue that stores head and size, how do you know the queue is full?
  11. Q11. What does this print? (code)
  12. Q12. In a queue built from two stacks, when are items moved from the in-stack to the out-stack?
  13. Q13. In sliding window maximum, why remove smaller values from the back of the deque when a new value arrives?