CBSE Class 12 Computer Science Question 43 of 145

File Handling — Question 4

Back to all questions
4
Question

Question 4

To read the next line 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.readline()

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