KnowledgeBoat Logo

Class - 12 CBSE Computer Science — Assertion Reason Type Questions

Assertion. Every open file maintains a file-pointer and keeps track of its position after every operation.

Reason. Every read and write operation takes place at the current position of the file pointer.

Python File Handling

3 Likes

Answer

(a)

Both Assertion and Reason are true and Reason is the correct explanation of Assertion.

Explanation

Every open file maintains a file-pointer, which keeps track of the current position within the file. This file-pointer indicates the location in the file where the next read or write operation will occur. Every read and write operation takes place at the current position of the file pointer. When we perform a read operation, data is read from the file starting at the current position of the file pointer. Similarly, when we perform a write operation, data is written to the file starting at the current position of the file pointer. After each operation, the file pointer is automatically updated to reflect the new position in the file.

Answered By

1 Like