logo

CuriousTab

CuriousTab

Discussion


Home C++ Programming OOPS Concepts See What Others Are Saying!
  • Question
  • Which of the following operator is overloaded for object cout?


  • Options
  • A. >>
  • B. <<
  • C. +
  • D. =

  • Correct Answer
  • << 


  • More questions

    • 1. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class Tab
      {
            int x; 
          public:
            Tab();
           ~Tab();
            void Show() const;
      };
      Tab::Tab()
      {
          x = 25;
      }
      void Tab::Show() const
      {
          cout<< x;
      }
      int main()
      {
          Tab objB;
          objB.Show();
          return 0; 
      }

    • Options
    • A. The program will print the output 25.
    • B. The program will print the output Garbage-value.
    • C. The program will report compile time error.
    • D. The program will report runtime error.
    • Discuss
    • 2. What will be the output of the following program?
      #include<iostream.h> 
      class CuriousTab
      {
          int x, y; 
          public:
          CuriousTab(int xx)
          {
              x = ++xx;
          } 
          ~CuriousTab()
          {
              cout<< x - 1 << " ";
          }
          void Display()
          {
              cout<< --x + 1 << " ";
          } 
      };
      int main()
      {
          CuriousTab objCuriousTab(5);
          objCuriousTab.Display();
          int *p = (int*) &objCuriousTab;
          *p = 40;
          objCuriousTab.Display();
          return 0; 
      }

    • Options
    • A. 6 6 4
    • B. 6 6 5
    • C. 5 40 38
    • D. 6 40 38
    • E. 6 40 39
    • Discuss
    • 3. What will be the output of the following program?
      #include<iostream.h>
      class CuriousTabBase
      {   
          public:
          CuriousTabBase()
          {
              cout<< "Base OK. "; 
          }
          virtual ~CuriousTabBase()
          {
              cout<< "Base DEL. "; 
          }
      };
      class CuriousTabDerived: public CuriousTabBase
      {
          public:
          CuriousTabDerived()
          { 
              cout<< "Derived OK. "; 
          }
          ~CuriousTabDerived()
          { 
              cout<< "Derived DEL. "; 
          }
      };
      int main()
      {
          CuriousTabBase *basePtr = new CuriousTabDerived();
          delete basePtr;
          return 0;
      }

    • Options
    • A. Base OK. Derived OK.
    • B. Base OK. Derived OK. Base DEL.
    • C. Base OK. Derived OK. Derived DEL.
    • D. Base OK. Derived OK. Derived DEL. Base DEL.
    • E. Base OK. Derived OK. Base DEL. Derived DEL.
    • Discuss
    • 4. What will be the output of the following program?
      #include<iostream.h> 
      class AreaFinder
      {
          float l, b, h; 
          float result; 
          public:
          AreaFinder(float hh = 0, float ll = 0, float bb = 0) 
          {
              l = ll; 
              b = bb; 
              h = hh;
          }
          void Display(int ll)
          {
              if(l = 0)
                  result = 3.14f * h * h; 
              else
                  result = l * b; 
              cout<< result; 
          }
      };
      int main()
      {
          AreaFinder objAF(10, 10, 20);
          objAF.Display(0); 
          return 0; 
      }

    • Options
    • A. 0
    • B. 314
    • C. 314.0000
    • D. 200.0000
    • Discuss
    • 5. Which of the following are NOT provided by the compiler by default?

    • Options
    • A. Zero-argument Constructor
    • B. Destructor
    • C. Copy Constructor
    • D. Copy Destructor
    • Discuss
    • 6. It is a __________ error to pass arguments to a destructor.

    • Options
    • A. logical
    • B. virtual
    • C. syntax
    • D. linker
    • Discuss
    • 7. Which of the following statement is correct whenever an object goes out of scope?

    • Options
    • A. The default constructor of the object is called.
    • B. The parameterized destructor is called.
    • C. The default destructor of the object is called.
    • D. None of the above.
    • Discuss
    • 8. Which of the following statements is correct about the constructors and destructors?

    • Options
    • A. Destructors can take arguments but constructors cannot.
    • B. Constructors can take arguments but destructors cannot.
    • C. Destructors can be overloaded but constructors cannot be overloaded.
    • D. Constructors and destructors can both return a value.
    • Discuss
    • 9. Which of the following statement is correct about the program given below?
      #include<iostream> 
      enum curioustab
      {
          a=1, b, c
      };
      int main()
      {
          int x = c;
          int &y = x;
          int &z = x;
          y = b;
          std::cout<< z--;
          return 0; 
      }

    • Options
    • A. It will result in a compile time error.
    • B. The program will print the output 1.
    • C. The program will print the output 2.
    • D. The program will print the output 3.
    • Discuss
    • 10. Which of the following statement is correct?

    • Options
    • A. Overloaded functions can accept same number of arguments.
    • B. Overloaded functions always return value of same data type.
    • C. Overloaded functions can accept only same number and same type of arguments.
    • D. Overloaded functions can accept only different number and different type of arguments.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment