Final answer:
A file must be opened before any data operations can be performed on it. Opening a file creates a connection for data access. After operations, a file should be closed.
Step-by-step explanation:
To perform any operations such as reading from or writing data to a file, the file must be opened first. Opening a file establishes a connection between the file and the program, effectively informing the system that the file is going to be accessed. Only after opening a file can the data be written to it or read from it. Once the operations on the file are complete, the file should then be closed to ensure proper release of resources and to flush any buffered output to the file.