21. What are the disadvantages if use return keyword to return error codes?
22. What will be the output of the following C++ code?
#include <iostream>
#include <exception>
#include <typeinfo>
using namespace std;
class Test1
{
virtual int Funct()
{
}
};
int main ()
{
try
{
Test1 * var = NULL;
typeid (*var);
}
catch (std::exception& typevar)
{
cout << "Exception: " << typevar.what() << endl;
}
return 0;
}
#include <iostream>
#include <exception>
#include <typeinfo>
using namespace std;
class Test1
{
virtual int Funct()
{
}
};
int main ()
{
try
{
Test1 * var = NULL;
typeid (*var);
}
catch (std::exception& typevar)
{
cout << "Exception: " << typevar.what() << endl;
}
return 0;
}23. What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
int first[] = {5, 10, 15};
int second[] = {50, 40, 30};
vector<int> v(4);
vector<int> :: iterator it;
sort (first, first + 3);
sort (second, second + 3);
it = set_symmetric_difference (first, first + 2, second, second + 2,
v.begin());
v.resize(it - v.begin());
for (it = v.begin(); it != v.end(); ++it)
cout << ' ' << *it;
return 0;
}
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
int first[] = {5, 10, 15};
int second[] = {50, 40, 30};
vector<int> v(4);
vector<int> :: iterator it;
sort (first, first + 3);
sort (second, second + 3);
it = set_symmetric_difference (first, first + 2, second, second + 2,
v.begin());
v.resize(it - v.begin());
for (it = v.begin(); it != v.end(); ++it)
cout << ' ' << *it;
return 0;
}24. What is the header file for vector permutation?
25. Which exception is thrown if the typecasting is not done properly?
26. How many parameters are needed for minmax function?
27. How many parameters are available in partial_sum function in c++?
28. What kind of locale does every program is having in C++?
29. How many ways are there to use functors?
30. How to handle error in the destructor?
Read More Section(C plus plus miscellaneous)
Each Section contains maximum 100 MCQs question on C plus plus miscellaneous. To get more questions visit other sections.
- C plus plus miscellaneous - Section 1
- C plus plus miscellaneous - Section 2
- C plus plus miscellaneous - Section 3
- C plus plus miscellaneous - Section 4
- C plus plus miscellaneous - Section 5
- C plus plus miscellaneous - Section 6
- C plus plus miscellaneous - Section 7
- C plus plus miscellaneous - Section 9
- C plus plus miscellaneous - Section 10
- C plus plus miscellaneous - Section 11
