Certified Associate in Python Programming (PCAP) — Question 128
What is true about Python packages? (Choose two.)
Answer options
- A. a package is a single file whose name ends with the pa extension
- B. a package is a group of related modules
- C. the __name__ variable always contains the name of a package
- D. the pyc extension is used to mark semi-compiled Python packages
Correct answer: B, D
Explanation
Option B is correct because a package indeed consists of a collection of related modules. Option D is also correct as the .pyc extension is used for compiled Python files. Option A is incorrect since a package is not defined by a specific file extension like 'pa', and option C is misleading because the __name__ variable indicates the name of a module or package, but it does not always represent a package's name.