What happens if the file does not exist?
f = open("abc.txt", "r")
New file is created
FileNotFoundError
Returns None
Opens empty file
Read mode
Write mode
Append mode
Binary mode
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
open_file()
file_open()
open()
read_file()
reference_point indicates the current position of the file object
reference_point indicates the starting position of the file object
reference_point indicates the ending position of the file object
None of the above
File size
Current file pointer position
Number of lines
Number of characters remaining
softspace
mode
closed
rename
f = open("data.txt", "a")
f = Open("data.txt", "ab")
f= new("data.txt", "a")
open("data.txt", "a")
End Of Folder
Exit Open File
End Of File
Error On File
f.seek(-10, 0)
f.seek(10,0)
f.seek(-10, 1)
r
w
+
b
End of File
End of Line
End of Statement
End of program
rb
rt
What will be the output?
f = open("test.txt", "w")f.write("Python")f.seek(0)print(f.read())
Python
Empty String
UnsupportedOperation Error
None
r+
a
f
t
giga bytes
mega bytes
byte
bits
raw_input
input
eval
accept
It is used for object serialization
It is used for object deserialization
All of the mentioned
None of the mentioned
What will be written to the file?
f = open("test.txt", "w")f.write("ABC")f.write("DEF")f.close()
ABC
DEF
ABCDEF
Error
try
Brackets
Indentation
Catch
end
beginning
anywhere in between the file
read()
readline()
readlines()
load()
sets the file's current position at the offset
sets the file's previous position at the offset
sets the file's current position within the file
None of these
write mode
read mode
append mode
Both (A) And (C)
End of List
End of Loop
End of Language
remove((), file_name))
remove (new_file_name, current_file_name,)
remove (file_name)
All of the above
Write
Read
Append
Read and Write Both
seek()
close()
tell()
Comma Space Value
Comma Separated Value
Common spaced Value
Compact Structure View
It is used for object de-serialization
change the string value to number
extract the list element in simple variable
What will be the output of the following code?
f=open("demo.txt","r")print(f.tell())
1
2
-1
0
Dictionary
String
Tuple
List
_x=2
x=3
_xyz_=5
write()
append()
add()
insert()
ar+
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()
readcharacter()
readchar()
Quick response code
Same format in which the data is held in memory
ASCII format
Unicode format
f.reads()
f.read()
f.read(all)
f.read( *)
f.read(5)
f.read()=5
f.readline(5)
f.readlines(5)
What is the output?
f = open("test.txt", "w")f.write("Python")print(f.tell())f.close()
5
6
7
f = open('data.txt'); f.read()
f = open('data.txt','r'); f.read(n)
myfile = open('data.txt'); f.readline()
f= open('data.txt'); f.readlines()
None of the above.
close_file()
file_close()
end_file()
ab
rw
w+
file_object=open(file_name,mode)
open(file_object,file_name,mode)
file_open(file_object,file_name,mode)
file_object=file_open(file_name,mode)
file_exists()
exists_file()
os.path.exists()
check_file()
csv.reader(file)
csv.read(file)
csv.readcsv(file)
csv.readcsvdata(file)