Bird
0
0

What is the default mode when you open a file using open('file.txt') in Python?

easy📝 Conceptual Q1 of 15
Python - File Handling Fundamentals
What is the default mode when you open a file using open('file.txt') in Python?
ARead mode ('r')
BWrite mode ('w')
CAppend mode ('a')
DBinary mode ('b')
Step-by-Step Solution
Solution:
  1. Step 1: Understand the default behavior of open()

    When no mode is specified, Python opens the file in read mode by default.
  2. Step 2: Recall the modes available

    Read mode ('r') allows reading the file content without modifying it.
  3. Final Answer:

    Read mode ('r') -> Option A
  4. Quick Check:

    Default open mode = 'r' [OK]
Quick Trick: open() defaults to read mode if no mode is given [OK]
Common Mistakes:
  • Assuming write mode is default
  • Confusing append with read
  • Forgetting to specify mode

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes