Class 12 : File Handling Set 2

16.
In which of the following file modes existing data of a file will not be lost?

a) ab+
b) wb+
c) w+
d) wb

 

17.
Which of the following command is used to open a file “c:\pat.txt” for writing as well as reading in binary format?

a) fout=open(“c:\pat.txt”,”w”)
b) fout=open(“c:\\pat.txt”,”wb”)
c) fout=open(“c:\pat.txt”,”w+”)
d) fout=open(“c:\pat.txt”,”wb+”)

 

18.
…………. returns a writer object to write the data into a csv file.

a) writer()
b)csv.writer()
c) writer.csv()
d) csv.writerobject()

 

19.
…………. loads the data from a csv file into an iterable after parsing delimited data.

a) reader.csv()
b) csvreader()
c) csv.reader()
d) readerobject(csv)

 

20.
To open a file c:\res.txt for reading which of the statements are correct?

a) file=open(“c:\res.txt”,”r”)
b) file=open(“c:\\res.txt”,”r”)
c) file=open(“c:\res.txt”)
d) file=open(“c:\\res.txt”)