Professional Documents
Culture Documents
MCQ File
MCQ File
End or File
from a file(file object ‘f’)?
a. f.read() Ans. a. End of File
b. f.read(5) Q8. Which function is used to read data from
c. f.reads(5) Text File?
d. None of the above a. read( )
b. writelines( )
Ans. b. f.read(5) c. pickle( )
Q2. Which function open file in python? d. dump( )
a. open( )
b. new( ) Ans. a. read( )
c. Open( ) Q9. Which of the following will read entire
d. None of the above content of file(file object ‘f’)?
a. f.reads( )
Ans. a. open( ) b. f.read( )
Q3. Processing of Text file is faster than c. f.read(all)
binary files.(T/F) d. f.read( * )
a. True
b. False Ans. b. f.read( )
Q10. Which symbol is used for append
Ans. b. False mode?
Q4. Which mode create new file if the file a. ap
does not exist? b. a
a. write mode c. w
b. append mode d. app
c. Both of the above
d. None of the above Ans. b. a
Ans. c. Both of the above Q11. Which of the following options can be
Q5. Which statement will return one line used to read the first line of a text file
from a file (file object is ‘f’)? data.txt?
a. f.readline( ) a. f = open(‘data.txt’); f.read()
b. f.readlines( ) b. f = open(‘data.txt’,’r’); f.read(n)
c. f.read( ) c. myfile = open(‘data.txt’); f.readline()
d. f.line( ) d. f = open(‘data.txt’); f.readlines()
Ans. b. d1