91. What is meant by hash tables in C++?
92. What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool IsOdd (int i)
{
return ((i % 2) == 1);
}
int main ()
{
vector<int> myvector;
myvector.push_back(10);
myvector.push_back(25);
myvector.push_back(40);
myvector.push_back(55);
vector<int> :: iterator it = find_if (myvector.begin(),
myvector.end(), IsOdd);
cout << *it << '\n';
return 0;
}
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool IsOdd (int i)
{
return ((i % 2) == 1);
}
int main ()
{
vector<int> myvector;
myvector.push_back(10);
myvector.push_back(25);
myvector.push_back(40);
myvector.push_back(55);
vector<int> :: iterator it = find_if (myvector.begin(),
myvector.end(), IsOdd);
cout << *it << '\n';
return 0;
}93. Given below classes which of the following are the possible row entries in vtable of Base class?
class Base
{
public:
virtual void function1() {};
virtual void function2() {};
};
class D1: public Base
{
public:
virtual void function1() {};
};
class D2: public Base
{
public:
virtual void function2() {};
};
class Base
{
public:
virtual void function1() {};
virtual void function2() {};
};
class D1: public Base
{
public:
virtual void function1() {};
};
class D2: public Base
{
public:
virtual void function2() {};
};94. Which of the following is the correct syntax of declaring a complex number?
95. What is the use of the flip function in bitset?
96. What do input and output objects support?
97. What is the use of log() function in a complex?
98. What is meant by polymorphism?
99. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
double a = 10, b = 5, res;
char Operator = '/';
try
{
if (b == 0)
throw "Division by zero not allowed";
res = a / b;
cout << a << " / " << b << " = " << res;
}
catch(const char* Str)
{
cout << "\n Bad Operator: " << Str;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
double a = 10, b = 5, res;
char Operator = '/';
try
{
if (b == 0)
throw "Division by zero not allowed";
res = a / b;
cout << a << " / " << b << " = " << res;
}
catch(const char* Str)
{
cout << "\n Bad Operator: " << Str;
}
return 0;
}100. What will be the output of the following C++ code?
#include <iostream>
#include <vector>
using namespace std;
int main ()
{
vector<int> myvector (5);
int* p = myvector.data();
*p = 10;
++p;
*p = 20;
p[2] = 100;
for (unsigned i = 0; i < myvector.size(); ++i)
cout << ' ' << myvector[i];
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int main ()
{
vector<int> myvector (5);
int* p = myvector.data();
*p = 10;
++p;
*p = 20;
p[2] = 100;
for (unsigned i = 0; i < myvector.size(); ++i)
cout << ' ' << myvector[i];
return 0;
}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 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
