Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

Which of the following is the base class in this code?

View

Which keyword is used to inherit from a class?

View

What happens when a child class does not override a method in the base class?

View

What is the correct way to call a superclass's method from a subclass?

View

Which function can return a list of all parent classes of a class?

View

What is the purpose of inheritance?

View

Which method prevents a class from being inherited?

View

Which type of inheritance allows multiple parent classes?

View

How do you invoke the parent class’s constructor in the child class?

View

Which of the following correctly defines a class that inherits from multiple classes?

View

Which of the following is the base class in this code?

class Animal: pass class Dog(Animal): pass

Animal
Dog
Both Animal and Dog
None of the above

Which keyword is used to inherit from a class?

implements
inherits
extends
None of the above

What happens when a child class does not override a method in the base class?

It throws an error
The parent’s method will be used
The child class becomes abstract
The method is skipped in execution

What is the correct way to call a superclass's method from a subclass?

Base.method()
super.method()
super().method()
BaseClass.self.method()

Which function can return a list of all parent classes of a class?

super()
dir()
mro()
parents()

What is the purpose of inheritance?

To restrict code reuse
To allow a class to use another class’s methods and attributes
To convert one data type to another
To protect private attributes

Which method prevents a class from being inherited?

abstractmethod()
final()
Python doesn’t natively support this
private()

Which type of inheritance allows multiple parent classes?

Single inheritance
Multiple inheritance
Multi-level inheritance
Hybrid inheritance

How do you invoke the parent class’s constructor in the child class?

super().__init__()
self.__init__()
Parent.__init__()
base().init()

Which of the following correctly defines a class that inherits from multiple classes?

class Child(Parent1, Parent2):
class Child implements Parent1, Parent2:
class Child extends Parent1, Parent2:
class Child: Parent1, Parent2