
Hinge_2.2_text_file
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Hard
George Dong
FREE Resource
Enhance your content in a minute
7 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How to read a text file in Python?
open file for read, then read the content, then close the file
open file for read, then read the content
read the file content, then close the file
open file for WRITE, then Write, then close the file
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
file = open(filename, "r")
what does "r" mean?
file is open for READING, in READING mode
file is open for WRITING, in writing mode
file is open for APPENDING, in append mode
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
file = open(filename, "a")
what does "a" mean?
file is open for READING, in READING mode
file is open for WRITING, in writing mode
file is open for APPENDING, in append mode
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which one is correct to read a file line by line?
file = open(filename, "r")
line = file.readline()
file.close()
file = open(filename, "r")
line = file.readline()
while line != "":
line = file.readline()
file.close()
file = open(filename, "r")
content = file.read()
file.close()
file = open(filename, "r")
content = file.readlines()
file.close()
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the meaning of "\n" in file.write("Diana, Jones\n") in Python?
new line symbol, to create a new line in file
letter n will be written into the file after Jones
characters \ n will be written in the file after Jones
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
file = open(filename, "w")
What is the meaning of "w"?
file object is in "w" mode - writing or write-over mode
file is open for READING mode
file is open for APPENDING mode
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which one is correct for writing "Diana Jones" and "Indiana Jones" into file "names" in 2 separate lines in Python?
file = open("names.txt", "w")
file.write("Diana Jones\n")
file.write("Indiana Jones\n")
file.close()
file = open("names.txt", "r")
file.write("Diana Jones\n")
file.write("Indiana Jones\n")
file.close()
file = open("names.txt", "w")
file.write("Diana Jones")
file.write("Indiana Jones")
file.close()
Similar Resources on Wayground
10 questions
MACAM-MACAM IKON PAINT
Quiz
•
5th - 12th Grade
11 questions
Email of request
Quiz
•
12th Grade - Professi...
10 questions
HT3 Digital Graphics
Quiz
•
KG - 12th Grade
10 questions
ICT Quiz
Quiz
•
4th - 12th Grade
10 questions
Penugasan Daring
Quiz
•
11th Grade - University
12 questions
Computer Basics
Quiz
•
6th - 12th Grade
11 questions
Computer Professionals
Quiz
•
7th - 12th Grade
10 questions
Quiz-Computer Maintenance
Quiz
•
12th Grade
Popular Resources on Wayground
10 questions
Forest Self-Management
Lesson
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
30 questions
Thanksgiving Trivia
Quiz
•
9th - 12th Grade
30 questions
Thanksgiving Trivia
Quiz
•
6th Grade
11 questions
Would You Rather - Thanksgiving
Lesson
•
KG - 12th Grade
48 questions
The Eagle Way
Quiz
•
6th Grade
10 questions
Identifying equations
Quiz
•
KG - University
10 questions
Thanksgiving
Lesson
•
5th - 7th Grade
Discover more resources for Computers
30 questions
Thanksgiving Trivia
Quiz
•
9th - 12th Grade
11 questions
Would You Rather - Thanksgiving
Lesson
•
KG - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University
18 questions
Thanksgiving Trivia
Quiz
•
4th - 12th Grade
20 questions
Thanksgiving
Quiz
•
KG - 12th Grade
28 questions
Ser vs estar
Quiz
•
9th - 12th Grade
10 questions
hands washing
Quiz
•
5th - 12th Grade
53 questions
US History Domain 1 Review CP 2025 (Tech Enhanced)
Quiz
•
9th - 12th Grade
