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

What is the primary benefit of inheritance?

View

How do you specify that a class inherits from another class?

View

What is single inheritance?

View

Can a derived class override methods from the base class?

View

What does super() do in a subclass?

View

What kind of inheritance involves one class deriving from two or more classes?

View

What happens if a subclass doesn’t call super()?

View

What is multilevel inheritance?

View

What is the difference between isinstance() and issubclass()?

View

Can a base class access attributes of a subclass?

View

What is the primary benefit of inheritance?

It simplifies variable declarations
It allows code reuse between classes
It speeds up code execution
It prevents creating objects

How do you specify that a class inherits from another class?

Using inherits keyword
Using parentheses with the base class name
Using super()
Declaring it inside the constructor

What is single inheritance?

When a class inherits from multiple classes
When a class inherits from only one class
When all classes are inherited from the same parent
Inheritance within a function

Can a derived class override methods from the base class?

Yes
No
Only if the method is public
Only if the base class allows it

What does super() do in a subclass?

Creates a new object
Calls the base class constructor
Deletes the base class
Skips the constructor

What kind of inheritance involves one class deriving from two or more classes?

Single inheritance
Multiple inheritance
Hybrid inheritance
Hierarchical inheritance

What happens if a subclass doesn’t call super()?

The object isn’t created
The base class constructor is not executed
Python raises an error
All class variables are deleted

What is multilevel inheritance?

A class inherits directly from another class
A chain of inheritance across multiple classes
Two classes inherit from the same parent
One class contains multiple methods

What is the difference between isinstance() and issubclass()?

isinstance() checks the parent class
issubclass() checks if a class is derived from another class
isinstance() is only for functions
issubclass() only works with built-in classes

Can a base class access attributes of a subclass?

Yes
No
Only if the attribute is global
Only for public attributes