Questions and Answers


  1. How many items are there in sequence container?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    There are five items in sequence container. They are array, vector, list, forward_list and dequeue.


  1. What is the output of this program?
    #include <iostream>
    #include <deque>
    using namespace std;
    int main ()
    {
    deque<int> DequeData (6);
    deque<int>::reverse_iterator RevIter = DequeData.rbegin();
    int k = 0;
    for (RevIter = DequeData.rbegin(); RevIter != DequeData.rend(); ++RevIter)
    *RevIter = ++k;
    for (deque<int> :: iterator iter = DequeData.begin();
    iter != DequeData.end(); ++iter)
    cout << ' ' << *iter;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    In this program, We used the operation of rbegin and rend on dequeue and produced the result.



  1. Which of the following will return the new element at the end of container?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    back


  1. Which of the following class template are based on arrays?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Class template vector and class template dequeue both are based on arrays.



  1. Pick out the correct statement about vector.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    The syntax for declaring the vector element is vector<type> variable_name (number_of_elements);