21. What is the use of the set() function in bitset?
22. What is the use of the allocator interface in the user-defined container?
23. What are unary functors?
24. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class sample
{
public:
virtual void example() = 0;
};
class Ex1:public sample
{
public:
void example()
{
cout << "ubuntu";
}
};
class Ex2:public sample
{
public:
void example()
{
cout << " is awesome";
}
};
int main()
{
sample* arra[2];
Ex1 e1;
Ex2 e2;
arra[0]=&e1;
arra[1]=&e2;
arra[0]->example();
arra[1]->example();
}
#include <iostream>
using namespace std;
class sample
{
public:
virtual void example() = 0;
};
class Ex1:public sample
{
public:
void example()
{
cout << "ubuntu";
}
};
class Ex2:public sample
{
public:
void example()
{
cout << " is awesome";
}
};
int main()
{
sample* arra[2];
Ex1 e1;
Ex2 e2;
arra[0]=&e1;
arra[1]=&e2;
arra[0]->example();
arra[1]->example();
}25. How many Pseudo-random number engines are there?
26. What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
class A
{
public:
T func(T a, T b){
return a/b;
}
};
int main(int argc, char const *argv[])
{
A <char>a1;
cout<<a1.func(65,1)<<endl;
cout<<a1.func(65.28,1.1)<<endl;
return 0;
}
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
class A
{
public:
T func(T a, T b){
return a/b;
}
};
int main(int argc, char const *argv[])
{
A <char>a1;
cout<<a1.func(65,1)<<endl;
cout<<a1.func(65.28,1.1)<<endl;
return 0;
}27. What is the user-defined header file extension in c++?
28. What will be the output of the following C++ code?
#include <iostream>
#include <array>
using namespace std;
int main(int argc, char const *argv[])
{
array<int,5> arr = {1,2,3,4,5};
cout<<"Printing Using [] operator: ";
for(int i=0;i<5;i++){
cout<<arr[i]<<" ";
}
cout<<endl;
cout<<"Printing Using at() function: ";
for(int i=0;i<5;i++){
cout<<arr.at(i)<<" ";
}
cout<<endl;
return 0;
}
#include <iostream>
#include <array>
using namespace std;
int main(int argc, char const *argv[])
{
array<int,5> arr = {1,2,3,4,5};
cout<<"Printing Using [] operator: ";
for(int i=0;i<5;i++){
cout<<arr[i]<<" ";
}
cout<<endl;
cout<<"Printing Using at() function: ";
for(int i=0;i<5;i++){
cout<<arr.at(i)<<" ";
}
cout<<endl;
return 0;
}29. Unordered map is implemented using . . . . . . . .
30. How the template class is different from the normal class?
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 8
- C plus plus miscellaneous - Section 10
- C plus plus miscellaneous - Section 11
