Learn with Yasir

Share Your Feedback

Fill in the Blanks – Python Inheritance Practice Questions


Sharpen your understanding of Object-Oriented Programming with these fill-in-the-blank exercises on Python inheritance. Perfect for students, beginners, and interview prep to reinforce key OOP concepts in Python.

🔍 Fill in the Blanks

🟢 Beginner

🟡 Intermediate

🔴 Advanced


🧠 Example-Based Fill in the Blanks

  1. class Person:
        def __init__(self, name):
            self.name = name
    
        def introduce(self):
            print(f"Hi, I'm {self.name}")
    
    class Student(Person):
        def study(self):
            print(f"{self.name} is studying.")
    

    ✍️ In the above code, the `Student` class ________ from the `Person` class.

    Answer

    inherits

  2. class Vehicle:
        def __init__(self, brand):
            self.brand = brand
    
        def drive(self):
            print("The vehicle is moving.")
    
    class Car(Vehicle):
        def __init__(self, brand, model):
            super().__init__(brand)
            self.model = model
    
        def drive(self):
            print(f"The {self.brand} {self.model} is driving.")
    

    ✍️ The `Car` class uses the `super()` function to call the constructor of the ________ class.

    Answer

    Vehicle


📚 Related Resources


🧠 Practice & Progress

Explore More Topics

Python Fundamentals

Flow Control Statements


Python Functions


Fundamentals more ...




🧠 Python Advanced

Object-Oriented Programming in Python (OOP)

More...

🧠 Modules