CBSE Class 12 Computer Science Question 44 of 136

Data File Handling — Question 9

Back to all questions
9
Question

Question 9

To read the remaining lines of the file from a file object fobj, we use:

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

fobj.readlines()

Reason — The syntax to read all lines in a file is <filehandle>.readlines(). Hence according to this syntax fobj.readlines() is correct format.