What will be the output of the following code ?
f=open("demo.txt","w+") f.write("Welcome to python") f.seek(5) a=f.read(5) print(a)
Welco
me to
Welcome to Python
e to
readall()
read()
readcharacter()
readchar()
softspace
mode
closed
rename
File Found Error
File Not Exist Error
File Not Found Error
None of the above
Dictionary
String
Tuple
List
_x=2
x=3
_xyz_=5
None of these
Which of the following error is returned by the given code ?
f = open("test.txt","w") f.write(345)
Syntax Error
Type Error
String Error
Run Time Error
f.readlines()
f.readline()
f.read()
f.line()
5 characters
5 words
5 lines
write mode
read mode
append mode
Both (A) And (C)
f.reads()
f.read(all)
f.read( *)
Curly Braces
Round Brackets
Indentation
Semicolon
Quick response code
Same format in which the data is held in memory
ASCII format
Unicode format
try
Brackets
Catch
what is 'f' in the following statement?
f=open("Data.txt","r")
file name
file handle
Mode of file
file handling
remove((), file_name))
remove (new_file_name, current_file_name,)
remove (file_name)
All of the above
a
f
w
t
raw_input
input
eval
accept
None of the above.
It is used for object serialization
It is used for object deserialization
All of the mentioned
None of the mentioned