File handling (3)

Resources | Revision Questions | Computer Science

Login to see all questions

Click on a question to view the answer

1.

Describe the different file access modes available to a program. Explain the purpose of each mode and provide an example of when each mode would be used.

2.

Explain why data is often stored in external files rather than directly in a program's memory. Consider the advantages in terms of memory usage, data persistence, and program flexibility.

3.

Consider a scenario where a program needs to read data from a text file containing a list of student names, one name per line. Write pseudocode to demonstrate how the program would open the file, read each name, and then close the file. Assume the file is named "students.txt".