Practice File Operations in CS Thinking
Use these practice problems to test your method after reviewing the concept explanation and worked examples.
Quick Recap
The operations of reading data from files and writing data to files on a storage device, allowing programs to persist information beyond a single run.
File operations let your program save and load information โ like writing notes in a notebook and reading them later.
Example 1
easyWrite pseudocode to write three names to a file called 'names.txt', then read them back and display them.
Example 2
mediumExplain the difference between opening a file in WRITE mode vs APPEND mode. When would you use each?
Example 3
mediumWrite pseudocode that reads a file of numbers (one per line), calculates their total, and writes the result to a new file 'total.txt'.
Example 4
hardA program reads a CSV file where each line has 'name,score' (e.g., 'Alice,85'). Write pseudocode to find the student with the highest score and output their name.