In Python, when a text file is opened using the open() function without…
2026
In Python, when a text file is opened using the open() function without explicitly specifying a mode, what is the default file access mode used?
- A.
Read mode ('r')
- B.
Write mode ('w')
- C.
Append mode ('a')
- D.
Read Write mode ('r+')
Attempted by 612 students.
Show answer & explanation
Correct answer: A
The correct answer is Option A (Read mode 'r').
In Python, when a file is opened using open() without specifying a mode, the default mode is 'r' (read mode). This means the file is opened for reading, and an error will occur if the file does not exist.
Thus, default file access mode is read mode ('r').