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 1 of 15

Q1.
Header files often have the file extension _____
Discuss
Answer: (a)..H
Q2.
What will happen when introduce the interface of classes in a run-time polymorphic hierarchy?
Discuss
Answer: (a).Separation of interface from implementation
Discuss
Answer: (b).Classes express functionality which represent responsibilities
Discuss
Answer: (a).Standard logging stream
Q5.
What is the output of this program?
    #include <iostream>
    #include <sstream>
    using namespace std;
    int main()
    {
        stringstream mys(ios :: in | ios :: out);
        std :: string dat("The double value is : 74.79 .");
        mys.str(dat);
        mys.seekg(-7, ios :: end);
        double val;
        mys >> val;
        val = val*val;
        mys.seekp(-7,ios::end);
        mys << val;
        std :: string new_val = mys.str();
        cout << new_val;
        return 0;
    }
Discuss
Answer: (b).5593.54
Q6.
What is the output of this program?
    #include <iostream>
    using namespace std;
    class Base
    {
        public:
            Base(){}
            ~Base(){}
            protected:
            private: 
    };
    class Derived:public Base
    {
        public:
            Derived(){}
            Derived(){}
            private:
            protected:
    };
    int main()
    {
        cout << "The program exceuted" << endl;
    }
Discuss
Answer: (b).Error
Q7.
What is the output of this program?
    #include <iostream>
    using namespace std;
    class MyException
    {
        public:
        MyException(int value) : mValue(value)
        {
        }
        int mValue;
    };
    class MyDerivedException : public MyException
    {
        public:
            MyDerivedException(int value, int anotherValue) : MyException(value),    mAnotherValue(anotherValue)
            {
            }
            int mValue;
            int mAnotherValue;
    };
    void doSomething()
    {
        throw MyDerivedException(10,20);
    }
    int main()
    {
        try
        {
            doSomething();
        }
        catch (MyDerivedException &exception)
        {
            cout << "\nCaught Derived Class Exception\n";
        }
        catch (MyException &exception)
        {
            cout << "\nCaught Base Class Exception\n";
        }
        return 0;
    }
Discuss
Answer: (b).Caught Derived Class Exception
Q8.
What is the output of this program?
    #include <iostream>
    #include <string>
    using namespace std;
    int main() 
    {
        string s = "a long string";
        s.insert(s.size() / 2, " * ");
        cout << s << endl;
        return 0;
    }
Discuss
Answer: (c).Depends on compiler
Q9.
How many types of guarantees are there in exception class can have?

a.

1

b.

2

c.

3

d.

4

Discuss
Answer: (c).3
Q10.
Which operator is used to create the user-defined streams in c++?
Discuss
Answer: (d).Both >> & <<
Page 1 of 15

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!