File Handling Quiz-14

Share with others

Welcome to your File Handling Quiz-14

Name
Email
School Name
Q131. Fill in the blank in the given code :

import pickle
f = open("data.dat", "rb")
l = pickle._______(f)
print(l)
f.close()

Q132. Write the output of the following code:

f = open("data.txt","w")
L=["My\n","name\n","is\n","amit"]
f.writelines(L)
f.close()
f = open("data.txt","r")
print(len(f.read()))

Q133. Write the output of the following code:

f = open("data.txt","w")
L=["My\n","name\n","is\n","amit"]
f.writelines(L)
f.close()
f = open("data.txt","r")
print(len(f.readlines()))

Q134. Write the output of the following code:

f = open("data.txt","w")
L=["My\n","name\n","is\n","amit"]
f.writelines(L)
f.close()
f = open("data.txt","r")
print(len(f.readline()))

Q135. Fill in the blank in the given code :

import pickle
f = open("data.dat", "wb")
L = [1, 2, 3]

pickle._______
f.close()

Q136. Which of the following statement will return attribute error?

Q137. Ravi is writing a program for counting the number of words in a text file named "data.txt". He has written the incomplete code. Help him to complete the code. Identify the suitable code for blank space in the line marked as Statement 1

f = open("_________","r") # Statement 1
d = f._________ # Statement 2
nw = d._________ # Statement 3
print("Number of words are", _________(nw)) # Statement 4

Q138. Identify the suitable code for blank space in the line marked as Statement 2(Refer Q. 137)

Q139. Identify the suitable code for blank space in the line marked as Statement 3(Refer Q. 137)

Q140. Identify the suitable code for blank space in the line marked as Statement 4(Refer Q. 137)


Share with others

Leave a Reply