Python files and exceptions

Python files and exceptions

11th Grade

17 Qs

quiz-placeholder

Similar activities

Reading & writing to a text file (Python)

Reading & writing to a text file (Python)

9th - 12th Grade

14 Qs

Computer Applications

Computer Applications

9th - 12th Grade

20 Qs

T-Level DPDD: File Handling Quiz

T-Level DPDD: File Handling Quiz

11th Grade

14 Qs

File Formats

File Formats

9th - 12th Grade

15 Qs

Exploring Systems and Software

Exploring Systems and Software

10th - 11th Grade

15 Qs

Getting Started with MS Office

Getting Started with MS Office

7th - 12th Grade

19 Qs

Text Files in Python

Text Files in Python

10th - 11th Grade

14 Qs

file

file

8th - 12th Grade

20 Qs

Python files and exceptions

Python files and exceptions

Assessment

Quiz

Computers

11th Grade

Medium

Created by

turgut kalfaoglu

Used 4+ times

FREE Resource

17 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output-

f=open('abc.txt','a')

text="xyz"

f.write(text)

f.close()

Writing into the file without erasing old content

Writing into the file by erasing old content

reading from the file without erasing old content

reading from the file by erasing old content

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Mode in the following program to open file for writing in a mode where new data will be added at the end of old data

file =open("poem.txt","__")

r

w

a

r+

3.

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()

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which function read single line at a time?

read()

read(n)

readline()

readlines()

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Where files are store permanently?

RAM

Hard Disk

Cache memory

None of these

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Appending to a file means adding extra data into the file.
True
False

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Q.2 Which of the following statements are not true regarding the opening modes of a file?

When you open a file for reading, if the file does not exist, an error occurs.

When you open a file for writing, if the file does not exist, an error occurs

When you open a file for writing, if the file does not exist, a new file is created.

When you open a file for writing, if the file exists, the existing file is overwritten with the new file.

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?