Examers.io
ExamsOrganizationsHow it worksPricingHelp & FAQ
Python Institute logo

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 1)

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 1–5

  1. 1foundation · easy

    When does Python write a `.pyc` file into the `__pycache__` directory?

    Select an answer first
  2. 2application · medium

    A developer has a custom module `utilities.py` stored in `/home/developer/scripts`. When running a Python script from `/home/developer/projects`, the statement `import utilities` raises a `ModuleNotFoundError`. The developer does not want to permanently alter the system environment. What is the most direct way to make the import work for the current script?

    Select an answer first
  3. 3expert · medium

    A developer has a module `tool.py` with the following code: ```python def run(): print("Running tool") if __name__ == '__main__': run() ``` The developer also has a script `main.py` that imports `tool` and calls `tool.run()`. The developer wants to add a test that verifies `run()` is called when `tool.py` is executed directly. Which approach will work?

    Select an answer first
  4. 4foundation · easy

    Given a file named `geometry.py` in the same directory as your script, which statement correctly imports the `circle_area` function from it?

    Select an answer first
  5. 5foundation · easy

    In a file `mymod.py`, what is the value of `__name__` when the file is imported as a module?

    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.