Check sibling questions

Which of the following statements are true?

 

Answer:

When you open a file for reading ,

  • If the file does not exist, an error is given.

When you open a file for writing ,

  • If the file does not exist, a new file is created.
  • If the file exists, the existing file is overwritten with the new file.

Therefore all the options are correct.

 

So, the correct answer is (d).

  1. Computer Science - Class 12
  2. Chapter 2 - File Handling in Python

About the Author

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo