41. The switch statement is also called as?
42. Which container is used to keep priority based elements?
43. What will be the output of the following C++ code?
#include<iostream>
using namespace std;
int main()
{
int a = 5;
auto check = [](int x)
{
if(x == 0)
return false;
else
return true;
};
cout<<check(a)<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main()
{
int a = 5;
auto check = [](int x)
{
if(x == 0)
return false;
else
return true;
};
cout<<check(a)<<endl;
return 0;
}44. What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool mygreater (int i,int j)
{
return (i > j);
}
int main ()
{
int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};
vector<int> v(myints, myints + 8);
pair<vector<int> :: iterator, vector<int> :: iterator> bounds;
sort (v.begin(), v.end());
bounds = equal_range (v.begin(), v.end(), 20);
cout << (bounds.first - v.begin());
cout << " and " << (bounds.second - v.begin()) << '\n';
return 0;
}
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool mygreater (int i,int j)
{
return (i > j);
}
int main ()
{
int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};
vector<int> v(myints, myints + 8);
pair<vector<int> :: iterator, vector<int> :: iterator> bounds;
sort (v.begin(), v.end());
bounds = equal_range (v.begin(), v.end(), 20);
cout << (bounds.first - v.begin());
cout << " and " << (bounds.second - v.begin()) << '\n';
return 0;
}45. What is the function of shift()?
46. What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
class A
{
T a;
public:
A(){}
~A(){}
};
int main(int argc, char const *argv[])
{
A <char>a1;
A <int>a2;
A <double>a3;
cout<<sizeof(a1)<<endl;
cout<<sizeof(a2)<<endl;
cout<<sizeof(a3)<<endl;
return 0;
}
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
class A
{
T a;
public:
A(){}
~A(){}
};
int main(int argc, char const *argv[])
{
A <char>a1;
A <int>a2;
A <double>a3;
cout<<sizeof(a1)<<endl;
cout<<sizeof(a2)<<endl;
cout<<sizeof(a3)<<endl;
return 0;
}47. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class Cat
{
public:
int age;
int weight;
};
int main()
{
Cat f;
f.age = 56;
cout << "Gates is " ;
cout << f.age << " years old.\n";
}
#include <iostream>
using namespace std;
class Cat
{
public:
int age;
int weight;
};
int main()
{
Cat f;
f.age = 56;
cout << "Gates is " ;
cout << f.age << " years old.\n";
}48. Which classes can have vtable?
49. What are the operators available in C++ for dynamic allocation and de-allocation of memories?
50. How many types of templates are there in c++?
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 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
