CPP

CPP

Class Hierarchies Introduction has 8 Questions
Which operator is used to create the user-defined streams in c++?

>>
<<
&
Both a & b
What will happen when introduce the interface of classes in a run-time polymorphic hierarchy?

Separation of interface from implementation
Merging of interface from implementation
Separation of interface from debugging
None of the mentioned
Which classes are called as mixin?

Represent a secondary design
Classes express functionality which represent responsibilities.
Both a & b
None of the mentioned
What is the use of clog?

Standard logging stream
Error stream
Input stream
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main()
  5.     {
  6.         stringstream mys(ios :: in | ios :: out);
  7.         std :: string dat("The double value is : 74.79 .");
  8.         mys.str(dat);
  9.         mys.seekg(-7, ios :: end);
  10.         double val;
  11.         mys >> val;
  12.         val = val*val;
  13.         mys.seekp(-7,ios::end);
  14.         mys << val;
  15.         std :: string new_val = mys.str();
  16.         cout << new_val;
  17.         return 0;
  18.     }

5593.54
Error
Runtime error
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     class Base
  4.     {
  5.         public:
  6.             Base(){}
  7.             ~Base(){}
  8.             protected:
  9.             private: 
  10.     };
  11.     class Derived:public Base
  12.     {
  13.         public:
  14.             Derived(){}
  15.             Derived(){}
  16.             private:
  17.             protected:
  18.     };
  19.     int main()
  20.     {
  21.         cout << "The program exceuted" << endl;
  22.     }

The program executed
Error
Runtime error
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     class MyException
  4.     {
  5.         public:
  6.         MyException(int value) : mValue(value)
  7.         {
  8.         }
  9.         int mValue;
  10.     };
  11.     class MyDerivedException : public MyException
  12.     {
  13.         public:
  14.             MyDerivedException(int value, int anotherValue) : MyException(value),    mAnotherValue(anotherValue)
  15.             {
  16.             }
  17.             int mValue;
  18.             int mAnotherValue;
  19.     };
  20.     void doSomething()
  21.     {
  22.         throw MyDerivedException(10,20);
  23.     }
  24.     int main()
  25.     {
  26.         try
  27.         {
  28.             doSomething();
  29.         }
  30.         catch (MyDerivedException &exception)
  31.         {
  32.             cout << "\nCaught Derived Class Exception\n";
  33.         }
  34.         catch (MyException &exception)
  35.         {
  36.             cout << "\nCaught Base Class Exception\n";
  37.         }
  38.         return 0;
  39.     }

Caught Base Class Exception
Caught Derived Class Exception
Both a & b
None of the mentioned
How many types of guarantees are there in exception class can have?

1
2
3
4