wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

Which is not a text file?

a)

data.txt

b)

data.csv

c)

data.rft

d)

data.mp3

2.

Which file is not binary file?

a)

student.mp4

b)

student.jpeg

c)

student.csv

d)

student.exe

3.

Which function read single line at a time?

a)

read()

b)

read(n)

c)

readline()

d)

readlines()

4.

Which memory is volatile memory?

a)

RAM

b)

Hard Disk

c)

CD

d)

Pen drive

5.
How many students ride their bicycle to school?
a)
40
b)
35
c)
30
d)
20
6.

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

7.

Which function is used to read records from a binary file?

a)

pickle.load(f)

b)

pickle.read()

c)

pickle.open()

d)

pickle.dump(l,f)

8.

Which statement(s) is/are true to open a binary file "Record.dat" for reading and writing.

a)

file =open("Record.dat","wb")

b)

file =open("Record.dat","rb")

c)

file =open("Record.dat","ab")

d)

file =open("Record.dat","rb+")

9.

To read all the file contents in form of a list , (a)   method is used.

10.

What will be the output-

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

text="xyz"

f.write(text)

f.close()

a)

Writing into the file without erasing old content

b)

Writing into the file by erasing old content

c)

reading from the file without erasing old content

d)

reading from the file by erasing old content