1. Which operator is used for input stream?
a) >
b) >>
c) <
d) <<
2. Where does a cin stops it extraction of data?
a) By seeing a blankspace
b) By seeing (
c) Both a & b
d) None of the mentioned
3. Which is used to get the input during runtime?
a) cout
b) cin
c) coi
d) None of the mentioned
4. What is the output of this program?
a) 73
b) your value + 4
c) Error
d) None of the mentioned
5. What is the output of this program?
a) 50
b) Depends on value you enter
c) Error
d) None of the mentioned
6. What is the output of this program?
a) First input
b) Clearing cin
c) Error
d) None of the mentioned
7. What is the output of this program?
a) 100
b) t
c) It will print what we give.
d) None of the mentioned
8. How many parameters are there in getline function?
a) 1
b) 2
c) 3
d) 4
9. What can be used to input a string with blankspace?
a) inline
b) getline
c) putline
d) None of the mentioned
10. When will the cin can start proceessing of input?
a) After pressing return key
b) BY pressing blankspace
c) Both a & b
d) None of the mentioned
a) >
b) >>
c) <
d) <<
2. Where does a cin stops it extraction of data?
a) By seeing a blankspace
b) By seeing (
c) Both a & b
d) None of the mentioned
3. Which is used to get the input during runtime?
a) cout
b) cin
c) coi
d) None of the mentioned
4. What is the output of this program?
#include <iostream>
using namespace std;
int main ()
{
int i;
cout << "Please enter an integer value: ";
cin >> i + 4;
return 0;
}
b) your value + 4
c) Error
d) None of the mentioned
5. What is the output of this program?
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main ()
{
string mystr;
float price = 0;
int quantity = 0;
cout << "Enter price: ";
getline (cin, mystr);
stringstream(mystr) >> price;
cout << "Enter quantity: ";
getline (cin, mystr);
stringstream(mystr) >> quantity;
cout << "Total price: " << price * quantity << endl;
return 0;
}
b) Depends on value you enter
c) Error
d) None of the mentioned
6. What is the output of this program?
#include <iostream>
#include <ios>
#include <istream>
#include <limits>
using namespace std;
template <typename CharT>
void ignore_line ( basic_istream<CharT>& in )
{
in.ignore ( numeric_limits<streamsize> :: max(), in.widen ( '\n' ) );
}
int main()
{
cout << "First input: ";
cin.get();
cout << "Clearing cin.\n";
cin.clear();
ignore_line ( cin );
cout << "All done.\n";
}
b) Clearing cin
c) Error
d) None of the mentioned
7. What is the output of this program?
#include <iostream>
using namespace std;
int main( )
{
char line[100];
cin.getline( line, 100, 't' );
cout << line;
return 0;
}
b) t
c) It will print what we give.
d) None of the mentioned
8. How many parameters are there in getline function?
a) 1
b) 2
c) 3
d) 4
9. What can be used to input a string with blankspace?
a) inline
b) getline
c) putline
d) None of the mentioned
10. When will the cin can start proceessing of input?
a) After pressing return key
b) BY pressing blankspace
c) Both a & b
d) None of the mentioned