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?

  1. A.

    Read mode ('r')

  2. B.

    Write mode ('w')

  3. C.

    Append mode ('a')

  4. 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').

Explore the full course: Rssb Senior Computer Instructor