Return to Dashboard

Knowledge Check: Module 29

Answer the 10 questions below about Object-Oriented Programming concepts introduced in Module 29.

You need to answer at least 6 questions correctly to pass this check.

You can retry the quiz as many times as you need. Passing updates your progress on the dashboard (localStorage).

1. Which keyword is used to define a blueprint for creating objects in Python?

2. What is the special method name used to initialize the attributes of an object when it's created?

3. Inside a class method, what does the conventional parameter name self refer to?

4. Given a class defined as class Dog: ..., how do you create a new instance (object) of this class?

5. If an object book has an attribute title assigned within its __init__ method (e.g., self.title = "Python Basics"), how would you access this attribute from outside the class?

6. What is the term for a variable that belongs to a specific instance of a class?

7. Consider the following code:

class Car:
    def __init__(self, color):
        self.color = color

my_car = Car("red")

What does my_car represent?

8. In Object-Oriented Programming, what concept does a 'class' primarily represent?

9. Which part of the following code defines the attributes an `Item` object will have upon creation?

class Item:
    # Part 1
    def __init__(self, name, price):
        # Part 2
        self.name = name
        self.price = price

    # Part 3
    def display_info(self):
        print(f"{self.name}: ${self.price}")

# Part 4
item1 = Item("Book", 15)

10. Creating multiple objects from the same class is an example of using the class as a what?