31. Which function is used to calculate the norm of a complex number?
32. What will be the output of the following C++ code?
#include <iostream>
#include <cctype>
using namespace std;
int main(int argc, char const *argv[])
{
char arr[20] = "\'H3ll0\'";
for(int i=0;i<8;i++)
{
cout<<(bool)ispunct(arr[i]);
}
}
#include <iostream>
#include <cctype>
using namespace std;
int main(int argc, char const *argv[])
{
char arr[20] = "\'H3ll0\'";
for(int i=0;i<8;i++)
{
cout<<(bool)ispunct(arr[i]);
}
}
33. What is the syntax of printing the first element of an array Arr using get() function?
34. What will be the output of the following C++ code?
#include <iostream>
#include <vector>
#include <forward_list>
using namespace std;
int main()
{
forward_list<int> fl1 = {1,7,8,9,10};
forward_list<int> fl2 = {2,3,4,5,6};
fl1.splice_after(fl1.begin(), fl2);
for (int&c : fl1)
cout << c << " ";
cout<<endl;
return 0;
}
#include <iostream>
#include <vector>
#include <forward_list>
using namespace std;
int main()
{
forward_list<int> fl1 = {1,7,8,9,10};
forward_list<int> fl2 = {2,3,4,5,6};
fl1.splice_after(fl1.begin(), fl2);
for (int&c : fl1)
cout << c << " ";
cout<<endl;
return 0;
}
35. Which of the following is correct about map and multimap?
36. Which of the following is correct about Input Iterators?
37. What will be the output of the following C++ code?
#include <iostream>
#include <functional>
#include <numeric>
using namespace std;
int myop (int x, int y)
{
return x + y;
}
int main ()
{
int val[] = {1, 2, 3, 5};
int result[7];
adjacent_difference (val, val + 7, result);
for (int i = 0; i < 4; i++)
cout << result[i] <<' ';
return 0;
}
#include <iostream>
#include <functional>
#include <numeric>
using namespace std;
int myop (int x, int y)
{
return x + y;
}
int main ()
{
int val[] = {1, 2, 3, 5};
int result[7];
adjacent_difference (val, val + 7, result);
for (int i = 0; i < 4; i++)
cout << result[i] <<' ';
return 0;
}
38. Pick the incorrect statement.
39. Given below classes which of the following are the possible row entries in vtable of D1 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() {};
};
40. What will be the capacity of the vector after 10 is pushed into the vector in 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.capacity()<<endl;
v.shrink_to_fit();
cout<<v.capacity()<<endl;
v.push_back(10);
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.capacity()<<endl;
v.shrink_to_fit();
cout<<v.capacity()<<endl;
v.push_back(10);
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 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 9
- C plus plus miscellaneous - Section 10
- C plus plus miscellaneous - Section 11