Python Programming - Standard Libraries

Exercise : Standard Libraries - General Questions
  • Standard Libraries - General Questions
6.
In Python, which module is commonly used for handling dates and times?
math
datetime
random
os
Answer: Option
Explanation:
The datetime module in Python is used for working with dates and times, providing classes and functions to manipulate and format date and time values.

7.
Which function from the os module is used to change the current working directory?
os.getcwd()
os.chdir()
os.path()
os.dir()
Answer: Option
Explanation:
The os.chdir() function is used to change the current working directory in Python.

8.
Which module is used for sending emails?
email
smtplib
mail
sendmail
Answer: Option
Explanation:
The smtplib module in Python is commonly used for sending emails using the Simple Mail Transfer Protocol (SMTP).

9.
Which method is used to remove an element from a set?
set.remove()
set.pop()
set.delete()
set.discard()
Answer: Option
Explanation:
The discard() method is used to remove a specified element from a set, if the element is present.

10.
Which module in Python provides functionality to work with compressed files, such as ZIP files?
gzip
zipfile
compress
archive
Answer: Option
Explanation:
The zipfile module in Python provides tools for creating, reading, and extracting ZIP files.