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 Files

Python Files

12th Grade

20 Qs

Computer Applications

Computer Applications

9th - 12th Grade

20 Qs

File Types

File Types

12th Grade

18 Qs

Linux-2 Quiz 2 -- LAMP

Linux-2 Quiz 2 -- LAMP

1st - 12th Grade

15 Qs

CUET Level - II Computer Science(7/11/2023)

CUET Level - II Computer Science(7/11/2023)

12th Grade

15 Qs

CS - Internal Test1 [16-07-2021]

CS - Internal Test1 [16-07-2021]

12th Grade

20 Qs

SLR05.3 Open or Closed?

SLR05.3 Open or Closed?

9th Grade - University

16 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?