CBSE Class 12 Computer Science Question 49 of 136

Data File Handling — Question 14

Back to all questions
14
Question

Question 14

Which of the following is the correct syntax of file object 'fobj' to write sequence data type using writelines() function?

  1. file.writelines(sequence)
  2. fobj.writelines()
  3. fobj.writelines(sequence)
  4. fobj.writeline()
Answer

fobj.writelines(sequence)

Reason — The syntax for a file object to write sequence data using the writelines() function is fileobject.writelines(sequence). Therefore, fobj.writelines(sequence) is correct.