81. Why is it expensive to use objects for the exception?
82. What is the use of count() function in bitset?
83. What will be the output of the following C++ code?
#include <iostream>
#include <limits>
using namespace std;
int main( )
{
cout << numeric_limits<short int> :: max() << endl;
}
#include <iostream>
#include <limits>
using namespace std;
int main( )
{
cout << numeric_limits<short int> :: max() << endl;
}84. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class Foo
{
public:
Foo(int i = 0){ _i = i;}
void f()
{
cout << "Executed"<<endl;
}
private:
int _i;
};
int main()
{
Foo *p = 0;
p -> f();
}
#include <iostream>
using namespace std;
class Foo
{
public:
Foo(int i = 0){ _i = i;}
void f()
{
cout << "Executed"<<endl;
}
private:
int _i;
};
int main()
{
Foo *p = 0;
p -> f();
}85. Which header file is required to use any container?
86. What is the correct syntax for declaring an allocator?
87. What will be the output of the following C++ code?
#include <stdio.h>
int main ()
{
freopen ("myfile.txt", "w", stdout);
printf ("This sentence is redirected to a file");
fclose (stdout);
return 0;
}
#include <stdio.h>
int main ()
{
freopen ("myfile.txt", "w", stdout);
printf ("This sentence is redirected to a file");
fclose (stdout);
return 0;
}88. What is the use of the indentation in c++?
89. Which of the header file must be included to use stringstream?
90. What will be the output of the following C++ code?
#include <iostream>
#include <iterator>
#include <list>
using namespace std;
int main ()
{
list<int> mylist;
for (int i = 0; i < 10; i++)
mylist.push_back (i * 10);
list<int> :: iterator it = mylist.begin();
advance (it, 5);
cout << *it << endl;
return 0;
}
#include <iostream>
#include <iterator>
#include <list>
using namespace std;
int main ()
{
list<int> mylist;
for (int i = 0; i < 10; i++)
mylist.push_back (i * 10);
list<int> :: iterator it = mylist.begin();
advance (it, 5);
cout << *it << 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 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
