Q321
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
17/51
Page
Pick an option on a question to see the right answer and solution.
Q321
Open questionSelect an option to see the answer and solution.
Q322
Open questionSelect an option to see the answer and solution.
Q323
Open question#include <iostream>
#include <string>
using namespace std;
int main()
{
cout<<is_array<int>::value;
cout<<is_array<char[10]>::value;
cout<<is_array<string>::value;
return 0;
}Select an option to see the answer and solution.
Q324
Open questionSelect an option to see the answer and solution.
Q325
Open question#include <iostream>
#include <exception>
using namespace std;
void myunexpected ()
{
cout << "unexpected handler called\n";
throw;
}
void myfunction () throw (int,bad_exception)
{
throw 'x';
}
int main (void)
{
set_unexpected (myunexpected);
try
{
myfunction();
}
catch (int)
{
cout << "caught int\n";
}
catch (bad_exception be)
{
cout << "caught bad_exception\n";
}
catch (...)
{
cout << "caught other exception \n";
}
return 0;
}Select an option to see the answer and solution.
Q326
Open question#include <iostream>
using namespace std;
template<typename type>
class TestVirt
{
public:
virtual type TestFunct(type Var1)
{
return Var1 * 2;
}
};
int main()
{
TestVirt<int> Var1;
cout << Var1.TestFunct(100) << endl;
return 0;
}Select an option to see the answer and solution.
Q327
Open questionSelect an option to see the answer and solution.
Q328
Open questionSelect an option to see the answer and solution.
Q329
Open question#include <iostream>
using namespace std;
class stu
{
protected:
int rno;
public:
void get_no(int a)
{
rno = a;
}
void put_no(void)
{
}
};
class test:public stu
{
protected:
float part1,part2;
public:
void get_mark(float x, float y)
{
part1 = x;
part2 = y;
}
void put_marks()
{
}
};
class sports
{
protected:
float score;
public:
void getscore(float s)
{
score = s;
}
void putscore(void)
{
}
};
class result: public test, public sports
{
float total;
public:
void display(void);
};
void result::display(void)
{
total = part1 + part2 + score;
put_no();
put_marks();
putscore();
cout << "Total Score=" << total << "\n";
}
int main()
{
result stu;
stu.get_no(123);
stu.get_mark(27.5, 33.0);
stu.getscore(6.0);
stu.display();
return 0;
}Select an option to see the answer and solution.
Q330
Open questionSelect an option to see the answer and solution.
Q331
Open questionSelect an option to see the answer and solution.
Q332
Open questionSelect an option to see the answer and solution.
Q333
Open questionSelect an option to see the answer and solution.
Q334
Open questionSelect an option to see the answer and solution.
Q335
Open question#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
int length;
char * buffer;
ifstream is;
is.open ("sample.txt", ios :: binary );
is.seekg (0, ios :: end);
length = is.tellg();
is.seekg (0, ios :: beg);
buffer = new char [length];
is.read (buffer, length);
is.close();
cout.write (buffer, length);
delete[] buffer;
return 0;
}Select an option to see the answer and solution.
Q336
Open questionSelect an option to see the answer and solution.
Q337
Open questionSelect an option to see the answer and solution.
Q338
Open questionSelect an option to see the answer and solution.
Q339
Open question#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
int myints[] = {10, 20, 30, 5, 15};
vector<int> v(myints, myints + 5);
make_heap (v.begin(), v.end());
pop_heap (v.begin(), v.end()); v.pop_back();
v.push_back(99); push_heap (v.begin(), v.end());
sort_heap (v.begin(), v.end());
for (unsigned i = 0; i < v.size(); i++)
cout << ' ' << v[i];
return 0;
}Select an option to see the answer and solution.
Q340
Open question#include <iostream>
using namespace std;
int main()
{
try
{
try
{
throw 20;
}
catch (int n)
{
cout << "Inner Catch\n";
throw;
}
}
catch (int x)
{
cout << "Outer Catch\n";
}
return 0;
}Select an option to see the answer and solution.