Certified Associate in Python Programming (PCAP-31-03) — Question 7
What is true about Python packages? (Choose two.)
Answer options
- 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
Correct answer: C, D
Explanation
Option C is correct because __pycache__ indeed stores the bytecode-compiled versions of Python modules for efficiency. Option D is also correct as sys.path is a list that Python uses to determine which directories to search for modules. Options A and B are incorrect because A misrepresents the naming convention for the initialization file, and B incorrectly states how package contents can be distributed.