C ++ Module 4
C ++ Module 4
I/O Streams
1. 64. Predict the output:
float x= 3.1496;
cout<<setprecision(2) << x;
A. 3.14
B. 3.15
C. 3
D. 3.1
3. It is not possible to combine two or more file opening mode in open () method.
A. TRUE
B. FALSE
C. May Be
D. Can't Say
14. By default, all the files are opened in which of the following mode?
A. Binary Mode
B. Text Mode
C. Sequential Mode
D. Both A and B
Ans : B
Explanation: By default, all the files are opened in Text mode
15. How many objects are used for input and output to a string?
A. 1
B. 2
C. 3
D. 4
Ans : C
Explanation: The stringstream, ostringstream, and istringstream objects are used for input and
output to a string.
16. Which member function is used to determine whether the stream object is currently
associated with a file?
A. is_open
B. Buf
C. String
D. None of the above
Ans : A
Explanation: The member function is_open can be used to determine whether the stream
object is currently associated with a file.