CBSE Class 12 Computer Science
Question 5 of 136
Data File Handling — Question 5
Back to all questions 5
Question 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.
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.