Which of the following is the correct mode to open a text file for reading?

Computer Science Quiz - Grade XII

Quiz
•
Computers
•
12th Grade
•
Medium
Amudhavalli K
Used 2+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
rb
r
w
a
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which method is used to read the entire contents of a text file as a single string?
readline()
readlines()
read()
input()
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What does the readline() function return?
A list of lines
One line at a time as a string
The number of lines
None of the above
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which method is used to write data to a text file?
input()
print()
write()
append()
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What happens if a file is opened in 'w' mode and it already exists?
It appends to the file
It raises an error
It deletes the contents of the file
It does nothing
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How do you close a file in Python?
file.close()
file.stop()
file.end()
close(file)
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What does the 'a' mode do when opening a file?
Opens for reading
Opens for writing (overwrites)
Opens for appending
Opens for deleting
Create a free account and access millions of resources
Similar Resources on Quizizz
15 questions
File Handling in Python - Grade 12 CBSE

Quiz
•
12th Grade
10 questions
Python Pliki

Quiz
•
12th Grade
10 questions
Python Basic files

Quiz
•
10th - 12th Grade
10 questions
File handling

Quiz
•
12th Grade
10 questions
File Handling

Quiz
•
12th Grade
18 questions
File Types

Quiz
•
12th Grade
10 questions
File Type Extensions

Quiz
•
8th Grade - University
20 questions
File i/o

Quiz
•
10th Grade - University
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression

Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing

Quiz
•
9th - 12th Grade
10 questions
Identifying equations

Quiz
•
KG - University