
Understanding Files in Python
Quiz
•
Mathematics
•
University
•
Practice Problem
•
Medium
Van Khanh
Used 1+ times
FREE Resource
Enhance your content in a minute
102 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you open a file for reading in Python?
open('file.txt', 'r')
open('file.txt', 'write')
open('file.txt', 'append')
open('file.txt', 'create')
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which mode is used to open a file for writing, overwriting the file if it already exists?
'r'
'a'
'w'
'x'
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you close a file after opening it?
file.close()
file.end()
file.stop()
file.quit()
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What method is used to read the entire contents of a file?
file.read()
file.readall()
file.get()
file.readfile()
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method reads a single line from a file?
file.readline()
file.getline()
file.readline()
file.nextline()
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you write data to a file?
file.write(data)
file.append(data)
file.insert(data)
file.add(data)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which mode is used to open a file for appending data to the end?
'r'
'w'
'a'
'x'
Create a free account and access millions of resources
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?
Similar Resources on Wayground
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
15 questions
4:3 Model Multiplication of Decimals by Whole Numbers
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
The Best Christmas Pageant Ever Chapters 1 & 2
Quiz
•
4th Grade
12 questions
Unit 4 Review Day
Quiz
•
3rd Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
Discover more resources for Mathematics
20 questions
Slopes and Slope-Intercept Form
Quiz
•
8th Grade - University
10 questions
Function or Relation?
Quiz
•
KG - University
13 questions
Direct Variation Word Problems
Quiz
•
8th Grade - University
10 questions
PC: Unit 5 Quiz Review
Quiz
•
11th Grade - University
30 questions
Solving Systems of Equations
Quiz
•
KG - University
