CBSE Class 12 Computer Science
Question 40 of 136
Data File Handling — Question 5
Back to all questionsfobj.read(2)
Reason — The command fobj.read(2) is used to read two characters from a file object fobj. The read() method without arguments (fobj.read()) reads the entire content of the file, while fobj.readline() reads a single line, and fobj.readlines() reads all lines and returns them as a list.