menu

Python OOPs Concepts


1. Which of the following is true about method overriding in Python?

It occurs when a subclass provides a different implementation for a method that is already defined in the parent class

It occurs when a subclass adds a new method to the parent class

It occurs when a subclass inherits all the methods from the parent class

None of the above


2. Which method is used to access the representation of an object in Python?

str

repr

eq

cmp


3. Which keyword is used to create a new instance of a class in Python?

self

new

create

None of the above


4. Which of the following is a decorator in Python?

@classmethod

@staticmethod

@property

All of the above


5. Which of the following is true about multiple inheritance in Python?

A class can inherit from multiple classes at the same time

A class can inherit from only one class at a time

Multiple inheritance is not supported in Python

None of the above


6. Which method is used to delete an object in Python?

del

delete

remove

destroy


7. Which of the following is true about the super() function in Python?

It is used to call a method in the parent class

It is used to call a method in the current class

It is used to call a method in a child class

None of the above


8. Which keyword is used to refer to the current object in a class method in Python?

self

this

me

current


9. Which of the following is true about class variables in Python?

They are defined inside a method

They are shared by all instances of a class

They are accessed using the instance name

None of the above


10. What is the purpose of a destructor in Python?

To free up resources when an object is destroyed

To create a new object

To define variables in a class

To call methods from other classes