Computer Science - Class 12
Solutions to CBSE Sample Paper - Computer Science Class 12

The correct syntax of seek() is:

(a) file_object.seek(offset [, reference_point])

(b) seek(offset [, reference_point])

(c) seek(offset, file_object)

(d) seek.file_object(offset)

 

Answer:

The seek( ) method is used in python to move the file handle to the specified position. 

Syntax:

file_object.seek(offset [, reference_point])

So, the correct answer is (a).

Explanation:

In the above syntax, 

  • offset refers to the number of bytes by which the file object is to be moved. 
  • reference_point indicates the starting position of the file object. That is, with reference to which position, the offset has to be counted. It can have the following values:

0 - beginning of the file 

1 - current position of the file 

2 - end of file

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo