Computer Science
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.
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
Related Questions
Assertion (A): The binary files are an advanced version of text files and work similar to text files.
Reasoning (R): The data in binary files are stored in the form of binary digits, 0 and 1; and is directly understood by the computer.
- 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.
Assertion (A): To work with binary files, we need to import pickle module.
Reasoning (R): Pickle module contains two important methods for reading and writing data to binary files, i.e., load() and dump() respectively.
- 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.
Assertion (A): The readline() method reads one complete line from a text file.
Reasoning (R): The readline() function can also be used to read a specified number (n) of bytes of data from a file but maximum up to the newline character (\n).
- 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.
Assertion (A): CSV stands for Comma Separated Values.
Reasoning (R): CSV files are common file format for transferring and storing data.
- 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.