71. How many parameters are there in getline function?
72. Which of the following relationships is uni-directional?
73. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
int a = 10;
if (a < 15)
{
time:
cout << a;
goto time;
}
break;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a = 10;
if (a < 15)
{
time:
cout << a;
goto time;
}
break;
return 0;
}
74. Which is used to create a pure virtual function?
75. What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
int num = 3;
string str_bad = "wrong number used";
try
{
if ( num == 1 )
{
throw 5;
}
if ( num == 2 )
{
throw 1.1f;
}
if ( num != 1 || num != 2 )
{
throw str_bad;
}
}
catch (int a)
{
cout << "Exception is: " << a << endl;
}
catch (float b)
{
cout << "Exception is: " << b << endl;
}
catch (...)
{
cout << str_bad << endl;
}
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main ()
{
int num = 3;
string str_bad = "wrong number used";
try
{
if ( num == 1 )
{
throw 5;
}
if ( num == 2 )
{
throw 1.1f;
}
if ( num != 1 || num != 2 )
{
throw str_bad;
}
}
catch (int a)
{
cout << "Exception is: " << a << endl;
}
catch (float b)
{
cout << "Exception is: " << b << endl;
}
catch (...)
{
cout << str_bad << endl;
}
return 0;
}
76. Which of the following function is used to insert an element at the end of a vector?
77. What are the tuples in C++?
78. How many ways of reusing are there in the class hierarchy?
79. Which header file is used for the numeric limits in C++?
80. 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;
tuple <int, char, string> tp2;
tp1 = make_tuple(6, 'a', "Hello");
tp2 = make_tuple(9, 'z', "World");
cout<<"("<<get<0>(tp1)<<", "<<get<1>(tp1)<<", "<<get<2>(tp1)<<")"<<endl;
cout<<"("<<get<0>(tp2)<<", "<<get<1>(tp2)<<", "<<get<2>(tp2)<<")"<<endl;
tp1.swap(tp2);
cout<<"("<<get<0>(tp1)<<", "<<get<1>(tp1)<<", "<<get<2>(tp1)<<")"<<endl;
cout<<"("<<get<0>(tp2)<<", "<<get<1>(tp2)<<", "<<get<2>(tp2)<<")"<<endl;
return 0;
}
#include <iostream>
#include <string>
#include <tuple>
using namespace std;
int main()
{
tuple <int, char, string> tp1;
tuple <int, char, string> tp2;
tp1 = make_tuple(6, 'a', "Hello");
tp2 = make_tuple(9, 'z', "World");
cout<<"("<<get<0>(tp1)<<", "<<get<1>(tp1)<<", "<<get<2>(tp1)<<")"<<endl;
cout<<"("<<get<0>(tp2)<<", "<<get<1>(tp2)<<", "<<get<2>(tp2)<<")"<<endl;
tp1.swap(tp2);
cout<<"("<<get<0>(tp1)<<", "<<get<1>(tp1)<<", "<<get<2>(tp1)<<")"<<endl;
cout<<"("<<get<0>(tp2)<<", "<<get<1>(tp2)<<", "<<get<2>(tp2)<<")"<<endl;
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