Learning objectives

Write program code that opens a text file for reading, writing or appending, processes it line by line until the end of the file is reached, and closes it afterwards

Write and read records held in a random access file, calculate the position of a record from its key, and explain why records in such a file are given a fixed length

Explain what an exception is, describe what happens to a running program when an exception is not handled, and name the exceptions commonly raised by file and input operations

Write exception handling code that catches a named exception, reports it helpfully to the user, and either allows the program to carry on or closes it down tidily

Use exception handling to deal with invalid keyboard input, and explain why this is more robust than converting the input first and checking the value afterwards

Design, write and test a complete practical solution that reads data from a file, processes it and writes the results back to a file, using normal, boundary and erroneous test data

Continue with a revision plan

These learning objectives are available to everyone. Sign in with an eligible plan to read the full note and worked examples.