PCAP-31-03 Practice Test practice questions, page 5 of 5, with answer review and explanations.
Question 21
Assuming that the code below has been executed successfully, which of the following expressions evaluate to True? (Choose two.)
'var' in Class.__dict__
'data' in Object.__dict
len(Class.__dict__) == 1
'data' in Class.__dict__
Question 22
What is the expected behavior of the following code?
it outputs 1
it outputs 0
it raises an exception
it outputs 2
Question 23
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.)
str(Object) = 'Object'
__name__ == '__main__'
len(ClassB.__bases__) == 1
ClassA.__module__ == 'ClassA'
Question 24
Assuming that the following inheritance set is in force, which of the following classes are declared properly? (Choose two.)
class Class_3(A,C): pass
class Class_2(B,C): pass
class Class_4(A,B): pass
class Class_1(C,B): pass
Question 25
Assuming that the following piece of code has been executed successfully, which of the expressions evaluate to True? (Choose two.)