Python Institute PCAP-31-03 - Certified Associate in Python Programming Exam
Page: 1 / 23
Total 111 questions
Question #1 (Topic: Exam A)
What is true about Python packages? (Choose two.)
A. a code designed to initialize a package’s state should be placed inside a file named init.py
B. a package’s contents can be stored and distributed as an mp3 file
C. __pycache__ is a folder that stores semi-compiled Python modules
D. the sys.path variable is a list of strings
Answer: AC
Question #2 (Topic: Exam A)
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)
import sys
import math
b1 = type(dir(math)) is list
b2 = type(sys.path) is list
print(b1 and b2)
A. None
B. True
C. 0
D. False
Answer: B
Question #3 (Topic: Exam A)
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.)
Which of the following snippets will let you invoke the function? (Choose two.)
A. from pypack.pymod import pyfun
pyfun() B. import pypack
pymod.pyfun() C. from pypack import *
pyfun() D. import pypack
import pypack.pymod
pypack.pymod.pyfun()
pyfun() B. import pypack
pymod.pyfun() C. from pypack import *
pyfun() D. import pypack
import pypack.pymod
pypack.pymod.pyfun()
Answer: AD
Question #4 (Topic: Exam A)
Assuming that the code below has been executed successfully, which of the following expressions will always evaluate to True? (Choose two.)
import random
v1 = random.random()
v2 = random.random()
import random
v1 = random.random()
v2 = random.random()
A. len(random.sample([1,2,3],1)) > 2
B. v1 == v2
C. random.choice([1,2,3]) > 0
D. v1>1
Answer: BC
Question #5 (Topic: Exam A)
With regards to the directory structure below, select the proper forms of the directives in order to import module_c. (Choose two.)

A. from pypack.upper.lower import module_c
B. import pypack.upper.lower.module_c
C. import upper.module_c
D. import upper.lower.module_c
Answer: AB