logo

CuriousTab

CuriousTab

Discussion


Home C++ Programming References See What Others Are Saying!
  • Question
  • Reference is like a _____.


  • Options
  • A. Pointer
  • B. Structure
  • C. Macro
  • D. Enum

  • Correct Answer
  • Pointer 


  • More questions

    • 1. In which of the following a virtual call is resolved at the time of compilation?

    • Options
    • A. From inside the destructor.
    • B. From inside the constructor.
    • C. From inside the main().
    • D. Both A and B.
    • Discuss
    • 2. Which of the following statement is correct?

    • Options
    • A. Overloaded functions can have at most one default argument.
    • B. An overloaded function cannot have default argument.
    • C. All arguments of an overloaded function can be default.
    • D. A function if overloaded more than once cannot have default argument.
    • Discuss
    • 3. What will be the output of the following program?
      #include<iostream.h> 
      class Base
      {
          int x, y; 
          public:
          Base() 
          {
              x = y = 0; 
          } 
          Base(int xx)
          {
              x = xx;
          }
          Base(int p, int q = 10)
          {
              x = p + q;
              y = q; 
          } 
          void Display(void)
          {
              cout<< x << " " << y << endl;
          } 
      }objDefault(1, 1);
      
      class Derived: public Base
      {
          Base obj; 
          public:
          Derived(int xx, int yy): Base(xx, xx + 1)
          { }
          Derived(Base objB = objDefault)
          { } 
      }; 
      int main()
      {
          Derived objD(5, 3);
          Derived *ptrD = new Derived(objD);
          ptrD->Display();
          delete ptrD;
          return 0; 
      }

    • Options
    • A. 3 2
    • B. 8 3
    • C. 11 6
    • D. 11 10
    • E. The program will not compile successfully.
    • Discuss
    • 4. Which of the following statements is correct?

      1. We can return a global variable by reference.
      2. We cannot return a local variable by 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.
    • Discuss
    • 5. Which of the following constructor is used in the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          int x, y; 
          public:
          CuriousTab(int xx = 10, int yy = 20 )
          {
              x = xx; 
              y = yy;
          }
          void Display()
          {
              cout<< x << " " << y << endl;
          } 
          ~CuriousTab()
          { } 
      };
      int main()
      {
          CuriousTab objCuriousTab; 
          objCuriousTab.Display(); 
          return 0;
      }

    • Options
    • A. Copy constructor
    • B. Simple constructor
    • C. Non-parameterized constructor
    • D. Default constructor
    • Discuss
    • 6. What will be the output of the following program?
      #include<iostream.h> 
      class CuriousTabBase
      {
          public:
              float x; 
      }; 
      class CuriousTabDerived : public CuriousTabBase
      {
          public: 
              char ch; 
              void Process()
              {
                  ch = (int)((x=12.0)/3.0);
              }
              void Display()
              {
                  cout<< (int)ch;
              } 
      }; 
      int main()
      {
          class CuriousTabDerived  *objDev = new CuriousTabDerived;
          objDev->Process();
          objDev->Display();
          return 0; 
      }

    • Options
    • A. The program will print the output 4.
    • B. The program will print the ASCII value of 4.
    • C. The program will print the output 0.
    • D. The program will print the output garbage.
    • Discuss
    • 7. Which of the following statement is correct?

    • Options
    • A. C++ allows static type checking.
    • B. C++ allows dynamic type checking.
    • C. C++ allows static member function be of type const.
    • D. Both A and B.
    • Discuss
    • 8. How many default constructors per class are possible?

    • Options
    • A. Only one
    • B. Two
    • C. Three
    • D. Unlimited
    • Discuss
    • 9. Which of the following function declaration is/are incorrect?

    • Options
    • A. int Sum(int a, int b = 2, int c = 3);
    • B. int Sum(int a = 5, int b);
    • C. int Sum(int a = 0, int b, int c = 3);
    • D. Both B and C are incorrect.
    • E. All are correct.
    • Discuss
    • 10. Which of the following statements is correct in C++?

    • Options
    • A. Classes cannot have data as protected members.
    • B. Structures can have functions as members.
    • C. Class members are public by default.
    • D. Structure members are private by default.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment