Exercise: Python

Questions for: Standard Libraries

What is the purpose of the asyncio module?
A:
Asynchronous I/O operations
B:
Synchronous I/O operations
C:
Mathematical operations
D:
File I/O operations
Answer: A
The asyncio module in Python provides support for writing asynchronous code, particularly for asynchronous I/O operations.
Which module in Python is used for working with compressed archives, such as tar files?
A:
zip
B:
archivelib
C:
tarlib
D:
tarfile
Answer: D
The tarfile module in Python provides functionality for working with tar archives.
Which module in Python provides support for working with XML, including parsing and creating XML documents?
A:
xml
B:
xmlparse
C:
xmllib
D:
xml.etree.ElementTree
Answer: D
The xml.etree.ElementTree module in Python provides support for working with XML, including parsing and creating XML documents.
What does the statistics.median() function do?
A:
Calculates the mean of a list of numbers
B:
Finds the mode of a list of numbers
C:
Calculates the median of a list of numbers
D:
Computes the standard deviation of a list of numbers
Answer: C
The statistics.median() function in Python is used to calculate the median of a list of numbers.
What does the collections.Counter class do?
A:
Counts the number of elements in a list
B:
Counts the occurrences of elements in an iterable
C:
Creates a counter-clockwise rotation of elements
D:
Sorts the elements of a list
Answer: B
The collections.Counter class in Python is used to count the occurrences of elements in an iterable, such as a list or a string.
Ad Slot (Above Pagination)
Quiz