Skip to main contentSkip to solution

The statement fileobject.seek(10,0) will __________.

Solution

✅ Correct Option: 2

The syntax is seek(offset, whence). Here the offset is 10 and whence is 0, which means "from the beginning of the file". So the file object moves to the 10th byte from the start.


Option 1: reverses the roles of the arguments. The first argument is the offset (10), and the second is the reference point (0).

Option 4: this would need whence = 2 (end of file), not 0.

whence values: 0 = start of file, 1 = current position, 2 = end of file.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question