Question 279 of 511
Modules and PackageseasyMultiple ChoiceObjective-mapped

Quick Answer

The correct answer is that the package mypackage is not installed or not in the Python path. This is because Python’s ImportError, specifically the “Module Not Found” error, occurs when the interpreter searches through every directory listed in sys.path and cannot locate the requested module or package. On the Certified Associate Python Programmer PCAP exam, this question tests your understanding of Python’s module resolution mechanism and common runtime errors—a frequent trap is assuming the module exists just because the script references it, or confusing ImportError with a syntax error. The exam expects you to recognize that the most likely cause is an environmental issue: either the package was never installed via pip, or the script is running from a directory not included in the Python path. A simple memory tip: think of sys.path as Python’s map—if the module isn’t on the map, you get lost with an ImportError.

PCAP Modules and Packages Practice Question

This PCAP practice question tests your understanding of modules and packages. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

Exhibit

Traceback (most recent call last):
  File "script.py", line 1, in <module>
    from mypackage import myfunction
ModuleNotFoundError: No module named 'mypackage'

A user runs script.py and gets the above error. Which of the following is the most likely cause?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "most likely"

    Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

Question 1easymultiple choice
Full question →

Exhibit

Traceback (most recent call last):
  File "script.py", line 1, in <module>
    from mypackage import myfunction
ModuleNotFoundError: No module named 'mypackage'

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The package mypackage is not installed or not in the Python path.

The error message indicates that Python cannot find the module `mypackage`. This typically happens when the package is not installed (e.g., via pip) or the directory containing it is not in `sys.path`. Option C correctly identifies this as the most likely cause, as Python raises an `ImportError` when it cannot locate a module or package during import.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The function myfunction does not exist in mypackage.

    Why it's wrong here

    That would cause an ImportError for the name, not the module.

  • The script.py is inside the mypackage directory, causing a conflict.

    Why it's wrong here

    That would not cause a ModuleNotFoundError for mypackage.

  • The package mypackage is not installed or not in the Python path.

    Why this is correct

    The error clearly states the module is not found.

    Clue confirmation

    The clue word "most likely" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • There is a syntax error in script.py.

    Why it's wrong here

    The traceback shows the error is on the import line, not syntax.

Common exam traps

Common exam trap: answer the scenario, not the keyword

Python Institute often tests the distinction between `ImportError` (module not found) and `AttributeError` (module found but attribute missing), so candidates mistakenly choose Option A when they see an import-related error, confusing a missing module with a missing function within an existing module.

Trap categories for this question

  • Command / output trap

    The traceback shows the error is on the import line, not syntax.

Detailed technical explanation

How to think about this question

When Python encounters `import mypackage`, it searches for the package in directories listed in `sys.path`, which includes the current script's directory, `PYTHONPATH` environment variable, and site-packages. If the package is not found, Python raises `ModuleNotFoundError` (a subclass of `ImportError`). A common real-world scenario is forgetting to install a third-party package with `pip install mypackage` or not having the package's parent directory in `sys.path` when running a script from a different location.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related PCAP practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free PCAP practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this PCAP question test?

Modules and Packages — This question tests Modules and Packages — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: The package mypackage is not installed or not in the Python path. — The error message indicates that Python cannot find the module `mypackage`. This typically happens when the package is not installed (e.g., via pip) or the directory containing it is not in `sys.path`. Option C correctly identifies this as the most likely cause, as Python raises an `ImportError` when it cannot locate a module or package during import.

What should I do if I get this PCAP question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "most likely". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More PCAP practice questions

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This PCAP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCAP exam.