Python Programming - Functions
Exercise : Functions - General Questions
- Functions - General Questions
46.
What is the purpose of the
__doc__
attribute?
Answer: Option
Explanation:
The
__doc__
attribute is used to access the docstring (documentation string) of a function.
47.
How can you pass a function as an argument to another function?
Answer: Option
Explanation:
In Python, you can pass a function as an argument to another function by using the function name without parentheses.
48.
What is the purpose of the
locals
function?
Answer: Option
Explanation:
The
locals
function in Python is used to access the local namespace, which contains local variables.
49.
What does the
__closure__
attribute indicate?
Answer: Option
Explanation:
The
__closure__
attribute in Python indicates the tuple of cells that contain the bindings of closed-over variables in a function.
50.
What is the purpose of the
functools.partial
function?
Answer: Option
Explanation:
The
functools.partial
function in Python is used to create a partial function with default arguments, reducing the number of arguments needed.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers