Python L34 Open File

Quiz
•
Computers
•
6th - 8th Grade
•
Medium
Future Teacher
Used 1+ times
FREE Resource
9 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following line do?
Reads the file and deletes it
Opens the file in write mode
Opens the file in read mode and assigns it to file
Creates a new file called data.txt
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Using with open(...) is a good practice because it automatically closes the file after use.
True
False
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What error will you get if you try to open a file that doesn’t exist in 'r' mode?
FileNotFoundError
PermissionError
IsADirectoryError
4.
FILL IN THE BLANK QUESTION
30 sec • 1 pt
To add new content to the end of an existing file without erasing it, use mode '____'.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method reads all lines from a file and stores them in a list?
.read()
.readlines()
.write()
.print()
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of this code if the file names.txt contains: Ali, Becky, Charles
1
2
3
0
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Why is 'w' mode dangerous if you open an existing file?
The 'w' mode overwrites the existing file, erasing all its content.
8.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The .read() method returns a list of lines from the file.
True
False
9.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will this code do?
Append text to hello.txt
Read the content of hello.txt
Overwrite hello.txt and write "Hi there!\n"
Do nothing unless the file already exists
Similar Resources on Wayground
9 questions
MULTIMEDIA

Quiz
•
3rd - 7th Grade
11 questions
E - Learning Fun Game

Quiz
•
1st - 6th Grade
10 questions
RO93 - File Compression

Quiz
•
6th Grade
9 questions
Expression web

Quiz
•
6th - 8th Grade
8 questions
Python Files I/O

Quiz
•
6th - 12th Grade
10 questions
Computing Essentials Lesson 3

Quiz
•
6th Grade
10 questions
Computer High Level - Quiz

Quiz
•
6th - 11th Grade
10 questions
7 сынып информатика

Quiz
•
7th Grade
Popular Resources on Wayground
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World

Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
20 questions
ELA Advisory Review

Quiz
•
7th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns

Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
25 questions
Exploring POV and Unreliable Narrators

Quiz
•
7th Grade
18 questions
Company Logos

Quiz
•
6th - 8th Grade
20 questions
Typing Practice

Quiz
•
7th - 12th Grade
14 questions
Inputs and Outputs: Computer Science Intro

Lesson
•
5th - 9th Grade
20 questions
Input, Output, Processing or Storage

Quiz
•
5th - 6th Grade