PCAP Modules and Packages Practice Question
Inside a package 'data', there is a subpackage 'io' and a module 'utils'. Which import statement inside the 'io' subpackage correctly imports the 'helper' function from the sibling module 'utils'?
⚠ Common exam trap
Python Institute often tests the distinction between a single dot (`.` for same-package siblings) and double dots (`..` for parent-package siblings), causing candidates to mistakenly use `from .utils import helper` when the target module is in the parent package, not the current one.
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
✓
from ..utils import helper
The `..` prefix in a relative import refers to the parent package (`data`), and then `utils` is a sibling module of `io` within that parent package. This allows the `io` subpackage to import the `helper` function from the sibling module `utils` using `from ..utils import helper`.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
from ..utils import helper
Why this is correct
Correct. The leading `..` is a relative import that ascends one level from the current subpackage `data.io` to the parent package `data`, then enters the sibling `utils` subpackage/module, from which `helper` is imported. This is the proper PEP 328 syntax for referring to a sibling in a package hierarchy, and it works regardless of the top-level package's absolute location on `sys.path`.
- ✗
import data.utils.helper
Why it's wrong here
The `import data.utils.helper` statement is syntactically valid only if every dotted component names a loadable module/package; when `helper` is a function or class defined inside `utils`, this form cannot bind it — Python would attempt to load `helper` as a module and fail. Even if it were a module, this absolute path skips the relative context and would break if `data` is not importable from the current environment. Because `helper` is an attribute of the sibling module, `from data.utils import helper` would be the absolute equivalent, not this form.
- ✗
from .utils import helper
Why it's wrong here
Using a single dot (`from .utils import helper`) resolves from the current package (`data.io`), so Python looks for `data.io.utils` — a subpackage/module inside `io`. Unless there happens to be a `utils` module nested under `io`, this raises ModuleNotFoundError. The double dot is required to step up to the parent package before traversing to the sibling `utils`, making this option wrong.
- ✗
from data.io.utils import helper
Why it's wrong here
`from data.io.utils import helper` assumes `utils` is located inside the `io` subpackage, since absolute dotted imports traverse each component as a child of the previous one. In the given layout, `utils` is a sibling of `io` directly under `data`, so this path points to the wrong location and would fail with ModuleNotFoundError. Additionally, absolute imports tie the code to the external package name `data`, so a future rename or running the package from a different context would silently break the import.
Go deeper
Related to this question
About these practice questions
One of 421 original PCAP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.