
Intermediate Python_L2CL_Lesson 2 Quiz
Authored by Learn2Code Live
Mathematics, Computers
6th - 8th Grade
Used 7+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
8 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these lines of code would open a file such that we can write additional data to an existing file?
open(‘Newfile.txt’,’w’)
open(‘Newfile.txt’,’a’)
open(‘Newfile.txt’,’r’)
open(‘Newfile.txt’,’W’)
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which module is needed to use the function rename?
fh
sys
os
text
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these lines contains an error?
Line 1
Line 1 and 2
Line 1 and 3
Line 2 and 3
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Predict the output for these lines of code.
# text in Somefile
Words repeated are words wasted.
Words repeated are words wasted.
Words repeated are words wasted. Words repeated are words wasted.
Words
Words repeated are words
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Predict the output for these lines of code.
# text in Somefile
You have been assigned this mountain
to show others that it can be moved.
You have been assigned this mountain
You have been
You have bee
You have bee
to show othe
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How does readline() recognize the end of a text file?
When it encounters a newline character
When it encounters an empty string
When it encounters a number
When it encounters the text, ‘EOF’
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these options will allow us to delete the fourth line in the file, ‘Example.txt’?
I
II
I and II
Neither I nor II
Access all questions and much more by creating a free account
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?