Files Worksheet #1 Name -
  Day of Week -

1. (True/False) A sequential access file can be opened in the append mode so that data can automatically be written to the end of the file.
2. (True/False) The identifier    infile     would be a good choice for a file pointer that points to a file that you wish to read data from.
3. (True/False) The statement       outfile << "hello world" << endl;     contains a syntax error.

4. Write a statement that declares a file pointer named infile that is to be used to obtain input from a file and that points it to a file named InputData.txt.


5. Write a statement that declares a file pointer named outfile that is to be used to write data to a file named OutputData.txt.



6. Write a statement that writes the value stored in the variable named score to the file pointed to by the file pointer named outfile.


7. Write a statement that writes the phrase "hello world" to the file pointed to by the file pointer named outfile.


8. Write a statement that closes a sequential access file pointed to by the file pointer named outfile.