In Python, __________ module need to be imported for implementing Double Ended…
2025
In Python, __________ module need to be imported for implementing Double Ended Queue.
- A.
counter
- B.
collections
- C.
random
- D.
numpy
Attempted by 979 students.
Show answer & explanation
Correct answer: B
In Python, the collections module provides the deque class, which is used to implement Double Ended Queue. This allows efficient insertion and deletion from both ends of the queue.
The counter module is used for counting hashable objects, not for queue operations. The random module is used for generating random numbers and selections, and numpy is used for numerical computations and array handling. None of these provide deque functionality.
हिन्दी उत्तर:
पायथन में, collections मॉड्यूल में deque क्लास होती है, जिसका उपयोग डबल एंडेड क्यू को लागू करने के लिए किया जाता है। इससे दोनों छोरों से तेजी से डेटा जोड़ने और हटाने की अनुमति मिलती है।
counter मॉड्यूल हैशेबल ऑब्जेक्ट्स की गिनती के लिए उपयोग किया जाता है, क्योंकि यह क्यू ऑपरेशन्स के लिए नहीं है। random मॉड्यूल यादृच्छिक संख्याओं और चयनों के लिए उपयोग किया जाता है, और numpy संख्यात्मक गणना और एरे हैंडलिंग के लिए उपयोग किया जाता है। इनमें से कोई भी deque कार्यक्षमता प्रदान नहीं करता है।