CBSE Class 12 Computer Science Question 57 of 136

Data File Handling — Question 22

Back to all questions
22
Question

Question 22

Which statement is used to retrieve the current position within the file?

  1. fp.seek()
  2. fp.tell()
  3. fp.loc
  4. fp.pos
Answer

fp.tell()

Reason — The tell() method returns the current position of the file read/write pointer within the file. The correct syntax to use it is fp.tell(). Therefore, the correct statement used to retrieve the current position within the file is fp.tell().