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 multilevel inheritance?

View

What happens if two parent classes have a method with the same name and a child class inherits both?

View

What is the order in which classes are resolved in Python multiple inheritance?

View

Which built-in function returns the MRO of a class?

View

How do you call a superclass’s method explicitly in a multiple inheritance scenario?

View

Which type of inheritance involves a class being derived from both a parent and a grandparent class?

View

What does the isinstance() function check?

View

What happens when you inherit from two unrelated classes?

View

Which type of inheritance is demonstrated in this code?

View

Which keyword can be used to prevent a class from being inherited?

View

What is multilevel inheritance?

A class inherits from multiple parent classes
A class inherits from a class that already inherits another class
Inheritance that only involves one base class
A class that cannot be inherited further

What happens if two parent classes have a method with the same name and a child class inherits both?

It raises a compilation error
Python invokes the method of the first parent class
The child class must override the method
Python raises a method conflict error

What is the order in which classes are resolved in Python multiple inheritance?

Left-to-right
Right-to-left
Based on the first method found in the chain
Using Method Resolution Order (MRO)

Which built-in function returns the MRO of a class?

super()
dir()
mro()
issubclass()

How do you call a superclass’s method explicitly in a multiple inheritance scenario?

super().method()
BaseClass.method(self)
super().method(self)
Parent.method()

Which type of inheritance involves a class being derived from both a parent and a grandparent class?

Single inheritance
Multiple inheritance
Hybrid inheritance
Multilevel inheritance

What does the isinstance() function check?

Whether two objects are the same
If an object is of a specific class or subclass
If two classes have identical methods
If an object belongs to a class only by name

What happens when you inherit from two unrelated classes?

The code will throw a runtime error
The child class can use methods from both parent classes
The methods of one parent class will overwrite the other
Python does not allow such inheritance

Which type of inheritance is demonstrated in this code?

class A: pass class B: pass class C(A, B): pass

Single inheritance
Multilevel inheritance
Multiple inheritance
Hybrid inheritance

Which keyword can be used to prevent a class from being inherited?

final
private
Python does not support this directly
__restrict__