71. 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> arr1 = {1,2,3,4,5};
array<int, 5> arr2 = {6,7,8,9,10};
arr1.swap(arr2);
for(int i=0;i<5;i++)
cout<<arr1[i]<<" ";
cout<<endl;
for(int i=0;i<5;i++)
cout<<arr2[i]<<" ";
cout<<endl;
return 0;
}
#include <iostream>
#include <array>
using namespace std;
int main(int argc, char const *argv[])
{
array<int, 5> arr1 = {1,2,3,4,5};
array<int, 5> arr2 = {6,7,8,9,10};
arr1.swap(arr2);
for(int i=0;i<5;i++)
cout<<arr1[i]<<" ";
cout<<endl;
for(int i=0;i<5;i++)
cout<<arr2[i]<<" ";
cout<<endl;
return 0;
}72. Where does a cin stops it extraction of data?
73. What is meant by the template parameter?
74. How many parameters are available in the function setbuf?
75. What will be the output of the following C++ code?
#include <iostream>
#include <typeinfo>
using namespace std;
int main ()
{
int * a;
int b;
a = 0; b = 0;
if (typeid(a) != typeid(b))
{
cout << typeid(a).name();
cout << typeid(b).name();
}
return 0;
}
#include <iostream>
#include <typeinfo>
using namespace std;
int main ()
{
int * a;
int b;
a = 0; b = 0;
if (typeid(a) != typeid(b))
{
cout << typeid(a).name();
cout << typeid(b).name();
}
return 0;
}76. What do we return if we use simple array on a internal container?
77. How can the member functions in the container be accessed?
78. To use internal linkage we have to use which keyword?
79. What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
T func(T a)
{
cout<<a;
return a;
}
int func(int a)
{
cout<<a;
}
int main(int argc, char const *argv[])
{
int a = 5;
int b = func(a);
float c = func(5.5);
return 0;
}
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
T func(T a)
{
cout<<a;
return a;
}
int func(int a)
{
cout<<a;
}
int main(int argc, char const *argv[])
{
int a = 5;
int b = func(a);
float c = func(5.5);
return 0;
}80. Which function is used to optimize the space in vector?
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
