QuestionQ77

VerifiedObject-Oriented Programming

Assuming the following code has executed successfully, which expressions evaluate to True?

Question Image

Choose two
Explanation

A.VarA retains the value 1. B is a subclass of A, so an instance of B is also considered an instance of A by isinstance(). B.VarA overrides the inherited value with 2, and two separate calls to A() create distinct objects, so they are not identical under is.

Learn more

Community Discussion

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