Python Programming - Functions
Exercise : Functions - General Questions
- Functions - General Questions
66.
What is the purpose of the
super()
function?
Answer: Option
Explanation:
The
super()
function in Python is used to access the superclass of a class, allowing you to call methods from the superclass.
67.
What does the
__slots__
attribute do in a Python class?
Answer: Option
Explanation:
The
__slots__
attribute in Python is used to restrict the creation of new attributes in class instances.
68.
What is the purpose of the
itertools.chain
function?
Answer: Option
Explanation:
The
itertools.chain
function in Python is used to chain multiple iterables into a single iterable.
69.
What does the
locals()
function return?
Answer: Option
Explanation:
The
locals()
function in Python returns a dictionary representing the local variables in the current namespace.
70.
What is the purpose of the
functools.lru_cache
decorator?
Answer: Option
Explanation:
The
functools.lru_cache
decorator in Python is used to cache the results of a function, reducing the computation time for repeated calls with the same arguments.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers