Exercise: Python

Questions for: Standard Libraries

What does the timeit module in Python provide?
A:
Timing the execution of code snippets
B:
Working with dates and times
C:
Handling compressed files
D:
Synchronous I/O operations
Answer: A
The timeit module in Python provides a simple way to measure the execution time of small code snippets.
Which module in Python provides functions for working with regular expressions?
A:
regex
B:
relib
C:
regexlib
D:
re
Answer: D
The re module in Python provides functions for working with regular expressions.
What does the itertools.chain() function do?
A:
Chains two or more iterables into a single iterable
B:
Generates all possible permutations of an iterable
C:
Repeats an iterable indefinitely
D:
Filters elements based on a predicate function
Answer: A
The itertools.chain() function in Python chains two or more iterables into a single iterable.
Which module in Python is used for working with data compression and decompression, including formats like zlib and gzip?
A:
compresslib
B:
zlib
C:
zip
D:
gzip
Answer: D
The gzip module in Python is used for working with gzip-compressed files.
What is the purpose of the pickle module?
A:
Working with compressed files
B:
Serialization of Python objects
C:
Parsing JSON data
D:
Handling dates and times
Answer: B
The pickle module in Python is used for serializing and deserializing Python objects.
Ad Slot (Above Pagination)
Quiz