31. What will be the output of the following C++ code?
#include<iostream>
#include<stdlib.h>
using namespace std;
template<class T, class U, class V=double>
class A
{
T x;
U y;
V z;
};
int main()
{
A<int, int> a;
A<double, double> b;
cout << sizeof(a) << endl;
cout << sizeof(b) << endl;
return 0;
}
#include<iostream>
#include<stdlib.h>
using namespace std;
template<class T, class U, class V=double>
class A
{
T x;
U y;
V z;
};
int main()
{
A<int, int> a;
A<double, double> b;
cout << sizeof(a) << endl;
cout << sizeof(b) << endl;
return 0;
}32. When does the next sequence point start?
33. What will be the output of the following C++ code?
#include <iostream>
#include <queue>
using namespace std;
int main ()
{
queue<int> myqueue;
int sum (0);
for (int i = 1; i <= 10; i++)
myqueue.push(i);
while (!myqueue.empty())
{
sum += myqueue.front();
myqueue.pop();
}
cout << sum << endl;
return 0;
}
#include <iostream>
#include <queue>
using namespace std;
int main ()
{
queue<int> myqueue;
int sum (0);
for (int i = 1; i <= 10; i++)
myqueue.push(i);
while (!myqueue.empty())
{
sum += myqueue.front();
myqueue.pop();
}
cout << sum << endl;
return 0;
}34. Which header file is used to manipulate the allocater?
35. What kind of functions are min and max in c++?
36. What will be the output of the following C++ code?
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main()
{
srand((unsigned)time(0));
int ran;
int low = 1, high = 10;
int range = (high - low) + 1;
for(int index = 0; index < 1; index++)
{
ran = low + int(range * rand() / (RAND_MAX + 1.0));
cout << ran << endl;
}
}
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main()
{
srand((unsigned)time(0));
int ran;
int low = 1, high = 10;
int range = (high - low) + 1;
for(int index = 0; index < 1; index++)
{
ran = low + int(range * rand() / (RAND_MAX + 1.0));
cout << ran << endl;
}
}37. Which of the following header file is required for forwawrd_list?
38. Pick out the correct statement about multiple inheritances.
39. Which operator is used to compare the elements in heap?
40. Which of the following is correct to interpret Hello World as a single argument?
1. $ ./output 'Hello World'
2. $ ./output Hello World
1. $ ./output 'Hello World'
2. $ ./output Hello WorldRead 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 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
