โ† All POC Flashcard Decks

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
  1. Which statement correctly imports only the `sqrt` function from the `math` module?

    Answer: from math import sqrt

    The `from module import name` syntax imports a specific name directly into the current namespace.

  2. What does `sys.argv[0]` contain when running a Python script?

    Answer: The name of the script file

    `sys.argv[0]` always holds the script's filename (or an empty string in interactive mode).

  3. What is the purpose of the `__all__` list defined inside a module?

    Answer: Controls what is exported when `from module import *` is used

    `__all__` explicitly declares which names are exported during a wildcard import.

  4. Which built-in function returns a list of names defined in the current namespace or a given object?

    Answer: dir()

    `dir()` returns a sorted list of names in the current scope or the attributes of the passed object.

  5. In the `logging` module, which level is HIGHER in severity than WARNING?

    Answer: ERROR

    The logging severity order is DEBUG < INFO < WARNING < ERROR < CRITICAL.

  6. What exception is raised when you try to import a module that does not exist?

    Answer: ModuleNotFoundError

    `ModuleNotFoundError` (a subclass of `ImportError`) is raised when Python cannot locate the specified module.

  7. Which `pdb` command prints the value of a variable while debugging?

    Answer: print / p

    In pdb, the `p expression` command evaluates and prints the value of an expression.