Reading and Writing Files Questions and Answers

Take Exam

Python Programming - Reading and Writing Files Questions with Answers help learners understand how to handle data in text or binary formats. These Python File Handling Questions are important for TCS, Infosys, and Bank PO exams to master file input and output operations

Reading and Writing Files

Showing 10 of 25 questions

21. Which character is used to specify a new line when writing to files?

  • /n
  • \\n
  • newline
  • nl
Show Answer Report

22. What does readline() return when end of file is reached?

  • None
  • Empty string
  • False
  • EOF
Show Answer Report

23. Which mode allows reading and writing at the end of file?

  • "r+"
  • "w+"
  • "a+"
  • "x+"
Show Answer Report

24. What is the purpose of file object's closed attribute?

  • Closes the file
  • Checks if file is closed
  • Opens the file
  • Locks the file
Show Answer Report

25. Which method is used to check if file pointer is at end of file?

  • eof()
  • check_eof()
  • feof()
  • No direct method
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test