Object-Oriented Programming in Python

Review your understanding of classes,inheritance,and magic methods.

1. What keyword is used to define a class in Python?
2. Which of the following are types of methods in a Python class? (Select all that apply)
3. Python supports multiple inheritance.
4. What is the term for the process of hiding the internal details of a class and exposing only necessary information? (one word)
5. Which method is automatically called when an object is created to initialize its attributes?
6. What type of inheritance occurs when a class inherits from more than one parent class?
7. Which of the following statements about Python classes are true? (Select all that apply)
8. What is the name for a function defined inside a class?
9. The __new__ method is responsible for creating a new instance of a class.
10. Which of the following is an example of a class attribute?
11. Which of the following are considered pillars of Object-Oriented Programming? (Select all that apply)
12. In a Python class, what is the conventional name for the first parameter of an instance method?
13. In Python, a child class can override a method from its parent class.
14. What are the characteristics of instance attributes? (Select all that apply)
15. Which built-in function is used to check if an object is an instance of a specific class?
16. What keyword is used to call a method from the parent class within a child class? (one word)
17. Static methods in Python can access and modify class attributes directly without an instance.
18. What is the output of the following code? class MyClass: x = 5 obj = MyClass() print(obj.x)
19. Which of the following are valid ways to define a class method in Python? (Select all that apply)
20. What is the special method used to delete an object in Python? (enclose in double underscores)
Answered 0 of 0 — 0 correct