CBSE Class 12 Computer Science Question 9 of 145

File Handling — Question 2

Back to all questions
2
Question

Question 2

What would be the data type of variable data in following statements ?

  1. data = f.read()
  2. data = f.read(10)
  3. data = f.readline()
  4. data = f.readlines()
Answer
  1. data = f.read() — Variable data will be string data type.
  2. data = f.read(10) — Variable data will be string data type.
  3. data = f.readline() — Variable data will be string data type.
  4. data = f.readlines() — Variable data will be list data type.