Which function returns an integer that specifies the current position of the file object in the file?
Which function returns an integer that specifies the current position of the file object in the file?
Solution
✅ Correct Option: 2
The tell() method returns an integer giving the current position of the file pointer, measured in bytes from the start of the file. For example, f.tell() returns 0 right after a file is opened in read mode.
seek(): this is the confusable one. It moves the file pointer to a given position and does not report the current position.
read(): returns the file's content (a string or bytes), not a position.
Remember: tell() "tells" where you are, and seek() "seeks" a new place to go.
Related questions:
2025: 27 May Shift 2
2025: 22 May Shift 1
2026: 11 May Shift 2