1. Home
  2. Data Science
  3. Python
  4. Which collections type provides O(1) appends and pops from…

Added 25 Nov 2026

Which collections type provides O(1) appends and pops from both ends in Python?

  1. deque Correct answer
  2. list
  3. tuple
  4. array

Correct answer

A. deque

7 views

MCQSEXAM

Explanation

collections.deque is a double-ended queue optimised for fast operations at both ends.

Reference

Asked in: Python Interview Advanced

https://docs.python.org/3/library/index.html

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs