31. To what type of object does the container can be instantiated?
32. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
int var = -12;
try {
cout<<"Inside try\n";
if (var < 0)
{
throw var;
cout<<"After throw\n";
}
}
catch (char var ) {
cout<<"Exception Caught\n";
}
cout<<"After catch\n";
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int var = -12;
try {
cout<<"Inside try\n";
if (var < 0)
{
throw var;
cout<<"After throw\n";
}
}
catch (char var ) {
cout<<"Exception Caught\n";
}
cout<<"After catch\n";
return 0;
}
33. What is Valarray in C++?
34. What are Distributions in C++?
35. What will be the output of the following C++ code?
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
int main()
{
srand((unsigned)time(0));
int ran;
for (int i = 0; i < 2; i++)
{
ran = (rand() % 10) + 1;
cout << ran;
}
}
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
int main()
{
srand((unsigned)time(0));
int ran;
for (int i = 0; i < 2; i++)
{
ran = (rand() % 10) + 1;
cout << ran;
}
}
36. How many parameters are available in srand function?
37. Which one is used to refer to program elements in any translation units?
38. What will be the output of the following C++ code?
#include <iostream>
#include <functional>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main ()
{
vector <string*> numbers;
numbers.push_back ( new string ("one") );
numbers.push_back ( new string ("two") );
numbers.push_back ( new string ("three") );
vector <int> lengths ( numbers.size() );
transform (numbers.begin(), numbers.end(), lengths.begin(),
mem_fun(&string :: length));
for (int i = 0; i < 3; i++)
{
cout << lengths[i];
}
return 0;
}
#include <iostream>
#include <functional>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main ()
{
vector <string*> numbers;
numbers.push_back ( new string ("one") );
numbers.push_back ( new string ("two") );
numbers.push_back ( new string ("three") );
vector <int> lengths ( numbers.size() );
transform (numbers.begin(), numbers.end(), lengths.begin(),
mem_fun(&string :: length));
for (int i = 0; i < 3; i++)
{
cout << lengths[i];
}
return 0;
}
39. What can be improved by formatting the source code?
40. How many types of class relationships are there?
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 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 8
- C plus plus miscellaneous - Section 9
- C plus plus miscellaneous - Section 10
- C plus plus miscellaneous - Section 11