Python Programming - Standard Libraries
Exercise : Standard Libraries - General Questions
- Standard Libraries - General Questions
16.
What is the purpose of the
heapq
module?
Answer: Option
Explanation:
The
heapq
module in Python provides functions for implementing heap queues, which are often used to implement priority queues.
17.
Which module in Python is used for working with network-related tasks, such as creating and handling sockets?
Answer: Option
Explanation:
The
socket
module in Python is used for working with sockets, allowing you to create and handle network connections.
18.
What does the
itertools.cycle()
function do?
Answer: Option
Explanation:
The
itertools.cycle()
function in Python repeats an iterable indefinitely, cycling through its elements.
19.
Which method is used to add an element to the end of a list?
Answer: Option
Explanation:
The
append()
method is used to add an element to the end of a list in Python.
20.
What is the purpose of the
subprocess
module?
Answer: Option
Explanation:
The
subprocess
module in Python is used for interacting with shell commands and external processes, providing a way to spawn new processes and connect to their input/output/error pipes.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers