Questions and Answers


  1. What is the output of this program?
    #include <iostream>
    #include <cmath>
    #include <list>
    using namespace std;
    bool IntegralPart(double One, double Two)
    {
    return ( int(One) == int(Two) );
    }
    struct is_near
    {
    bool operator() (double One, double Two)
    {
    return (fabs(One - Two) < 5.0);
    }
    };
    int main ()
    {
    double Array[] = { 10.05, 3.70, 12.02, 10.25, 14.24, 11.47, 76.32, 82.35, 95.31, 52.95 };
    list<double> ListData(Array, Array + 8);
    ListData.sort();
    ListData.unique();
    ListData.unique (IntegralPart);
    ListData.unique (is_near());
    for (list<double> :: iterator iter = ListData.begin(); iter != ListData.end(); ++iter)
    cout << ' ' << *iter;
    cout << '\n';
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    In this program, We are eliminating the values by using the unique operation in the list.


  1. How the list containers are implemented?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    List containers are implemented as doubly-linked lists. Doubly linked lists can store each of the elements they contain in different and unrelated storage locations.



  1. Which of the following does not support any insertion or deletion?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Because array is not dynamic in nature, So they can’t be manipulated.


  1. What do container adapter provide to interface?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    A container adapter provides a restricted interface to a container.In particular, adapters do not provide iterators; they are intended to be used only through their specialized interfaces.



  1. To what type of object does the container can be instantiated?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    any type of object