41.
What is the purpose of the 'std::forward_list' container in C++ STL?

43.
What is the purpose of the 'std::array' container in C++ STL?

45.
What will be the output of the following C++ code?
#include <stdio.h>
#include <math.h>
int main ()
{
    printf ("%lf\n", fmod (5.3, 2) );
    printf ("%lf\n", fmod (18.5, 4.2) );
    return 0;
}

46.
What will be the output of the following C++ code?
#include <typeinfo>
#include <iostream>
using namespace std;
class shape
{
    public:
    virtual void myvirtualfunc() const {}
};
class mytriangle: public shape
{
    public:
    virtual void myvirtualfunc() const
    {   
    };
};
int main()
{
    shape shape_instance;
    shape &ref_shape = shape_instance;
    try 
    {
        mytriangle &ref_mytriangle = dynamic_cast(ref_shape);
    }
    catch (bad_cast) 
    {
        cout << "Caught: bad_cast exception\n";
    }
    return 0;
}

49.
What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main () 
{
    vector<int> myvector;
    for (int i = 1; i < 6; ++i) 
        myvector.push_back(i);
    reverse(myvector.begin(), myvector.end());
    for (vector<int> :: iterator it = myvector.begin(); it != myvector.end(); ++it)
        cout << ' ' << *it;
    return 0;
}

Read More Section(Standard Template Library (STL) in C plus plus)

Each Section contains maximum 100 MCQs question on Standard Template Library (STL) in C plus plus. To get more questions visit other sections.