Answer the following statements true (T) or false (F)
1) A program must call function close explicitly to close a file associated with an ifstream,
ofstream or fstream object.
2) If the file-position pointer points to a location in a sequential file other than the beginning
of the file, the file must be closed and reopened to read from the beginning of the file.
3) The ostream member function write can write to standard-output stream cout.
4) Data in sequential files always is updated without overwriting nearby data.
5) Searching all records in a random-access file to find a specific record is unnecessary.
1. False. The files will be closed when destructors for ifstream, ofstream or fstream
objects execute when the stream objects go out of scope or before program execution
terminates, but it’s a good programming practice to close all files explicitly with close
once they’re no longer needed.
2. False. Member functions seekp and seekg can be used to reposition the “put” or
“get” file-position pointers, respectively, to the beginning of the file.
3. True.
4. False. In most cases, sequential file records are not of uniform length. Therefore, it’s
possible that updating a record will cause other data to be overwritten.
5. True.
You might also like to view...
If you want every one of the comparison criteria that you specify to be true, you would use the:
A) Or operator. B) And operator. C) Comparison operator. D) Equals operator.
The ________ view of Word Online shows the document as it will appear in the full application or in print form
A) Reading B) Preview C) Layout D) Editing