Exam PCAP All QuestionsBrowse all questions from this exam
Question 141

Assuming that the code below has been placed inside a file named code.py and executed successfully, which of the following expressions evaluate to True?

(Choose two.)

    Correct Answer: A, B

    ClassA.__module__ == '__main__' evaluates to True because the code is assumed to be run in the main module context. __name__ == '__main__' also evaluates to True for the same reason. The other options are incorrect: str(Object) == 'Object' is False because Object is an instance of ClassA, which does not override the __str__ method, so it uses the default string representation of the object. len(ClassB.__bases__) == 2 is also False because ClassB has only one direct base class, which is ClassA.

Discussion
macxszOptions: AB

True: A. ClassA.__module__ == '__main__' B. __name__ == '__main__'

AmfortasOptions: AB

A and B are True

JnanadaOptions: AB

A & B are true

simplex06Options: AB

class ClassA: var = 1 def __init__(self, prop): prop1 = prop2 = prop class ClassB(ClassA): def __init__(self, prop): prop3 = prop ** 2 super().__init__(prop) def __str__(self): return 'Object' Object = ClassA(2) A and B are True

Damon54

There are at least 45 completely wrong questions in this dump!!!!! be careful

seaverickOptions: AB

class ClassA: var = 1 def __init__(self, prop): prop1 = prop2 = prop class ClassB(ClassA): def __init__(self, prop): prop3 = prop ** 2 super().__init__(prop) def __str__(self): return 'Object' Object = ClassA(2) print(ClassA.__module__ == '__main__') print(__name__ == '__main__') #print(str(Object) == 'Object')#TypeError: '_io.TextIOWrapper' object is not callable print(len(ClassB.__bases__) == 2) Ans is A,B

kstrOptions: AB

AB tested