
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 5)
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 21–25
- 21
A developer has a package `mypkg` with the following structure: ``` project/ main.py mypkg/ __init__.py sub/ __init__.py helper.py ``` The developer runs `main.py` from the `project` directory. The import `from mypkg.sub import helper` fails with `ModuleNotFoundError`. The developer checks `sys.path` and confirms `project` is listed. What is the most likely cause of the failure?
Select an answer first - 22
What happens when Python executes the statement `import mymodule` for the first time?
Select an answer first - 23
What is the primary purpose of the `__pycache__` directory created by Python?
Select an answer first - 24
A developer creates a package `shapes` with the following structure: ``` shapes/ __init__.py circle.py square.py ``` The `__init__.py` file is currently empty. The developer wants `import shapes` to automatically make the `circle` submodule available as `shapes.circle`. What should be added to `__init__.py`?
Select an answer first - 25
A developer is writing a module `config.py` that contains a constant `_internal_token = 'abc123'` and a function `get_public_config()`. The developer wants to signal to other developers that `_internal_token` should not be accessed directly. What is the correct way to communicate this intent?
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.