Question 1
What is inheritance in Python?
A way to hide data
A way to achieve multiple inheritances
A mechanism to reuse code and create a new class using an existing class
A way to define private methods
Question 2
Which keyword is used to indicate inheritance in Python?
extends
inherits
issubclass
class
Question 3
What is the purpose of the super() function in Python inheritance?
To call the superclass constructor
To create a subclass
To access private methods
To hide the implementation details
Question 4
Which type of inheritance is represented by a child class inheriting from more than one class?
Single Inheritance
Multiple Inheritance
Hierarchical Inheritance
Hybrid Inheritance
Question 5
What is method overriding in Python inheritance?
Creating a new method in the subclass
Using the same method name in the superclass and subclass
Changing the name of a method in the subclass
Preventing access to a method in the superclass
Question 6
What is the role of the __init__ method in a subclass during inheritance?
It initializes variables only in the subclass
It initializes variables in both the superclass and subclass
It is not used in the subclass
It creates a new instance of the superclass
Question 7
Which method is used to access the attributes of a superclass in Python inheritance?
superclass.__getattribute__()
super().__get__()
super().__getattribute__()
superclass.__get__()
Question 8
What is the purpose of an abstract class in Python?
To create instances of a class
To define a blueprint for other classes
To hide the implementation details of a class
To prevent inheritance
Question 9
What is a metaclass in Python?
A class that inherits from multiple classes
A class that is used for method overriding
A class that defines the behavior of other classes (class of a class)
A class that is an instance of another class
Question 10
What is the purpose of the super() function in Python multiple inheritance?
To call the constructor of the first superclass
To call the constructor of all superclasses in a specific order
To call the constructor of the last superclass
To call the constructor of a randomly chosen superclass
There are 25 questions to complete.