QuestionQ90

VerifiedObject-Oriented Programming

Assuming the code below is saved in a file named code.py and executes successfully, which of the following expressions evaluate to True?

Question Image

Choose two
Explanation

ClassB.__bases__ contains only its direct base class, ClassA, so its length is not 2. When code.py is run directly, __name__ is __main__, and classes defined in that execution context have __module__ set to __main__. The Object instance inherits ClassA.__str__, which returns 'Object'.

Community Discussion

No comments yet. Be the first to start the discussion!