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...
Security reviews are primarily an ____ function.
A. audit B. oversight C. implementation D. intrinsic
Which of the following is a common standard used today and relies on a 256-bit block size?
A. AES B. DES C. Triple DES D. RC4
In the following code for the __init__ method for the linked binary search tree, what is the missing code?
def __init__(self, sourceCollection = None):
A. self.root = sourceCollection B. self.root = None C. sourceCollection.__init__(AbstractCollection) D. self.leaf = root
A class is an instance of an object.
Answer the following statement true (T) or false (F)