Exercise: Standard Libraries

Questions for: Standard Libraries

What is the purpose of the platform module?
A:
Sorting elements in a list
B:
Handling dates and times
C:
Providing access to platform-specific APIs
D:
Working with regular expressions
Answer: C
The platform module in Python provides access to platform-specific APIs and information about the current operating system.
Which module in Python is used for working with SQLite databases in an asynchronous manner?
A:
sqlite
B:
sqlite3
C:
asyncsqlite
D:
asqlite
Answer: C
The asyncsqlite module in Python provides asynchronous support for working with SQLite databases.
What does the random.shuffle() function do?
A:
Sorts a list in random order
B:
Picks a random element from a sequence
C:
Generates a random integer
D:
Returns a random floating-point number
Answer: A
The random.shuffle() function in Python shuffles the elements of a list in a random order.
Which module in Python provides support for working with compressed files, such as ZIP and tar files, in a high-level manner?
A:
zipfile
B:
compression
C:
archivelib
D:
tarfile
Answer: A
The zipfile module in Python provides high-level support for working with ZIP files.
What is the purpose of the collections.defaultdict class?
A:
Sorting elements in a list
B:
Creating a dictionary with default values for missing keys
C:
Working with regular expressions
D:
Handling dates and times
Answer: B
The collections.defaultdict class in Python is used to create dictionaries with default values for missing keys.
Ad Slot (Above Pagination)
Quiz