The contextlib module in Python provides utilities for working with context managers, including the contextlib.contextmanager decorator.
Discuss About this Question.
Which method is used to join elements of a list into a single string?
A:
list.combine()
B:
list.concat()
C:
list.join()
D:
str.join()
Answer:D
The join() method is used to join elements of a list into a single string in Python.
Discuss About this Question.
What is the purpose of the collections.ChainMap class?
A:
Chaining multiple dictionaries into a single view
B:
Sorting elements in a list
C:
Working with regular expressions
D:
Handling dates and times
Answer:A
The collections.ChainMap class in Python is used to chain multiple dictionaries into a single view, allowing you to access them as a single dictionary.
Discuss About this Question.
Which module in Python provides functions for working with the file system, such as copying, moving, and deleting files?
A:
filesystem
B:
fileutils
C:
os.path
D:
shutil
Answer:D
The shutil module in Python provides functions for working with the file system, such as copying, moving, and deleting files.
Discuss About this Question.
What is the purpose of the collections.deque class?
A:
Implementing queues and priority queues
B:
Sorting elements in a list
C:
Handling dates and times
D:
Creating a dictionary with default values
Answer:A
The collections.deque class in Python is used to implement double-ended queues, which can be used for efficiently adding and removing elements from both ends.
Discuss About this Question.
Ad Slot (Above Pagination)
Install ExamAdept
Fast access — add this app to your device.
To install on iPhone/iPad: tap Share → Add to Home Screen.
Discuss About this Question.