Bird
Raised Fist0

Consider this package structure:

medium📝 Predict Output Q5 of Q15
Python - Modules and Code Organization
Consider this package structure:
data/
  __init__.py
  loader.py
  processor.py
What will be the output of this code?
from data.loader import load_data
print(load_data())

Assuming load_data returns the string 'Data loaded'.
ANone
Bload_data
CError: load_data not found
DData loaded
Step-by-Step Solution
Solution:
  1. Step 1: Understand import from module function

    The code imports the function load_data directly from data.loader module.
  2. Step 2: Call the function and print result

    Calling load_data() returns 'Data loaded', which is printed.
  3. Final Answer:

    Data loaded -> Option D
  4. Quick Check:

    Direct function import and call = 'Data loaded' [OK]
Quick Trick: Use 'from package.module import function' to import functions [OK]
Common Mistakes:
MISTAKES
  • Trying to import function without module
  • Calling function without parentheses
  • Assuming function returns None

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes