csv.reader(file)
csv.read(file)
csv.readcsv(file)
csv.readcsvdata(file)
End of File
End of Line
End of Statement
End of program
Comma Space Value
Comma Separated Value
Common spaced Value
Compact Structure View
ab
rw
r+
w+
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
close_file()
file_close()
close()
end_file()
end
beginning
anywhere in between the file
None of the above
raw_input
input
eval
accept
readlines()
read()
Both of the above
What happens if the file does not exist?
f = open("abc.txt", "r")
New file is created
FileNotFoundError
Returns None
Opens empty file
End of List
End of Loop
End of Language
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
os.rename(existing_name, new_name)
fq.name = ‘new_name.txt’
os.rename(fp, new_name)
os.set_name(existing_name, new_name)
It is used for object serialization
It is used for object de-serialization
change the string value to number
extract the list element in simple variable
Curly Braces
Round Brackets
Indentation
Semicolon
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.reads()
f.read()
f.read(all)
f.read( *)
a
x
file_exists()
exists_file()
os.path.exists()
check_file()
seek()
tell()
f.readlines()
f.readline()
f.line()
File Found Error
File Not Exist Error
File Not Found Error
ar+
w
readline()
load()
What is the output?
f = open("test.txt", "w")f.write("Python")print(f.tell())f.close()
5
6
7
0
Write
Read
Append
Read and Write Both
File size
Current file pointer position
Number of lines
Number of characters remaining
softspace
mode
closed
rename
file()
open()
fopen()
_x=2
x=3
_xyz_=5
None of these
f
t
r
rb
What is the output of following?
f = open("data.txt", "r")print(f.readline())
One line from the file
Entire file
List of lines
Error
rt
What will be written to the file?
f = open("test.txt", "w")f.write("ABC")f.write("DEF")f.close()
ABC
DEF
ABCDEF
Use multiple write() statements.
Use writelines() method.
Use writeLine() method.
Use append() method.
try
Brackets
Catch
readall()
readcharacter()
readchar()
Quick response code
Same format in which the data is held in memory
ASCII format
Unicode format
Dictionary
String
Tuple
List
writelines()
write()
append()
giga bytes
mega bytes
byte
bits
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
5 characters
5 words
5 lines
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 = open("test.txt", "r")f.seek(0)print(f.tell())
1
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
what is 'f' in the following statement?
f=open("Data.txt","r")
file name
file handle
Mode of file
file handling