
Python InstitutePCAP - Certified Associate Python Programmer
Domain 1Objective 5
PCAP-31-03 1.5 Create and Use User-Defined Modules and Packages PCAP-31 Practice Questions (Page 2)
Part of the Modules and Packages domain, which accounts for 12% of the PCAP-31 exam. Python Institute does not publish an official question count, but from its 65-minute exam (~25–45 total, ~3–5 in this domain), expect 1–1 from this objective — we provide 30 practice questions to prepare you well beyond it. (estimate)
30questions here
6free pages
8concepts
12%of the exam
Questions 6–10
- 6
Which statement best describes how a user-defined module helps with namespace separation?
Select an answer first - 7
What distinguishes a nested package from a plain directory tree in Python?
Select an answer first - 8
What is the primary role of the `__init__.py` file in a Python package?
Select an answer first - 9
A small team has several scripts that each contain the same function `validate_email()`. The function is used in `signup.py`, `login.py`, and `admin.py`. The team wants to reduce duplication and make future updates easier. What is the most appropriate action?
Select an answer first - 10
A module `logger.py` contains the following code: ```python def log(message): print(f"LOG: {message}") print("Logger module loaded") ``` When another script imports `logger`, the message "Logger module loaded" is printed. The developer wants this message to appear ONLY when `logger.py` is run directly, not when it is imported. What change should be made?
Select an answer first
Finished these 5 questions?
Review the revealed explanations, or continue through the curriculum.
Free Basic Practice is a study aid with revealable answers — not a scored exam. Examers.io is independent and not affiliated with or endorsed by Python Institute. “PCAP-31” is a trademark of its owner, used for identification only.