Q221
Open questionSelect an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
1,008
Questions
12/51
Page
Pick an option on a question to see the right answer and solution.
Q221
Open questionSelect an option to see the answer and solution.
Q222
Open questionSelect an option to see the answer and solution.
Q223
Open questionSelect an option to see the answer and solution.
Q224
Open questionSelect an option to see the answer and solution.
Q225
Open questionSelect an option to see the answer and solution.
Q226
Open question#include <iostream>
#include <set>
using namespace std;
int main()
{
set<int> tst;
tst.insert(12);
tst.insert(21);
tst.insert(32);
tst.insert(31);
set<int> :: const_iterator pos;
for(pos = tst.begin(); pos != tst.end(); ++pos)
cout << *pos << ' ';
return 0;
}Select an option to see the answer and solution.
Q227
Open questionSelect an option to see the answer and solution.
Q228
Open question#include <iostream>
#include <algorithm>
using namespace std;
int main ()
{
int myints[] = {1, 2, 3};
sort (myints, myints + 3);
do
{
} while ( next_permutation(myints, myints + 3) );
cout << myints[0] << ' ' << myints[1] << ' ' << myints[2] << '\n';
return 0;
}Select an option to see the answer and solution.
Q229
Open questionSelect an option to see the answer and solution.
Q230
Open question#include <iostream>
#include<type_traits>
using namespace std;
class Base
{
public:
};
int main()
{
Base b;
cout<<sizeof(b);
return 0;
}Select an option to see the answer and solution.
Q231
Open questionSelect an option to see the answer and solution.
Q232
Open question#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;
}Select an option to see the answer and solution.
Q233
Open questionSelect an option to see the answer and solution.
Q234
Open questionSelect an option to see the answer and solution.
Q235
Open questionSelect an option to see the answer and solution.
Q236
Open questionSelect an option to see the answer and solution.
Q237
Open question#include <iostream>
using namespace std;
int main()
{
try
{
try
{
throw 20;
}
catch (int n)
{
cout << "Inner Catch\n";
}
}
catch (int x)
{
cout << "Outer Catch\n";
}
return 0;
}Select an option to see the answer and solution.
Q238
Open question#include <iostream>
#include <vector>
using namespace std;
int main ()
{
vector<int> a (3, 0);
vector<int> b (5, 0);
b = a;
a = vector<int>();
cout << "Size of a " << int(a.size()) << '\n';
cout << "Size of b " << int(b.size()) << '\n';
return 0;
}Select an option to see the answer and solution.
Q239
Open question#include <iostream>
using namespace std;
template <typename T>
void fun(const T&x)
{
static int count = 0;
cout << "x = " << x << " count = " << count;
++count;
return;
}
int main()
{
fun<int> (1);
cout << endl;
fun<int>(1);
cout << endl;
fun<double>(1.1);
cout << endl;
return 0;
}Select an option to see the answer and solution.
Q240
Open questionSelect an option to see the answer and solution.