
Python File Handling Quiz
Authored by surag patel
Computers
9th - 12th Grade
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
89 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which function is used to open a file in Python?
file.open()
open()
open.file()
file()
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the default mode in the open() function?
'a'
'r'
'w'
'x'
3.
FILL IN THE BLANKS QUESTION
30 sec • 1 pt
f = open("data.txt", " (a) ") will open the file for reading.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which mode is used to write data into a file, overwriting existing content?
'a'
'r'
'w'
'rw'
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will happen if you open a non-existent file in 'r' mode?
It will create a new file
It will overwrite the file
It will raise an error
It will open a blank file
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following line do? f = open("log.txt", "a")
Opens file for reading
Opens file for appending
Deletes file content
Creates new file and writes
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following modes will create a new file only if it does not exist?
'r'
'x'
'a'
'w'
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?