logo

CuriousTab

CuriousTab

Discussion


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

    1. Pointer to a reference and reference to a pointer both are valid.
    2. When we use reference, we are actually referring to a referent.


  • 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 correct. 


  • More questions

    • 1. 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
    • 2. What will be the output of the following program?
      #include<iostream.h> 
      class CuriousTabBase
      {
          public:
          int x, y;
          CuriousTabBase(int xx = 0, int yy = 5)
          {
              x = ++xx; 
              y = --yy;
          }
          void Display()
          {
              cout<< --y;
          } 
          ~CuriousTabBase(){} 
      };
      class CuriousTabDerived : public CuriousTabBase
      {
          public:
          void Increment()
          {
              y++;
          }
          void Display()
          {
              cout<< --y;
          } 
      }; 
      int main()
      {
          CuriousTabDerived objCuriousTab;
          objCuriousTab.Increment();
          objCuriousTab.Display();
          return 0; 
      }

    • Options
    • A. 3
    • B. 4
    • C. 5
    • D. Garbage-value
    • E. The program will report compile time error.
    • Discuss
    • 3. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          int x; 
          public:
          CuriousTab(short ss)
          {
              cout<< "Short" << endl;
          }
          CuriousTab(int xx)
          {
              cout<< "Int" << endl;
          }
          CuriousTab(float ff)
          {
              cout<< "Float" << endl;
          }
          ~CuriousTab() 
          {
              cout<< "Final";
          }
      };
      int main()
      {
          CuriousTab *ptr = new CuriousTab('B');
          return 0; 
      }

    • Options
    • A. The program will print the output Short .
    • B. The program will print the output Int .
    • C. The program will print the output Float .
    • D. The program will print the output Final .
    • E. None of the above
    • Discuss
    • 4. Which of the following keyword is used to overload an operator?

    • Options
    • A. overload
    • B. operator
    • C. friend
    • D. override
    • Discuss
    • 5. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTabArray
      {
          int Matrix[3][3]; 
          public:
          CuriousTabArray()
          {
              for(int i = 0; i<3; i++)
                 for(int j = 0; j < 3; j++) 
                    Matrix[j][i] = i + j; 
          }
          void Display(void)
          {
              for(int i = 0; i < 3; i++)
                 for(int j = 0; j < 3; j++) 
                    cout<< Matrix[j][i] << " "; 
          } 
      }; 
      int main()
      {
          CuriousTabArray objCuriousTab;
          objCuriousTab.Display();
          return 0; 
      }

    • Options
    • A. The program will display the output 4 3 2 3 2 1 2 1 0.
    • B. The program will display the output 0 1 2 1 2 3 2 3 4.
    • C. The program will display the output 9 garbage values.
    • D. The program will report error on compilation.
    • Discuss
    • 6. Which of the following statement is correct?

    • Options
    • A. C++ enables to define functions that take constants as an argument.
    • B. We cannot change the argument of the function that that are declared as constant.
    • C. Both A and B.
    • D. We cannot use the constant while defining the function.
    • Discuss
    • 7. What will be the output of the following program?
      #include<iostream.h> 
      int val = 0; 
      class CuriousTab
      {
          public: 
          CuriousTab()
          {
              cout<< ++val;
          }
          ~CuriousTab()
          {
              cout<< val--; 
          } 
      }; 
      int main()
      {
          CuriousTab objCuriousTab1, objCuriousTab2, objCuriousTab3;
          {
              CuriousTab objCuriousTab4;
          } 
          return 0;
      }

    • Options
    • A. 1234
    • B. 4321
    • C. 12344321
    • D. 12341234
    • E. 43211234
    • Discuss
    • 8. Which of the following type of class allows only one object of it to be created?

    • Options
    • A. Virtual class
    • B. Abstract class
    • C. Singleton class
    • D. Friend class
    • Discuss
    • 9. What is correct about the static data member of a class?

    • Options
    • A. A static member function can access only static data members of a class.
    • B. A static data member is shared among all the object of the class.
    • C. A static data member can be accessed directly from main().
    • D. Both A and B.
    • Discuss
    • 10. Which of the following statement is incorrect?

    • Options
    • A. A default argument is checked for type at the time of declaration and evaluated at the time of call.
    • B. We can provide a default value to a particular argument in the middle of an argument list.
    • C. We cannot provide a default value to a particular argument in the middle of an argument list.
    • D. Default arguments are useful in situations where some arguments always have the same value.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment