Python Programming - Standard Libraries
Exercise : Standard Libraries - General Questions
- Standard Libraries - General Questions
76.
What does the
zoneinfo
module in Python provide support for?
Answer: Option
Explanation:
from datetime import datetime
from zoneinfo import ZoneInfo
# Example usage of zoneinfo module for handling time zones
dt = datetime(2022, 1, 1, tzinfo=ZoneInfo("America/New_York"))
print(dt)
77.
How can you use the
unicodedata
module in Python to get the name of a Unicode character?
Answer: Option
Explanation:
import unicodedata
# Example usage of unicodedata module for getting the name of a Unicode character
char_name = unicodedata.name('A')
print(char_name)
78.
How can you use the
subprocess
module in Python to run an external command and capture its output?
Answer: Option
Explanation:
import subprocess
# Example usage of subprocess module for running an external command and capturing its output
result = subprocess.run(['ls', '-l'], capture_output=True, text=True)
print(result.stdout)
79.
What is the purpose of the
heapq
module?
Answer: Option
Explanation:
import heapq
# Example usage of heapq module for implementing a priority queue
priority_queue = []
heapq.heappush(priority_queue, 3)
heapq.heappush(priority_queue, 1)
heapq.heappush(priority_queue, 4)
print(priority_queue)
80.
How can you use the
sysconfig
module in Python to get information about the Python installation?
Answer: Option
Explanation:
import sysconfig
# Example usage of sysconfig module for getting information about the Python installation
config_info = sysconfig.get_config()
print(config_info)
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers