wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Binary File Handling Python

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

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","__")

a)

r

b)

a

c)

w

d)

x

2.

Which file execute faster?

a)

Text file

b)

Binary file

c)

CSV file

3.

Mode used for reading and writing in binary file

a)

wb

b)

w

c)

wb+

d)

w+

4.

Function used to write data in binary format

a)

write()

b)

output()

c)

load()

d)

dump()

5.

The type of operation possible in an opened file is governed by

a)

File Object

b)

File Mode

c)

File Path

d)

open() Method

6.

Module used to read and write into binary files

a)

dump

b)

load

c)

pickle

d)

open

7.

Function returns the current position of file pointer in the file

a)

tell()

b)

seek()

c)

read()

d)

flush()

8.

The default file - open mode is (a)   mode.

9.

Which of the following is not a valid attribute of a file object (fp)?

a)

fp.name

b)

fp.closed

c)

fp.size

d)

fp.mode

10.

How do you change the file position to an offset value from the start?

a)

fp.seek(offset, 0)

b)

fp.seek(offset, 1)

c)

fp.seek(offset, 2)

d)

none of the mentioned