41. How many parameters are required for next_permutation?
42. What will be the output of the following C++ code?
#include <cstdlib>
#include <iostream>
using namespace std;
class X
{
public:
void* operator new(size_t sz) throw (const char*)
{
void* p = malloc(sz);
if (p == 0)
throw "malloc() failed";
return p;
}
void operator delete(void* p)
{
cout << "X :: operator delete(void*)" << endl;
free(p);
}
};
class Y
{
int filler[100];
public:
void operator delete(void* p, size_t sz) throw (const char*)
{
cout << "Freeing " << sz << " bytes" << endl;
free(p);
};
};
int main()
{
X* ptr = new X;
delete ptr;
Y* yptr = new Y;
delete yptr;
}
#include <cstdlib>
#include <iostream>
using namespace std;
class X
{
public:
void* operator new(size_t sz) throw (const char*)
{
void* p = malloc(sz);
if (p == 0)
throw "malloc() failed";
return p;
}
void operator delete(void* p)
{
cout << "X :: operator delete(void*)" << endl;
free(p);
}
};
class Y
{
int filler[100];
public:
void operator delete(void* p, size_t sz) throw (const char*)
{
cout << "Freeing " << sz << " bytes" << endl;
free(p);
};
};
int main()
{
X* ptr = new X;
delete ptr;
Y* yptr = new Y;
delete yptr;
}43. Which is the correct syntax of capturing a variable 'X' by reference and other variable 'Y' by value in lambda expression?
44. Which of the following is correct about tuple_size?
45. Which of the following keyword is used to declare the header file?
46. What will be the output of the following C++ code?
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v;
for (int i = 1; i <= 5; i++)
v.push_back(i);
cout<<v.size()<<endl;
v.resize(4);
cout<<v.size()<<endl;
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v;
for (int i = 1; i <= 5; i++)
v.push_back(i);
cout<<v.size()<<endl;
v.resize(4);
cout<<v.size()<<endl;
return 0;
}47. Which header file is required for using bitset in your program?
48. What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <tuple>
using namespace std;
int main()
{
tuple <int, char, string> tp = {"Hello", 1, 's'};
return 0;
}
#include <iostream>
#include <string>
#include <tuple>
using namespace std;
int main()
{
tuple <int, char, string> tp = {"Hello", 1, 's'};
return 0;
}49. Which of the following is/are advantage(s) of Sequence Container arrays over C-like arrays?
50. Pick out the correct statement.
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 8
- C plus plus miscellaneous - Section 9
- C plus plus miscellaneous - Section 10
- C plus plus miscellaneous - Section 11
