ANSWERS 100% PASS
Which operator is the insertion operator? - ✔✔<<
Which header file should be used while working with the output string stream? -
✔✔#include <sstream>
_____ is a predefined ostream object that is pre-associated with a system's standard
output, usually a computer screen. - ✔✔cout
To use an output file in a C++ program you must - ✔✔open the file
create a file stream object that will "point to" to the file
do B and C, but not A
The code for myoutfile.txt generates an error. Why? - ✔✔The file 'myoutfile.txt' has not
been opened
The ____ function returns true if the previous stream operation had an error. - ✔✔fail()
A program can insert characters into an ostringstream buffer using the ______ operator.
- ✔✔<<
Emily Charlene, All Rights Reserved © 2025 1
, Which XXX generates "Tim Smith is 19 years old." as the output? - ✔✔playerObj <<
players << " is " << age << " years old.";
Why would a file fail to open? - ✔✔The file has incorrect file permissions or the disk is
full.
Which XXX will search the input name in the GuestList.txt file? - ✔✔if (!inFS.fail())
Given an ofstream outFS, which syntax is used to check whether a file is opened
successfully? - ✔✔if (!outFS.is_open()) { ... }
To use files in a C++ program you must include the ________ header file. - ✔✔fstream
If a file exists in a directory and contains data, when an ofstream is used to write data
into the file _____. - ✔✔the file is overwritten with the new data.
Manipulators are defined in the _____ and _____ libraries in namespace std. -
✔✔iomanip; ios
The ostringstream member function ____ returns the contents of an ostringstream
buffer as a string. - ✔✔str()
True/False: Both function headers and function calls must list the data types of all data
being passed to the function. - ✔✔False
A(n) ________ argument is one that is automatically passed to a parameter when the
argument is left out of the function call. - ✔✔default
Emily Charlene, All Rights Reserved © 2025 2