File Handling in Python
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
Anita Mercy
Used 92+ times
FREE Resource
Enhance your content in a minute
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Q1. Given the following file opened as song_file:
I can't write one song that's not about you
Can't drink without thinkin' about you
Is it too late to tell you that
Everything means nothing if I can't have you?
What is the result of
print(song_file.read(4)) ?
I ca
I can
I c
I can't write one song that's not about you
Can't drink without thinkin' about
I c
you
Is it too late to tell you that
Everything means nothing if I can't have you?
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following file opened as song_file:
I can't write one song that's not about you
Can't drink without thinkin' about you
Is it too late to tell you that
Everything means nothing if I can't have you?
What is the result of
print(text_file.readlines()[1]) ?
I can't write one song that's not about you
Can't drink without thinkin' about you
I can't write one song that's not about you
Can't drink without thinkin' about
you
Is it too late to tell you that
Everything means nothing if I can't have you?
I
3.
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','a')
open('file_in.txt','r+')
open('file_in.txt', 'r')
open('file_in.txt','w')
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the best way to read an entire file into a single string?
.read()
.readline()
.readlines()
.read(all)
5.
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)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the best way to read the first line of a file?
.read()
.readline()
.readlines()
.read(all)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When reading text files, what are the hidden characters typically at the end of each line?
\n
»
#
@
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
12 questions
website design elements
Quiz
•
12th Grade
20 questions
RE UH 1 DMI 2021
Quiz
•
12th Grade
16 questions
P0-pengenalan komponen komputer
Quiz
•
9th - 12th Grade
16 questions
Prepare For Final Exam
Quiz
•
9th - 12th Grade
16 questions
IBA Chapter 8B
Quiz
•
8th - 12th Grade
17 questions
Email Lớp 6
Quiz
•
6th Grade - University
20 questions
Soal Kelas XII TKJ (MikroTik dan Akses Point)
Quiz
•
12th Grade
15 questions
MS. Excel
Quiz
•
12th Grade - University
Popular Resources on Wayground
10 questions
Honoring the Significance of Veterans Day
Interactive video
•
6th - 10th Grade
9 questions
FOREST Community of Caring
Lesson
•
1st - 5th Grade
10 questions
Exploring Veterans Day: Facts and Celebrations for Kids
Interactive video
•
6th - 10th Grade
19 questions
Veterans Day
Quiz
•
5th Grade
14 questions
General Technology Use Quiz
Quiz
•
8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Circuits, Light Energy, and Forces
Quiz
•
5th Grade
19 questions
Thanksgiving Trivia
Quiz
•
6th Grade
