logo

CuriousTab

CuriousTab

Discussion


Home C++ Programming References See What Others Are Saying!
  • Question
  • Which of the following statement is correct about the program given below?
    #include<iostream.h> 
    enum xyz
    {
        a, b, c
    };
    int main() 
    {
        int x = a, y = b, z = c;
        int &p = x, &q = y, &r = z;
        p = ++x;
        q = ++y;
        r = ++c;
        cout<< p << q << r;
        return 0;
    }


  • Options
  • A. The program will print the output 1 2 3.
  • B. The program will print the output 2 3 4.
  • C. The program will print the output 0 1 2.
  • D. It will result in a compile time error.

  • Correct Answer
  • It will result in a compile time error. 


  • More questions

    • 1. 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
    • 2. 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
    • 3. 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
    • 4. 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
    • 5. 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
    • 6. Which of the following statements is correct when a class is inherited publicly?

    • Options
    • A. Public members of the base class become protected members of derived class.
    • B. Public members of the base class become private members of derived class.
    • C. Private members of the base class become protected members of derived class.
    • D. Public members of the base class become public members of derived class.
    • Discuss
    • 7. If the copy constructor receives its arguments by value, the copy constructor would

    • Options
    • A. call one-argument constructor of the class
    • B. work without any problem
    • C. call itself recursively
    • D. call zero-argument constructor
    • Discuss
    • 8. Why reference is not same as a pointer?

    • Options
    • A. A reference can never be null.
    • B. A reference once established cannot be changed.
    • C. Reference doesn't need an explicit dereferencing mechanism.
    • D. All of the above.
    • Discuss
    • 9. Which of the following statement is correct?

    • Options
    • A. Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.
    • B. A reference is indicated by using && operator.
    • C. Once a reference variable has been defined to refer to a particular variable it cannot refer to any other variable.
    • D. A reference can be declared beforehand and initialized later.
    • Discuss
    • 10. What will be the output of the following program?
      #include<iostream.h> 
      class CuriousTab
      {
          int Num; 
          public:
          CuriousTab(int x)
          {
              Num = x;
          }
          int CuriousTabFunction(void);
      };
      int CuriousTab::CuriousTabFunction(void)
      {
          static int Sum = 0; 
          int Dec;
          Dec = Num % 10; 
          Num = Num / 10; 
          if((Num / 100)) CuriousTabFunction(); 
          Sum  = Sum * 10 + Dec; 
          return Sum;
      }
      int main()
      {
          CuriousTab objCuriousTab(12345);
          cout<< objCuriousTab.CuriousTabFunction();
          return 0; 
      }

    • Options
    • A. 123
    • B. 321
    • C. 345
    • D. 12345
    • E. 54321
    • Discuss


    Comments

    There are no comments.

Enter a new Comment