Font size
Worksheetsfile handling
Total questions: 12
Worksheet time: 6mins
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+
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+
What will be the ouput -
f=open('abc.txt','w')
x=f.read()
f.close()
print(x)
Error(not readable)
Error(not writable)
It will read all the data of the file.
none
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
Which function is used to write multiple lines in text file?
write()
writelines()
lines()
print()
Which statement(s) is/are true to open a binary file "Record.dat" for reading and writing ?
file =open("Record.dat","wb")
file =open("Record.dat","rb")
file =open("Record.dat","ab")
file =open("Record.dat","rb+")
The readlines() method returns
a. str
b. a list of lines
c. a list of single characters
d. a list of integers
An absolute path name begins at the
leaf
stem
root
current directory
What will be the output of the following Python code?
True
False
None
error
See the following code snippet and fill in the blank with appropriate statement
(a)
Fill in the blank with appropriate statement.
(a)
which function is used to read records from a binary file?
pickle.load(f)
pickle.read()
pickle.open()
pickle.dump(l,f)
