What this Python inheritance question tests
This is a medium-difficulty Python language question that probes your understanding of method resolution order (MRO), class hierarchies, and how Python resolves method calls in multi-level inheritance chains. It's the kind of question that separates candidates who have read the docs from those who rely on intuition alone.
To answer correctly, you need to trace through a class hierarchy, understand how instance methods and constructors chain together, and predict what gets executed when. The question rewards careful step-by-step reasoning: working through each method call, tracking which class each method belongs to, and understanding whether calls propagate up the inheritance chain as expected.
- Method Resolution Order (MRO) and
super() - Constructor chaining across parent and child classes
- Instance attributes and scope in inherited classes
- The C3 linearization algorithm (for complex cases)