Python Programming - Standard Libraries

Exercise : Standard Libraries - General Questions
  • Standard Libraries - General Questions
21.
Which module in Python is commonly used for handling compressed files, such as gzip and zlib formats?
compression
compresslib
zlib
gzip
Answer: Option
Explanation:
The gzip module in Python provides functionality for working with gzip-compressed files.

22.
What does the shutil.rmtree() function do?
Removes a file
Removes a directory and its contents recursively
Renames a file
Creates a new directory
Answer: Option
Explanation:
The shutil.rmtree() function in Python is used to remove a directory and its contents recursively.

23.
Which module in Python is used for working with the SQLite database?
sqlite
sql
sqlite3
db
Answer: Option
Explanation:
The sqlite3 module in Python provides a simple way to work with SQLite databases.

24.
What is the purpose of the queue module?
Sorting elements in a list
Implementing queues and priority queues
Handling dates and times
File I/O operations
Answer: Option
Explanation:
The queue module in Python provides classes for implementing various types of queues, including FIFO and priority queues.

25.
What does the collections.Counter class do?
Counts the number of elements in a list
Counts the occurrences of elements in an iterable
Creates a counter-clockwise rotation of elements
Sorts the elements of a list
Answer: Option
Explanation:
The collections.Counter class in Python is used to count the occurrences of elements in an iterable, such as a list or a string.