Python Programming - Standard Libraries

Exercise : Standard Libraries - General Questions
  • Standard Libraries - General Questions
11.
Which module in Python is commonly used for working with regular expressions but has a simpler API compared to re?
regex
regexp
relib
regexlib
Answer: Option
Explanation:
The regex module in Python provides a simpler API for working with regular expressions, offering additional features and improvements over the standard re module.

12.
Which function is used to retrieve the keys of a dictionary?
dict.keys()
dict.get_keys()
dict.extract_keys()
dict.getkeys()
Answer: Option
Explanation:
The keys() method is used to retrieve the keys of a dictionary in Python.

13.
What is the purpose of the collections module?
Mathematical operations
Working with collections (lists, tuples, sets, etc.)
File I/O operations
Web development
Answer: Option
Explanation:
The collections module in Python provides specialized data types and functions to work with collections, such as namedtuple, Counter, and defaultdict.

14.
Which module in Python is used for working with the operating system, providing a way to execute shell commands?
os
system
shell
command
Answer: Option
Explanation:
The os module in Python provides a way to interact with the operating system, including functions to execute shell commands.

15.
What is the purpose of the hashlib module?
Mathematical operations
File I/O operations
Working with cryptographic hash functions
Web development
Answer: Option
Explanation:
The hashlib module in Python is used for working with cryptographic hash functions, providing a way to generate secure hash values.