ProgrammingVery hardGATE CS · Product-company placement

Which statement about the C3 method resolution order is correct for `class D(B, C)` where both B and C inherit from A?

  1. A. D's MRO is D, B, C, A, object, and super() inside B.method can call C.method when the instance is a D
  2. B. D's MRO is D, B, A, C, object (depth-first), so super() in B always reaches A
  3. C. super() in B always calls A's method, whatever the actual type of self
  4. D. Python raises TypeError because both bases share the parent A

Correct answer: A. D's MRO is D, B, C, A, object, and super() inside B.method can call C.method when the instance is a D

C3 linearisation keeps each class before its parents and respects base order, giving D, B, C, A, object. super() follows the MRO of type(self), so in a D instance B's super() is C, which is what makes cooperative multiple inheritance work.

More Python Programming questions

Exams that ask this topic