adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <deque>
    using namespace std;
    int main ()
    {
        unsigned int i;
        deque<int> a (3,100);
        deque<int> b (5,200);
        a.swap(b);
        cout << "a contains:";
        for (deque<int>::iterator it = a.begin(); it != a.end(); ++it)
            cout << ' ' << *it;
        cout << "b contains:";
        for (deque<int>::iterator it = b.begin(); it != b.end(); ++it)
            cout << ' ' << *it;
        return 0;
    }

a.

a contains: 200 200 200 200 200b contains: 100 100 100

b.

a contains: 100 100 100 100 100b contains: 200 200 200

c.

a contains: 200 200 200 200 200b contains: 200 200 200

d.

none of the mentioned

Answer: (a).a contains: 200 200 200 200 200b contains: 100 100 100

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?