logo

CuriousTab

CuriousTab

Discussion


Home C++ Programming References See What Others Are Saying!
  • Question
  • Which of the following statements is correct?

    1. An array of references is acceptable.
    2. We can also create a reference to a reference.


  • Options
  • A. Only 1 is correct.
  • B. Only 2 is correct.
  • C. Both 1 and 2 are correct.
  • D. Both 1 and 2 are incorrect.

  • Correct Answer
  • Both 1 and 2 are incorrect. 


  • More questions

    • 1. Which constructor function is designed to copy objects of the same class type?

    • Options
    • A. Create constructor
    • B. Object constructor
    • C. Dynamic constructor
    • D. Copy constructor
    • Discuss
    • 2. Which of the following ways are legal to access a class data member using this pointer?

    • Options
    • A. this->x
    • B. this.x
    • C. *this.x
    • D. *this-x
    • Discuss
    • 3. Which of the following can be overloaded?

    • Options
    • A. Object
    • B. Functions
    • C. Operators
    • D. Both B and C
    • Discuss
    • 4. Which of the following statements are correct for a static member function?

      1. It can access only other static members of its class.
      2. It can be called using the class name, instead of objects.

    • Options
    • A. Only 1 is correct.
    • B. Only 2 is correct.
    • C. Both 1 and 2 are correct.
    • D. Both 1 and 2 are incorrect.
    • Discuss
    • 5. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          static int x; 
          public:
          static void SetData(int xx)
          {
              x = xx; 
          }
          static void Display() 
          {
              cout<< x ;
          }
      };
      int CuriousTab::x = 0; 
      int main()
      {
          CuriousTab::SetData(44);
          CuriousTab::Display();
          return 0; 
      }

    • Options
    • A. The program will print the output 0.
    • B. The program will print the output 44.
    • C. The program will print the output Garbage.
    • D. The program will report compile time error.
    • Discuss
    • 6. Reference is like a _____.

    • Options
    • A. Pointer
    • B. Structure
    • C. Macro
    • D. Enum
    • Discuss
    • 7. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      int main()
      {
          int x = 0;
          int &y = x; y = 5; 
          while(x <= 5)
          {
              cout<< y++ << " ";
              x++;
          }
          cout<< x; 
          return 0; 
      }

    • Options
    • A. The program will print the output 5 6 7 8 9 10.
    • B. The program will print the output 5 6 7 8 9 10 7.
    • C. The program will print the output 5 7.
    • D. It will result in a compile time error.
    • Discuss
    • 8. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          int a, b, c; 
          public:
          void SetValue(int x, int y ,int z)
          {
              a = x;
              b = y;
              c = z;
          } 
          void Display()
          {
              cout<< a << " " << b << " " << c;
          } 
      }; 
      int main()
      {
          CuriousTab objCuriousTab;
          int x  = 2;
          int &y = x;
          y = 5;
          objCuriousTab.SetValue(x, ++y, x + y);
          objCuriousTab.Display();
          return 0; 
      }

    • Options
    • A. The program will print the output 5 6 10.
    • B. The program will print the output 6 6 10.
    • C. The program will print the output 6 6 12.
    • D. It will result in a compile time error.
    • Discuss
    • 9. What will be the out of the following program?
      #include<iostream.h> 
      class CuriousTabBase
      {
          public:
          int x, y; 
          public:
          CuriousTabBase(int xx = 0, int yy = 0)
          {
              x = xx;
              y = yy; 
          } 
       };
      class CuriousTabDerived : public CuriousTabBase
      {
          private:
              CuriousTabBase objBase; 
          public:
          CuriousTabDerived(int xx, int yy) : CuriousTabBase(xx), objBase(yy)
          {
              cout << this->x   << " " 
                   << this->y   << " "  
                   << objBase.x << " "
                   << objBase.y << " ";
          } 
          ~CuriousTabDerived()
          { }
      };
      int main()
      {
          CuriousTabDerived objDev(11, 22); 
          return 0;
      }

    • Options
    • A. 11 22 0 0
    • B. 11 0 0 22
    • C. 11 0 22 0
    • D. 11 22 11 22
    • E. The program will report compile time error.
    • Discuss
    • 10. Which of the following operator is overloaded for object cout?

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


    Comments

    There are no comments.

Enter a new Comment