- Home
- Class - 12 CBSE Computer Science — Assertion Reason Type Questions
Assertion (A): The close() method is used
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.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
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.