read()
readline()
readlines()
load()
_x=2
x=3
_xyz_=5
None of these
What happens if the file does not exist?
f = open("abc.txt", "r")
New file is created
FileNotFoundError
Returns None
Opens empty file
readlist()
readall()
What will be written to the file?
f = open("test.txt", "w")f.write("ABC")f.write("DEF")f.close()
ABC
DEF
ABCDEF
Error
What is the output?
f = open("test.txt", "w")f.write("Python")print(f.tell())f.close()
5
6
7
0
w
rb
rt
r
Curly Braces
Round Brackets
Indentation
Semicolon
write()
append()
add()
insert()
Write
Read
Append
Read and Write Both
seek()
close()
tell()
write mode
read mode
append mode
Both (A) And (C)
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
open_file()
file_open()
open()
read_file()
closed
softspace
rename
None of the above.
End of File
End of Line
End of Statement
End of program
ab
rw
a+
r+
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
File size
Current file pointer position
Number of lines
Number of characters remaining
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
Both of the above
try
Brackets
Catch
close_file()
file_close()
end_file()
w+
random
sys
math
os
End of List
End of Loop
End of Language
file_exists()
exists_file()
os.path.exists()
check_file()
Dictionary
String
Tuple
List
f = open("data.txt", "a")
f = Open("data.txt", "ab")
f= new("data.txt", "a")
open("data.txt", "a")
File Found Error
File Not Exist Error
File Not Found Error
a
ar+
giga bytes
mega bytes
byte
bits
mode
raw_input
input
eval
accept
Use multiple write() statements.
Use writelines() method.
Use writeLine() method.
Use append() method.
remove((), file_name))
remove (new_file_name, current_file_name,)
remove (file_name)
All of the above
f
t
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 = 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()
f.read(5)
f.read()=5
f.readline(5)
f.readlines(5)
os.rename(existing_name, new_name)
fq.name = ‘new_name.txt’
os.rename(fp, new_name)
os.set_name(existing_name, new_name)
Read two words from file
Read two line from file
Read two character / two bytes
count the number of '2' in file
raise
goto
except
readcharacter()
readchar()
f.readlines()
f.readline()
f.read()
f.line()
Quick response code
Same format in which the data is held in memory
ASCII format
Unicode format
Data is appended
Error occurs
Old content is erased
Nothing happens
end
beginning
anywhere in between the file