Welcome to your Python OOPs Quiz

1. 
Which of the following is the correct syntax to create a class in Python?

2. 
Which of the following methods is automatically called to initialize an object in a class?

3. 
What is Instantiation in terms of OOPs terminology in Python?

4. 
What is the main purpose of the self parameter in class methods in Python?

5. 
Which of the following statements is incorrect about inheritance in Python?

6. 
What is polymorphism in OOPs?

7. 
What will be the output of the following python code?

class Base:
    def __init__(self):
        self.value = "Base"

class EdSlash(Base):
    def __init__(self):
        super().__init__()
        self.value = "EdSlash"

obj = EdSlash()
print(obj.value)

8. 
What does the super() function do in Python?

9. 
Which of the following best describes method overriding?

10. 
What is the purpose of the __str__ method in a class?

11. 
Which of the following is true about private variables in a class?

12. 
What will be the output of the following pyhton code?

class EdSlash:
    __hiddenVariable = 10
   
    def getHiddenVariable(self):
    return self.__hiddenVariable

obj = EdSlash()
print(obj.getHiddenVariable())

13. 
What is the use of the @classmethod decorator in Python?

14. 
Which of the following is an example of method overloading in Python?

15. 
What is data abstraction in OOPs in Python?

16. 
What will be the output of the following Python code?

class Parent:
    def func(self):
        print("Parent")

class Child(Parent):
    def func(self):
        print("Child")
        super().func()

obj = Child()
obj.func()

17. 
Which of the following is used to define an abstract class in Python?

18. 
Which keyword is used to define a method in a Python class?

19. 
What is setattr() used for in Python?

20. 
What are the methods in Python called which begins and ends with two underscore characters ?