Exercise: Standard Libraries

Questions for: Standard Libraries

What does the string.Template class provide?
A:
Support for working with regular expressions
B:
A simple way to format strings using placeholders
C:
File I/O operations
D:
Mathematical operations on strings
Answer: B
The string.Template class in Python provides a simple way to format strings using placeholders.
Which method is used to find the index of the first occurrence of a value in a list?
A:
list.find()
B:
list.index()
C:
list.search()
D:
list.position()
Answer: B
The index() method is used to find the index of the first occurrence of a value in a list in Python.
What is the purpose of the concurrent.futures module?
A:
Working with regular expressions
B:
Asynchronous I/O operations
C:
Executing functions concurrently using threads or processes
D:
Creating GUI applications
Answer: C
The concurrent.futures module in Python provides a high-level interface for asynchronously executing functions using threads or processes.
Which module in Python is used for working with the HTTP protocol?
A:
http
B:
httpclient
C:
httprequest
D:
http.server
Answer: D
The http.server module in Python provides classes for implementing a basic HTTP server.
What is the purpose of the tempfile module?
A:
Mathematical operations
B:
Working with temporary files and directories
C:
Handling dates and times
D:
Parsing JSON data
Answer: B
The tempfile module in Python provides functionality for creating and handling temporary files and directories.
Ad Slot (Above Pagination)
Quiz