Skills101
← All practice quizzes

Quiz: Queues and Deques

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Queues serve items in arrival order; deques add and remove at both ends. Learn the right classes in Python and Java, build a circular queue, and solve sliding window maximum in O(n) with a monotonic deque.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    from collections import deque
    q = deque([1, 2, 3])
    q.append(4)
    q.popleft()
    q.appendleft(9)
    print(list(q))
    
  2. Question 2

    Why should you not use list.pop(0) as a queue in Python?

  3. Question 3

    In a circular queue of capacity 5 with head = 3 and size = 4, where does the next element go?

  4. Question 4

    A queue built from two stacks: what is the cost of each operation?

  5. Question 5

    In sliding window maximum, the deque holds indexes whose values are:

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →