Question:medium

________ data type is used to implement a Queue data structure in Python?

Updated On: Jan 16, 2026
  • Sets
  • Dictionary
  • Tuple
  • List
Show Solution

The Correct Option is D

Solution and Explanation

In Python, the List data type is the standard choice for implementing a Queue. The following table and example demonstrate this implementation:
OperationDescription
EnqueueAppends an element to the end of the list via append().
DequeueRemoves and returns the first element using pop(0).
PeekAccesses the first element without removal using index [0].
Example implementation:
queue=[]# Enqueue elementsqueue.append(1)queue.append(2)queue.append(3)# Dequeue elementfirst_elem=queue.pop(0)# Peek at the next elementnext_elem=queue[0]
This straightforward and adaptable implementation solidifies Lists as Python's preferred data type for Queues.
Was this answer helpful?
0


Questions Asked in CUET (UG) exam