
Python Text & Binary Files
Quiz
•
Computers
•
12th Grade
•
Hard
Anshu Sharma
Used 11+ times
FREE Resource
Enhance your content in a minute
15 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
30 sec • 1 pt
Given a text file opened as file_in, which of the following will print the entire file? (Select ALL that apply.)
print(file_in.read())
print(file_in)
lines = file_in.readlines()
for line in lines:
print(line)
lines = file_in.readlines()
for i in range(len(lines)):
print(lines)
for line in file_in:
print(line)
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to open the file file_in.txt for reading?
open('file_in.txt', 'r')
open('file_in.txt','r+')
open('file_in.txt','w')
open('file_in.txt','a')
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the best way to read an entire file into a list of strings?
.read()
.readline()
.readlines()
.read(all)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When reading text files, what are the hidden characters typically at the end of each line?
\n
#
@
»
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
If I want to add to the end of a text file, I should:
MyCipher = open("MyCipher.txt", "w")
MyCipher = open("MyCipher.txt", "a")
MyCipher = open("MyCipher.txt", "w+")
MyCipher = open("MyCipher.txt", "s")
6.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
How do you close the file?
MyFile = close()
MyFile.close
close = MyFile()
MyFile.close()
7.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Why is it best to open a file with "with" in Python?
It automatically closes the file
Easier to read the code
Better for binary files
Closers to the pseudocode
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
20 questions
BTEC IT Unit 1 D: Malware and Other Attacks
Quiz
•
11th - 12th Grade
17 questions
Network Topologies & Malware
Quiz
•
6th - 12th Grade
13 questions
Riviosn_internet threats & computer system
Quiz
•
9th - 12th Grade
12 questions
Computing Ethics
Quiz
•
KG - Professional Dev...
20 questions
System and network support and management
Quiz
•
11th Grade - Professi...
17 questions
Email Lớp 6
Quiz
•
6th Grade - University
20 questions
Ôn tập Tin học 5 HKI
Quiz
•
4th Grade - University
15 questions
SOAL ULANGAN HARIAN 1 TIK SEMESTER GENAP 2018-2019
Quiz
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
20 questions
MINERS Core Values Quiz
Quiz
•
8th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade
10 questions
How to Email your Teacher
Quiz
•
Professional Development
15 questions
Order of Operations
Quiz
•
5th Grade
