Exercise: Standard Libraries

Questions for: Standard Libraries

What does the array module in Python provide?
A:
Support for working with arrays
B:
Mathematical operations
C:
File I/O operations
D:
Regular expressions
Answer: A
The array module in Python provides support for working with arrays, offering a more efficient alternative to lists for certain scenarios.
What is the purpose of the itertools.product() function?
A:
Generates all possible permutations of an iterable
B:
Computes the Cartesian product of multiple iterables
C:
Repeats an iterable indefinitely
D:
Filters elements based on a predicate function
Answer: B
The itertools.product() function in Python computes the Cartesian product of multiple iterables.
Which module in Python is used for parsing and creating JSON data?
A:
jsonparse
B:
jsonlib
C:
jsondata
D:
json
Answer: D
The json module in Python provides functionality for parsing and creating JSON data.
What is the purpose of the hashlib.pbkdf2_hmac() function?
A:
Generating random numbers
B:
Working with cryptographic hash functions
C:
Parsing XML documents
D:
Sorting elements in a list
Answer: B
The hashlib.pbkdf2_hmac() function in Python is used for password-based key derivation using a cryptographic hash function.
Which method is used to convert a string to a lowercase version?
A:
str.lowercase()
B:
str.lower()
C:
str.to_lower()
D:
str.casefold()
Answer: B
The lower() method is used to convert a string to its lowercase version in Python.
Ad Slot (Above Pagination)
Quiz