State which of the following are true and which are false. If false, explain why.

1)Member function read cannot be used to read data from the input object cin.
2) You must create the cin, cout, cerr and clog objects explicitly.
3) A program must call function close explicitly to close a file associated with an if stream, ofstream or fstream object.
4) 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.
5) The ostream member function write can write to standard-output stream cout.


1) False. Function read can read from any input stream object derived from istream.
2) False. These four streams are created automatically for you. The header must be included in a file to use them. This header includes declarations for each stream object.
3) 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 is a good programming practice to close all files explicitly with close once they are no longer needed.
4) False. Member function seekp or seekg can be used to reposition the put or get file position pointer to the beginning of the file.
5) True

Computer Science & Information Technology

You might also like to view...

Before programmers decide which programming language to use or start writing code, they develop a complete description of the task the program needs to accomplish. This is called a ________

A) beta version B) programmer input C) program development life cycle (PDLC) D) problem statement

Computer Science & Information Technology

A(n) ________ is a range of cells that will be printed in a worksheet

Fill in the blank(s) with correct word

Computer Science & Information Technology

isplay base 10 positive integers in any base >10 (recursive)

What will be an ideal response?

Computer Science & Information Technology

A packet ____________________ is a software program or hardware appliance that can intercept, copy, and interpret network traffic.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology