83.
What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main () 
{
    int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};
    int mycount = count (myints, myints + 8, 10);
    cout << "10 appears " << mycount << " times.\n";
    vector<int> myvector (myints, myints+8);
    mycount = count (myvector.begin(), myvector.end(), 20);
    cout << "20 appears " << mycount  << " times.\n";
    return 0;
}

84.
What will be the output of the following C++ code?
#include <stdio.h>
#include <stdlib.h>
int main ()
{
    div_t divresult;
 
    divresult = div (38, 5);
    printf ("%d\n", divresult.rem);
    return 0;
}

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

86.
What are Iterators?

87.
What will be the output of the following C++ code?
#include <typeinfo>
#include <iostream>
using namespace std;
class Test
{
    public:
    Test();
    virtual ~Test();
};
int main()
{
    Test *ptrvar = NULL;
    try 
    {
        cout << typeid(*ptrvar).name() << endl;
    }
    catch (bad_typeid) 
    {
        cout << "The object is null" << endl;
    }
    return 0;
}

88.
What will be the output of the following C++ code?
#include <iostream> 
#include <algorithm>
using namespace std;
int main () 
{
    int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};  
    int* pbegin = myints;                      
    int* pend = myints + sizeof(myints) / sizeof(int);
    pend = remove (pbegin, pend, 20);      
    for (int* p = pbegin; p != pend; ++p)
        cout << ' ' << *p;
    return 0;
}

89.
What is meant by vector in the container library contains?

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.