Test Index

File Handling in Python Get it on Google PlayDownload on the App Store CBSE Board Videos

© examsnet.com
Question : 28 of 37
Marks: +1, -0
The syntax of seek( ) is :
file_object.seek(offset[,reference_point])
What is the default value of reference_point ?
[CBSE 2023 Set 4]
Solution:  
Concept:
seek(offset, reference_point) moves the file pointer by offset bytes from the reference point:
0 = beginning of the file, 1 = current position, 2 = end of the file.
Explanation:
If the reference point is not given, Python takes it as 0, so f.seek(10) moves the pointer to the 10th byte from the beginning. The value 3 is not a valid reference point.
Answer:
Option A (0)
© examsnet.com
Advertisements
Go to Question: