Reading and Writing Files Questions and Answers
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
22. What does readline() return when end of file is reached?
- None
- Empty string
- False
- EOF
23. Which mode allows reading and writing at the end of file?
- "r+"
- "w+"
- "a+"
- "x+"
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
25. Which method is used to check if file pointer is at end of file?
- eof()
- check_eof()
- feof()
- No direct method