Modules, Libraries & Debugging Flashcards
7 cards from real POC practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Modules, Libraries & Debugging flashcards as text
What does the `os.path.join()` function do?
Answer: Builds file paths using the OS-appropriate separator
`os.path.join()` constructs a path string using the correct separator for the current operating system.
Which module provides the `defaultdict` and `Counter` data structures?
Answer: collections
`collections` is the standard library module that contains `defaultdict`, `Counter`, `OrderedDict`, and `deque`.
What is a Python package?
Answer: A directory containing an `__init__.py` file and modules
A package is a directory that contains an `__init__.py` file, allowing it to be imported as a namespace.
How do you set a conditional breakpoint in `pdb` that only triggers when `x > 10`?
Answer: condition 1 x > 10
The `condition bpnumber expression` command in pdb applies a condition to an existing breakpoint number.
Which `logging` function call creates a message at the DEBUG level?
Answer: logging.debug('msg')
`logging.debug()` logs a message with severity DEBUG, the lowest standard level.
What does `importlib.reload(module)` do?
Answer: Re-executes the module's code and updates its namespace in place
`importlib.reload()` re-runs the module's source code, refreshing its contents without removing existing references.
Which attribute of a module stores its file path on disk?
Answer: __file__
`module.__file__` contains the absolute path to the `.py` (or `.pyc`) file for that module.