Python’s File I/O lets you read, write, and manipulate files easily using built-in functions like open(), read(), write(), and close(). This quiz helps you understand Python’s file handling operations for real-world scripting and automation.
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Which mode is used to write a file and erase its contents if it already exists?
Correct
Incorrect
Question 5 of 15
5. Question
What does f.close() do?
Correct
Incorrect
Question 6 of 15
6. Question
Which mode opens a file for appending data?
Correct
Incorrect
Question 7 of 15
7. Question
What is the purpose of the with statement in file I/O?
Correct
Incorrect
Question 8 of 15
8. Question
How can you read a file line by line?
Correct
Incorrect
Question 9 of 15
9. Question
Which method reads a single line from a file?
Correct
Incorrect
Question 10 of 15
10. Question
What does readlines() return?
Correct
Incorrect
Question 11 of 15
11. Question
Which of these is a valid way to write text to a file?
Correct
Incorrect
Question 12 of 15
12. Question
What happens if you try to read a file opened in ‘w’ mode?
Correct
Incorrect
Question 13 of 15
13. Question
How do you read a binary file in Python?
Correct
Incorrect
Question 14 of 15
14. Question
What does f.tell() return?
Correct
Incorrect
Question 15 of 15
15. Question
Which method moves the file pointer to a specific location?
Correct
Incorrect
Summary
This Python File I/O quiz tests your knowledge of opening, reading, writing, and managing files using Python’s built-in file handling methods. Learn essential I/O operations required for automation, scripting, and real-world projects.
At QuizOrbit, our team specializes in fun, informative quizzes across topics like general knowledge, technology, and entertainment. Boost your knowledge with our expert-designed quizzes.