Exam2_Review_Key.2

Exam2_Review_Key.2 - e. ofstream ost.open(input.txt); 11....

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CPSC 121 Exam 2 Review Key d. Ensure that there is an appropriate number of objects in the class e. (b) and (c) are both true. 8. Consider the definition: enum day { mon, tue, wed = 5, thur, fri, sat, sun }; What is the value of sun? a. 0 b. 1 c. 6 d. 7 e. 9 9. Suppose you are trying to read data from a file, but the disk the file has been stored on has been damaged and cannot be read. You can expect the error you get to be the state a. good() b. eof() c. bad() d. fail() e. of Texas 10. To create an input stream to read from file input.txt, one could use a. ifstream ist(“input.txt”); b. ifstream ist.get(“input.txt”); c. ifstream ist.file(“input.txt”); d. ifstream ist.read(“input.txt”);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: e. ofstream ost.open(input.txt); 11. An ostream a. Turns values of various types into character sequences b. Turns character sequences into values of various types c. Unlike an istream, an ostream does not use buffers, since it is bringing bytes directly into the computer there is no reason to waste the time of storing them into a buffer first. d. Sends characters somewhere, such as a console, a file, the main memory, or another computer. e. Both (a) and (d) are true 12. What is printed by cout << 123456 << \n << setw(4) << 123456; a. 123456 1234 b. 123456 3456 c. 123456 <Too Big> d. 123456 setw( ) will adjust the spacing for output smaller than the specified width 123456...
View Full Document

This note was uploaded on 02/18/2012 for the course CSCE 121 taught by Professor Walter daugherity during the Fall '09 term at Texas A&M.

Ask a homework question - tutors are online