Python Programming - Inheritance
Exercise : Inheritance - General Questions
- Inheritance - General Questions
61.
What is the purpose of the
__slots__
attribute in Python classes?
Answer: Option
Explanation:
The
__slots__
attribute is used to restrict the set of attributes that can be assigned to instances, providing memory optimization.
62.
In Python, what is the purpose of the
super()
function?
Answer: Option
Explanation:
The
super()
function is used to access methods and attributes of the superclass in Python.
63.
How does Python handle diamond inheritance conflicts?
Answer: Option
Explanation:
Python uses the C3 linearization algorithm to determine the method resolution order in case of diamond inheritance conflicts.
64.
What is the purpose of the
__bases__
attribute in Python classes?
Answer: Option
Explanation:
The
__bases__
attribute is used to access the base classes of a class in Python.
65.
In Python, what is the purpose of the
__init_subclass__()
method?
Answer: Option
Explanation:
The
__init_subclass__()
method is used to customize the initialization of subclasses in Python.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers