Questions and Answers


  1. What kind of library is Standard Template Library?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    The STL is a generic library, meaning that its components are heavily parameterized.


  1. What do maps and sets support?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Bi-directional iterators



  1. How many instance are allowed by map and set while inserting a element into container?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Both map and set only allow one instance of a key or element to be inserted into the container.


  1. What is the output of this program?
    #include <iostream>
    #include <set>
    using namespace std;
    int main ()
    {
    multiset<int> MultisetData;
    for (int k = 0; k < 6; k++) MultisetData.insert(k);
    multiset :: key_compare compare = MultisetData.key_comp();
    int highest = *MultisetData.rbegin();
    multiset :: iterator Iter = MultisetData.begin();
    do
    {
    cout << ' ' << *Iter;
    } while (compare(*Iter++, highest));
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    In this program, We used the set template and then we compared the keys and printing the result.



  1. What is the output of this program?
    #include <iostream>
    #include <set>
    using namespace std;
    int main ()
    {
    set<int> SetData;
    SetData.insert(25);
    SetData.insert(15);
    SetData.insert(45);
    SetData.insert(35);
    SetData.insert(55);
    while (!SetData.empty())
    {
    cout << ' ' << *SetData.begin();
    SetData.erase(SetData.begin());
    }
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    In this program, We used the set template and then we are initializing the values and then we are erasing it.