Text File Handling Set -1

Text File Handling Set -1

12th Grade

20 Qs

quiz-placeholder

Similar activities

PYTHON TEXT FILES

PYTHON TEXT FILES

12th Grade

20 Qs

Python Text Files

Python Text Files

12th Grade

20 Qs

Python Files

Python Files

12th Grade

20 Qs

File Handling - Grade XII

File Handling - Grade XII

12th Grade

15 Qs

Exploring File Operations in Python

Exploring File Operations in Python

12th Grade

20 Qs

PHP

PHP

12th Grade

20 Qs

File handling in Python

File handling in Python

12th Grade

20 Qs

U01 - Command Line & Binary/Decimal Test

U01 - Command Line & Binary/Decimal Test

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?

Discover more resources for Computers