

InterviewSolution
Saved Bookmarks
1. |
Correct syntax of file.readlines() is?(a) fileObject.readlines( sizehint );(b) fileObject.readlines();(c) fileObject.readlines(sequence)(d) none of the mentioned |
Answer» The correct answer is (a) fileObject.readlines( sizehint ); The best I can explain: The method readlines() reads until EOF using readline() and returns a list containing the lines. If the optional sizehint argument is present, instead of reading up to EOF, whole lines totalling approximately sizehint bytes (possibly after rounding up to an internal buffer size) are read. Syntax Following is the syntax for readlines() method: fileObject.readlines( sizehint ); Parameters sizehint — This is the number of bytes to be read from the file. |
|