KnowledgeBoat Logo

Class - 12 CBSE Computer Science — Assertion Reason Type Questions

Assertion (A): The close() method is used to close the file.

Reasoning (R): While closing a file, the system frees up all the resources like CPU processor time and memory allocated 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

1 Like

Answer

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

Explanation
The close() method in Python is used to flush any unwritten information, and close the file object, preventing further writing. While closing a file, the system frees up resources such as CPU processor time and memory that were allocated to the file.

Answered By

3 Likes