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