adplus-dvertising

Welcome to the Class Hierarchies,Library and Containers MCQs Page

Dive deep into the fascinating world of Class Hierarchies,Library and Containers with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Class Hierarchies,Library and Containers, a crucial aspect of Object Oriented Programming Using C++. In this section, you will encounter a diverse range of MCQs that cover various aspects of Class Hierarchies,Library and Containers, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Object Oriented Programming Using C++.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Class Hierarchies,Library and Containers. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Object Oriented Programming Using C++.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Class Hierarchies,Library and Containers. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Class Hierarchies,Library and Containers MCQs | Page 9 of 15

Explore more Topics under Object Oriented Programming Using C++

Q81.
Which are the parameters for the content of the buffer?
Discuss
Answer: (c).both start & finish
Q82.
What do vectors represent?
Discuss
Answer: (b).Dynamic arrays
Discuss
Answer: (a).Contiguous storage locations
Q84.
How many vector container properties are there in c++?

a.

1

b.

2

c.

3

d.

4

Discuss
Answer: (c).3
Q85.
What is the output of this program?
    #include <iostream>
    #include <vector>
    using namespace std;
    int main ()
    {
        unsigned int i;
        vector<int> first;
        vector<int> second (4, 100);
        vector<int> third (second.begin(), second.end());
        vector<int> fourth (third);
        int myints[] = {16, 2, 77, 29};
        vector<int> fifth (myints, myints + sizeof(myints) / sizeof(int) );
        for (vector<int> :: iterator it = fifth.begin(); it != fifth.end(); ++it)
            cout << ' ' << *it;
        return 0;
    }
Discuss
Answer: (d).16 2 77 29
Q86.
What is the output of this program?
    #include <iostream>
    #include <vector>
    using namespace std;
    int main ()
    {
        vector<int> myvector;
        int sum (0);
        myvector.push_back (100);
        myvector.push_back (200);
        myvector.push_back (300);
        while (!myvector.empty())
        {
            sum += myvector.back();
            myvector.pop_back();
        }
        cout << sum << '\n';
        return 0;
    }
Discuss
Answer: (b).600
Q87.
What is the output of this program?
    #include <iostream>
    #include <vector>
    using namespace std;
    int main ()
    {
        vector<int> a (3, 0);
        vector<int> b (5, 0);
        b = a;
        a = vector<int>();
        cout << "Size of a " << int(a.size()) << '\n';
        cout << "Size of b " << int(b.size()) << '\n';
        return 0;
    }
Discuss
Answer: (a).Size of a 0 Size of b 3
Q88.
What is the output of this program?
    #include <iostream>
    #include <vector>
    using namespace std;
    int main ()
    {
        vector<int> first;
        first.assign (7,100);
        vector<int>::iterator it;
        it=first.begin()+1;
        int myints[] = {1776,7,4};
        cout << int (first.size()) << '\n';
        return 0;
    }

a.

10

b.

9

c.

8

d.

7

Discuss
Answer: (d).7
Q89.
What is the output of this program?
    #include <iostream>
    #include <vector>
    using namespace std;
    int main ()
    {
        vector<int> myvector (5);
        int* p = myvector.data();
        *p = 10;
        ++p;
        *p = 20;
        p[2] = 100;
        for (unsigned i = 0; i < myvector.size(); ++i)
            cout << ' ' << myvector[i];
        return 0;
    }
Discuss
Answer: (a).10 20 0 100 0
Q90.
Pick out the correct statement about vector.
Discuss
Answer: (a).vector<int> values (5)

Suggested Topics

Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!