menu

Python OOPs Concepts


1. What is method overriding in Python?

The process of defining a new method in a subclass with the same name as a method in the parent class

The process of deleting a method in a subclass

The process of creating a new method in a subclass with a different name than a method in the parent class

None of the above


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

self

this

me

current


3. Which method is used to access an attribute in a class in Python?

dot notation

square bracket notation

parentheses notation

curly brace notation


4. What is the purpose of a class method in Python?

To create new objects

To call methods from other classes

To define variables in a class

To perform actions on a class itself


5. Which keyword is used to define an instance variable in Python?

class

self

instance

var


6. Which keyword is used to define a static method in Python?

static

def

classmethod

None of the above


7. What is inheritance in Python?

The process of creating a new class from an existing class

The process of deleting a class

The process of creating an object from a class

None of the above


8. 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


9. 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


10. What is polymorphism in Python?

The ability of an object to take on many forms

The process of creating a new class from an existing class

The process of hiding the implementation details of a class from its users

None of the above