logo

CuriousTab

CuriousTab

Discussion


Home C++ Programming Constructors and Destructors See What Others Are Saying!
  • Question
  • Can a class have virtual destructor?


  • Options
  • A. Yes
  • B. No

  • Correct Answer
  • Yes 


  • More questions

    • 1. 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.
    • Discuss
    • 2. Which one of the following options is correct about the statement given below? The compiler checks the type of reference in the object and not the type of object.

    • Options
    • A. Inheritance
    • B. Polymorphism
    • C. Abstraction
    • D. Encapsulation
    • Discuss
    • 3. What will be the output of the following program?
      #include<iostream.h> 
      class Tab
      {
          int x, y; 
          public:
          void show(void);
          void main(void);
      };
      void Tab::show(void)
      { 
          Tab b;
          b.x = 2;
          b.y = 4;
          cout<< x << " " << y;
      }
      void Tab::main(void)
      {
          Tab b;
          b.x = 6; 
          b.y = 8;
          b.show();
      }
      int main(int argc, char *argv[])
      {
          Tab run;
          run.main();
          return 0; 
      }

    • Options
    • A. 2 4
    • B. 6 8
    • C. The program will report error on Compilation.
    • D. The program will report error on Linking.
    • E. The program will report error on Run-time.
    • Discuss
    • 4. A reference is declared using the _____ symbol.

    • Options
    • A. &&
    • B. &
    • C. ||
    • D. !
    • Discuss
    • 5. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          int x; 
          float y; 
          public:
          void CuriousTabFunction(int = 0, float = 0.00f, char = 'A');
          void CuriousTabFunction(float, int = 10.00, char = 'Z');
          void CuriousTabFunction(char, char, char);
      };
      int main()
      {
          CuriousTab objCuriousTab;
          objCuriousTab.CuriousTabFunction(10 * 1.0, int(56.0)); 
          return 0;
      }
      void CuriousTab::CuriousTabFunction(int xx, float yy, char zz)
      {
          x = xx + int(yy);
          cout<< "x = " << x << endl;
      }
      void CuriousTab::CuriousTabFunction(float xx, int yy, char zz)
      {
          x = zz + zz;
          y = xx + yy;
          cout<< " x = " << x << endl;
      }
      void CuriousTab::CuriousTabFunction(char xx, char yy, char zz)
      {
          x = xx + yy + zz; 
          y = float(xx * 2); 
          cout<< " x = " << x << endl;
      }

    • Options
    • A. The program will print the output x = 65.
    • B. The program will print the output x = 66.
    • C. The program will print the output x = 130.
    • D. The program will print the output x = 180.
    • E. The program will not compile successfully.
    • Discuss
    • 6. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class CuriousTab
      {
          int x, y; 
          public:
              CuriousTab()
              {
                  x = 0;
                  y = 0; 
              }
              CuriousTab(int xx, int yy)
              {
                  x = xx;
                  y = yy; 
              }
              CuriousTab(CuriousTab *objB)
              {
                  x = objB->x;
                  y = objB->y; 
              }
              void Display()
              {
                  cout<< x << " " << y;
              }
      };
      int main()
      {
          CuriousTab objCuriousTab( new CuriousTab(20, 40) );
          objCuriousTab.Display();
          return 0; 
      }

    • Options
    • A. The program will print the output 0 0 .
    • B. The program will print the output 20 40 .
    • C. The program will print the output Garbage Garbage .
    • D. The program will report compile time error.
    • Discuss
    • 7. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      class Tab
      {
          int x, y; 
          public:
          Tab(int x, int y)
          {
              this->x = x;
              this->y = y;
          }
          void Display()
          {
              cout<< x << " " << y;
          }
      };
      int main()
      {
          int x = 50;
          int &y = x ;
          Tab b(y, x);
          return 0; 
      }

    • Options
    • A. The program will print the output 50 50.
    • B. The program will print the two garbage values.
    • C. It will result in a compile time error.
    • D. The program will print nothing.
    • Discuss
    • 8. Which of the following never requires any arguments?

    • Options
    • A. Member function
    • B. Friend function
    • C. Default constructor
    • D. const function
    • Discuss
    • 9. 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.
    • Discuss
    • 10. Which of the following correctly describes overloading of functions?

    • Options
    • A. Virtual polymorphism
    • B. Transient polymorphism
    • C. Ad-hoc polymorphism
    • D. Pseudo polymorphism
    • Discuss


    Comments

    There are no comments.

Enter a new Comment