Bird
0
0

Why does opening a file in append mode ('a') not allow reading from the file in Python?

hard📝 Conceptual Q10 of 15
Python - File Handling Fundamentals
Why does opening a file in append mode ('a') not allow reading from the file in Python?
ABecause 'a' mode is write-only and does not support reading operations.
BBecause the file is locked exclusively for writing.
CBecause the file pointer is at the start of the file.
DBecause Python does not support reading and writing simultaneously.
Step-by-Step Solution
Solution:
  1. Step 1: Understand file modes in Python

    Mode 'a' opens the file for writing only, specifically for appending.
  2. Step 2: Reading is not allowed in 'a' mode

    Since 'a' is write-only, any read operation causes an error.
  3. Final Answer:

    Because 'a' mode is write-only and does not support reading operations. -> Option A
  4. Quick Check:

    'a' mode = write-only, no read [OK]
Quick Trick: Append mode is write-only, no reading allowed [OK]
Common Mistakes:
  • Thinking 'a' allows reading
  • Confusing file pointer position
  • Assuming Python disallows read/write together

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes