KnowledgeBoat Logo

Class - 12 CBSE Computer Science — Assertion Reason Type Questions

Assertion (A): The file access mode used to add or append the data in the file is 'a'.

Reasoning (R): In the access mode, 'a', the text will be appended at the end of the existing file. If the file does not exist, Python will create a new file and write data to it.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

Python Data Handling

2 Likes

Answer

Both A and R are true and R is the correct explanation of A.

Explanation
The file access mode used to add or append data in the file is 'a'. In the 'a' access mode, the file pointer is at the end of the file if the file exists, and the text will be appended at the end of the existing file. If the file does not exist, Python will create a new file and write data to it.

Answered By

1 Like