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.)
A. False (ClassB inherits from only one base class, ClassA).
B. False (__name__ is '__main__' when the script is run directly).
C. True (The inherited __str__ method from ClassA returns 'Object').
D. True (Since the code is run as a main script, ClassA's module is '__main__').
Correct: C, D
print("A.", ClassB.__bases__, len(ClassB.__bases__),len(ClassB.__bases__) == 2) #False, it returns 1 as one module is there
print("B.", __name__, __name__ == 'code.py') #False, it is: __main__
print("C.", str(Object), str(Object) == 'Object') #True
print("D.", ClassA.__module__, ClassA.__module__ == '__main__') #True
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Abbribas
1 month, 2 weeks agoDave304409
1 year agoJeyTlenJey
1 year agoDKAT2023
1 year, 1 month ago