Check sibling questions
Computer Science - Class 12
Chapter 2 - File Handling in Python

To read the entire remaining contents of the file as a string from a file object infile, we use ____________

 

Answer:

Checking the options:

  • (a) infile.read(2) - reads 2 characters.
  • (b) infile.read() - reads the entire remaining contents of the file as a string.
  • (c) infile.readline() - reads a line of input, and returns it in the form of a string. 
  • (d) infile.readlines() - It reads all lines and returns them in a list. 

So, the correct answer is (b).

Introducing your new favourite teacher - Teachoo Black, at only ₹83 per month

CA Maninder Singh's photo - Expert in Practical Accounts, Taxation and Efiling

Made by

CA Maninder Singh

CA Maninder Singh is a Chartered Accountant for the past 12 years. He also provides Accounts Tax GST Training in Delhi, Kerala and online.