Return to Topic Menu | Computer Science Main Page | MathBits.com | Terms of Use | Resource CD
 

Multiple Choice C++ Quiz
 Files

 

Directions:  Choose the best answer.  Use the button at the bottom
to check your answers.


1.  Which type of data file is analogous to an audio cassette tape?
     [a] random access file
     [b] sequential access file
     [c] binary file
     [d] source code file
 

2.  Which of the following header files is required for creating and reading data files?

     [a] ofstream.h
     [b] fstream.h
     [c] ifstream.h
     [d] console.h

3.  If you create a file with the same name as an existing file, you will be prompted to rename your new file.

     [a] True
     [b] False

4.  In the code fout.open("scores.dat", ios::out);

     [a] ios::out is the stream operation mode.
     [b] fout is the header file reference.
     [c] ios::out is the stream variable name..
     [d] fout is the name of the file.

5.  A text editor can be used to view, or create, a file.

     [a] True
     [b] False

6.  The only way to detect errors when accessing files is to use the assert.h header file and the assert function.

     [a] True
     [b] False

7.  ifstream fin; would be used when

     [a] creating a file
     [b] reading a file
     [c] appending a file
     [d] removing a file

8.  eof( ) is the function used for

     [a] asserting no errors in a file
     [b] appending data to a file
     [c] counting the amount of data in a file
     [d] checking for end of file

9.  If a file you are opening for appending does not exist, the operating system will detect the missing file and terminate the operation.

     [a] True
     [b] False

10.  It is possible to open several files for access at the same time.

     [a] True
     [b] False


 

Return to Topic Menu | Computer Science Main Page | MathBits.com  | Terms of Use | Resource CD