Python OOPS Interview Questions

    Question 1Python OOPs - Class Creation

    Which of the following correctly defines a class in Python?

    Question 2Python OOPs - Object Instantiation

    What is the correct way to create an object of a class Person?

    Question 3Python OOPs - Constructor

    Which method is the constructor in Python?

    Question 4Python OOPs - Instance Variables

    What will this code print?

    class Test: def __init__(self, x): self.x = x obj = Test(5) print(obj.x)

    Question 5Python OOPs - Class Variables

    Which of the following is a class variable?

    class Test: y = 10

    Question 6Python OOPs - Inheritance

    Which syntax correctly inherits class Parent in a class Child?

    Question 7Python OOPs - Method Overriding

    What is method overriding?

    Question 8Python OOPs - self Keyword

    What is the purpose of self in a class method?

    Question 9Python OOPs - super()

    What is the purpose of super() in Python?

    Question 10Python OOPs - Encapsulation

    Which of the following demonstrates encapsulation?