10.3 Files (3)

Resources | Revision Questions | Computer Science

Login to see all questions

Click on a question to view the answer

1.

Explain, with examples, why files are a fundamental concept in computer science and essential for storing and managing data within computer systems. Your answer should discuss the advantages of using files over other methods of data storage.

2.

Describe, using pseudo-code, how you would handle a text file that contains student names and their corresponding marks, separated by a comma. The format of each line in the file is "Name,Mark". Your pseudo-code should include steps to read each line, split the line into name and mark, and store the data in a suitable data structure. Also, outline how you would calculate the average mark for all students.

3.

Write pseudo-code to outline an algorithm that reads a text file line by line, stores each line in a list, and then prints the lines in reverse order. Your pseudo-code should clearly indicate how the file is opened, read, and closed.