Exercise: Standard Libraries

Questions for: Standard Libraries

What is the purpose of the queue module?
A:
Sorting elements in a list
B:
Implementing queues and priority queues
C:
Handling dates and times
D:
File I/O operations
Answer: B
The queue module in Python provides classes for implementing various types of queues, including FIFO and priority queues.
Which module in Python is used for working with the SQLite database?
A:
sqlite
B:
sql
C:
sqlite3
D:
db
Answer: C
The sqlite3 module in Python provides a simple way to work with SQLite databases.
What does the shutil.rmtree() function do?
A:
Removes a file
B:
Removes a directory and its contents recursively
C:
Renames a file
D:
Creates a new directory
Answer: B
The shutil.rmtree() function in Python is used to remove a directory and its contents recursively.
Which module in Python is commonly used for handling compressed files, such as gzip and zlib formats?
A:
compression
B:
compresslib
C:
zlib
D:
gzip
Answer: D
The gzip module in Python provides functionality for working with gzip-compressed files.
What is the purpose of the subprocess module?
A:
Working with regular expressions
B:
Handling dates and times
C:
Interacting with shell commands and external processes
D:
Sorting elements in a list
Answer: C
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.
Ad Slot (Above Pagination)
Quiz