Bird
Raised Fist0

Which of the following commands correctly creates an empty __init__.py file inside a folder named mypackage?

easy📝 Syntax Q3 of Q15
Python - Modules and Code Organization
Which of the following commands correctly creates an empty __init__.py file inside a folder named mypackage?
Amkdir mypackage/__init__.py
Btouch mypackage/__init__.py
Crm mypackage/__init__.py
Dpython mypackage/__init__.py
Step-by-Step Solution
Solution:
  1. Step 1: Understand the command

    The touch command creates an empty file or updates the timestamp if it exists.
  2. Step 2: Apply to the file

    Using touch mypackage/__init__.py creates an empty __init__.py file inside the mypackage folder.
  3. Final Answer:

    touch mypackage/__init__.py -> Option B
  4. Quick Check:

    Creating an empty file requires touch [OK]
Quick Trick: Use 'touch' to create empty files quickly [OK]
Common Mistakes:
MISTAKES
  • Using mkdir creates a directory, not a file
  • Running python on a file doesn't create it
  • Removing a file deletes it instead of creating

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes