What would you use instead of XXX if you want to check whether a certain ` key' exists in a dictionary called diet? (Select two answers)
II if XXX:
print("Key exists")
A. 'key' in diet
B. diet['key'] != None
C. diet.exists('key')
D. 'key' in diet.keys()
The simplest possible class definition in Python can be expressed as:
A. class X:
B. class X: pass
C. class X: return
D. class X: {}
What is the expected behavior of the following code?
It will:
A. print 0
B. cause a runtime exception
C. prints 3
D. print an empty line
What is the expected behavior of the following code?
A. it outputs 2
B. it raises an exception
C. it outputs 3
D. it outputs 5
Assuming that the following code has been executed successfully, selected the expression which evaluate to True (Select two answers)
def f (x,y): nom, denom = x, y def g():
return nom / denom
return g a = f(!,2) b = f(3,4)
A. a ( ) == 4
B. a is not None
C. b ( ) == 4
D. a ! = b
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? (Select two answers)
A. str (Object) = 'Object1
B. Class A.__module__ == ' main__'
C. len (ClassB.__bases__) == 2
D. __name__== '__main__'
A Python module named pymod.py contains a variable named pyvar.
Which of the following snippets will let you access the variable? (Select two answers)
A. import pyvar from pymod pyvar = 1
B. from pymod import pyvar = 1
C. from pymod import pyvar pyvar ()
D. import pymod pymod.pyvar = 1
Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only Python Institute exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your PCAP-31-03 exam preparations and Python Institute certification application, do not hesitate to visit our Vcedump.com to find your solutions here.