CBSE Class 12 Computer Science Question 41 of 136

Data File Handling — Question 6

Back to all questions
6
Question

Question 6

To read the entire contents of the file as a string from a file object fobj, the command should be:

  1. fobj.read(2)
  2. fobj.read()
  3. fobj.readline()
  4. fobj.readlines()
Answer

fobj.read()

Reason — The command fobj.read() is used to read the entire contents of the file as a string from a file object fobj.