CS201 Quiz Introduction to Programming C++
The stream-insertion operator is >> and the stream-extraction operator is <<.
Select correct option:
True
False
Question # 2
In statement Matrix m2 = m1 ;
Select correct option:
Assignment operator is being used
Copy constructor is being used.
Statement has syntax error
None of the given options
Below is given a code snippet char name[50]; cin>>name; cout<
Select correct option:
Sohail Aslam
Aslam Sohail
Sohail
Aslam
Question # 4
What will be the output of following statement? cout << setfill(‘0’) << setw(7) << 128 ;
Select correct option:
0128128
0000128
1280000
0012800
Question # 5
When we used eof (end of file) with the file reading than which of the following is a true statement?
Select correct option:
This is way to check source of the stream
This is way to check destination of the stream
This is way to check state of the stream
This is way to check type of the stream
Question # 6
The ws manipulator can be used with ______ stream(s).
Select correct option:
Output
Input
Input/Output
None of the given options
Which of the following is true about streams? A. It is a sequence of bytes B. It is an ordered sequence C. All bytes can go through the stream simultaneously D. Bytes that enters first into the stream will go out at last
Select correct option:
A only
C Only
A and B
A and D
The statement cin.get (); is used to,
Select correct option:
Read a string from keyboard
Read a character from the keyboard
Read a character from file
Read a String from file
The return type of the operator function for << operator is __________.
Select correct option:
class for which we overload operator
reference of ostream class (ostream&)
reference of istream class (istream&)
void
Question # 11
The operator function for << (stream insertion) >> and stream extraction must be
Select correct option:
Member function of class
Non-member function of class
Both member and non-member function
None of the given options
Question # 12
What functionality the following program is performing ? #include int main(0 { const int SIZE = 80; char buffer[SIZE]; cout <<” Enter a sentence : “<
Select correct option:
get member function of cin object is used to read a sentence from the key board and then print it on the screen.
getline member function of cout object is used to read a sentence from the key board and then print it on the screen.
getline member function of cin object is used to read a sentence from the key board and then print it on the screen.
getline member function of cin object is used to read a word from the key board and then print it on the screen.
Question # 13
The read and write member functions input or output some number of bytes to or from a character array in memory.
Select correct option:
True
False
Question # 14
The endl and flush are _______
Select correct option:
Functions
Operators
Manipulators
Objects
Question # 15
Which of the following is a destination of cout stream?
Select correct option:
Data type
Printer
Constant
Variable