KnowledgeBoat Logo

Class - 12 CBSE Computer Science — Assertion Reason Type Questions

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).

  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 readline() method in Python reads one complete line from a text file and can also be used to read a specified number (n) of bytes of data from a file up to the newline character (\n).

Answered By

2 Likes