कौन सा कथन फ़ाइल पॉइंटर को वर्तमान स्थिति से 10 बाइट्स पीछे ले जाएगा?
Which statement will move file pointer 10 bytes backward from current position ?
A
f.seek(-10,0)
B
f.seek(-10,1)
C
f.seek(10,0)
D
None of the above
Explanation
To move the file pointer 10 bytes backward from its current position, we need to use the seek() method in the following way:
f.seek(offset, whence):offset: The number of bytes to move the file pointer.whence: The reference point for theoffset.0: Start of the file (absolute positioning).1: Current position (relative to the current position).2: End of the file (relative to the end of the file).
To move the pointer backwards by 10 bytes, we use:
offset = -10(to move backward)whence = 1(relative to the current position)
Correct statement:
(B) f.seek(-10,1)
This will move the file pointer 10 bytes backward from its current position.
Answer:
(B) f.seek(-10,1)
Correct Answer: B) f.seek(-10,1)