81. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
/* this is comment*
cout << "hello world";
return 0;
}
#include <iostream>
using namespace std;
int main()
{
/* this is comment*
cout << "hello world";
return 0;
}82. What is the default type of linkage that is available for identifiers?
83. What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include<typeinfo>
using namespace std;
int main( )
{
try
{
string strg1("Test");
string strg2("ing");
strg1.append(strg2, 4, 2);
cout << strg1 << endl;
}
catch (exception &e)
{
cout << "Caught: " << e.what() << endl;
cout << "Type: " << typeid(e).name() << endl;
};
return 0;
}
#include <iostream>
#include <string>
#include<typeinfo>
using namespace std;
int main( )
{
try
{
string strg1("Test");
string strg2("ing");
strg1.append(strg2, 4, 2);
cout << strg1 << endl;
}
catch (exception &e)
{
cout << "Caught: " << e.what() << endl;
cout << "Type: " << typeid(e).name() << endl;
};
return 0;
}84. Which are presented in the container adaptors?
85. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
template<typename T>
void loopIt(T x)
{
int count = 3;
T val[count];
for (int ii=0; ii < count; ii++)
{
val[ii] = x++;
cout << val[ii] << endl;
}
};
int main()
{
float xx = 2.1;
loopIt(xx);
}
#include <iostream>
using namespace std;
template<typename T>
void loopIt(T x)
{
int count = 3;
T val[count];
for (int ii=0; ii < count; ii++)
{
val[ii] = x++;
cout << val[ii] << endl;
}
};
int main()
{
float xx = 2.1;
loopIt(xx);
}86. Which of the following does not support any insertion or deletion?
87. How many items are there in sequence container?
88. What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
template<typename T>
void print_mydata(T output)
{
cout << output << endl;
}
int main()
{
double d = 5.5;
string s("Hello World");
print_mydata( d );
print_mydata( s );
return 0;
}
#include <iostream>
#include <string>
using namespace std;
template<typename T>
void print_mydata(T output)
{
cout << output << endl;
}
int main()
{
double d = 5.5;
string s("Hello World");
print_mydata( d );
print_mydata( s );
return 0;
}89. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void test(int x)
{
try
{
if (x > 0)
throw x;
else
throw 'x';
}
catch(char)
{
cout << "Catch a integer and that integer is:" << x;
}
}
int main()
{
cout << "Testing multiple catches\n:";
test(10);
test(0);
}
#include <iostream>
using namespace std;
void test(int x)
{
try
{
if (x > 0)
throw x;
else
throw 'x';
}
catch(char)
{
cout << "Catch a integer and that integer is:" << x;
}
}
int main()
{
cout << "Testing multiple catches\n:";
test(10);
test(0);
}90. What is a Random number generator?
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 9
- C plus plus miscellaneous - Section 10
- C plus plus miscellaneous - Section 11
