Text File Handling Set -1

Text File Handling Set -1

12th Grade

20 Qs

quiz-placeholder

Similar activities

CSV File handling in Python

CSV File handling in Python

12th Grade

25 Qs

Dig Lit Sec 4.4 - Test

Dig Lit Sec 4.4 - Test

12th Grade

22 Qs

6 - Color Photoshop Tutorial

6 - Color Photoshop Tutorial

9th - 12th Grade

18 Qs

File Methods in Python

File Methods in Python

12th Grade

20 Qs

File types

File types

12th Grade

18 Qs

Files & File Systems

Files & File Systems

9th - 12th Grade

24 Qs

Comandos y privilegios de linux

Comandos y privilegios de linux

12th Grade

18 Qs

File Writing

File Writing

9th - 12th Grade

20 Qs

Text File Handling Set -1

Text File Handling Set -1

Assessment

Quiz

Computers

12th Grade

Medium

Created by

Anjali Luthra

Used 6+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which mode is taken as default mode for opening a File in Python?

r

a

w

None

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given a text file opened as file_in, which of the following will print the entire file?

print(file_in.read())

print(file_in.readline())

print(file_in.get())

for line in file_in:

print(line)

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

Which of the following function is used to write data in text mode?

write

output

dump

send

5.

MULTIPLE CHOICE QUESTION

1 min • 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

6.

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)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Choose the correct statement to close a file stream named myfile:

myfile.terminate()

myfile.end()

myfile.close()

myfile.remove()

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?