Which of the following lambda definitions are correct? (Choose two.)
- A. lambda(x,y) = x//y - x%y
- B. lambda x,y: return x//y - x%y
- C. lambda x,y: (x,y)
- D. lambda x,y: x//y - x%y
Show Answer
- C. lambda x,y: (x,y)
- D. lambda x,y: x//y - x%y
Free PCAP-31-03 sample questions for the Certified Associate in Python Programming exam. No account required: study at your own pace.
Want an interactive quiz? Take the full PCAP-31-03 practice testLooking for more? Click here to get the full PDF with 57+ practice questions for $10 for offline study and deeper preparation.
Which of the following lambda definitions are correct? (Choose two.)
A Python module named pymod.py contains a variable named pyvar. Which of the following snippets will let you access this variable? (Choose two.)
What is true about Object-Oriented Programming in Python? (Choose two.)
What is true about Python packages? (Choose two.)
What is the expected output of the following code? import sys import math b1 = type(dir(math)[0]) is str b2 = type(sys.path[-1]) is str print(b1 and b2)
A Python package named pypack includes a module named pymod.py which contains a function named pyfun(). Which of the following snippets will let you invoke the function? (Choose two.)
Assuming that the math module has been successfully imported, which of the following expressions evaluate to True? (Choose two.)
What is true about Python class constructors? (Choose two.)
What is the expected output of the following code? import sys import math b1 = type(dir(math)) is list b2 = type(sys.path) is list print(b1 and b2)
Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? (Choose two.) string = 'REPTILE'[:3:] string = string[-1] + string[-2::-1]
Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? (Choose two.) string = 'python'[::2] string = string[-1] + string[-2]
What is the expected output of the following code? import sys b1 type (dir(sys)) is str b2 type (sys.path[-1]) is str print (b1 and b2)
Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? (Choose two.) string = 'SKY'[::-1] string = string[-1]
Which of the following expressions evaluate to True? (Choose two.)
What is true about lambda functions? (Choose two.)
Download the complete PCAP-31-03 study bundle with 57+ questions in a single printable PDF.