51. Which of the following operator is used to capture all the external variable by reference?
52. 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> tp1;
tp1 = make_tuple(6, 'a', "Hello");
int x;
string y;
tie(x,ignore,y) = tp1;
cout<<"x: "<<x<<"\ny: "<<y<<endl;
return 0;
}
#include <iostream>
#include <string>
#include <tuple>
using namespace std;
int main()
{
tuple <int, char, string> tp1;
tp1 = make_tuple(6, 'a', "Hello");
int x;
string y;
tie(x,ignore,y) = tp1;
cout<<"x: "<<x<<"\ny: "<<y<<endl;
return 0;
}53. What is meant by exception specification?
54. Which is used to throw a exception?
55. Which of the following is correct about Valarray?
56. What will be the output of the following C++ code?
#include<iostream>
using namespace std;
class Print
{
public:
void operator()(int a){
cout<<a<<endl;
}
};
int main()
{
Print print;
print(5);
return 0;
}
#include<iostream>
using namespace std;
class Print
{
public:
void operator()(int a){
cout<<a<<endl;
}
};
int main()
{
Print print;
print(5);
return 0;
}57. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
template<typename T>class clsTemplate
{
public:
T value;
clsTemplate(T i)
{
this->value = i;
}
void test()
{
cout << value << endl;
}
};
class clsChild : public clsTemplate<char>
{
public:
clsChild(): clsTemplate<char>( 0 )
{
}
clsChild(char c): clsTemplate<char>( c )
{
}
void test2()
{
test();
}
};
int main()
{
clsTemplate <int> a( 42 );
clsChild b( 'A' );
a.test();
b.test();
return 0;
}
#include <iostream>
using namespace std;
template<typename T>class clsTemplate
{
public:
T value;
clsTemplate(T i)
{
this->value = i;
}
void test()
{
cout << value << endl;
}
};
class clsChild : public clsTemplate<char>
{
public:
clsChild(): clsTemplate<char>( 0 )
{
}
clsChild(char c): clsTemplate<char>( c )
{
}
void test2()
{
test();
}
};
int main()
{
clsTemplate <int> a( 42 );
clsChild b( 'A' );
a.test();
b.test();
return 0;
}58. What are the design requirements for building a container from the sratch?
59. What will happen if an exception that is thrown may cause a whole load of objects to go out of scope?
60. How many tests are available in read and write operations?
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
