QuestionQ16

VerifiedObject-Oriented Programming

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

Question Image

Choose two
Explanation

When a Python file is run directly, its module name is __main__, so __name__ == '__main__' is true. ClassB directly inherits only from ClassA; therefore, ClassB.__bases__ contains one item and its length is 1.

Community Discussion

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