CBSE Class 12 Computer Science Question 44 of 145

File Handling — Question 5

Back to all questions
5
Question

Question 5

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

  1. infi.read(all)
  2. infi.read()
  3. infi.readline()
  4. infi.readlines()
Answer

infi.readlines()

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