logo

CuriousTab

CuriousTab

Discussion


Home C++ Programming OOPS Concepts See What Others Are Saying!
  • Question
  • Which of the following is used to make an abstract class?


  • Options
  • A. Declaring it abstract using static keyword.
  • B. Declaring it abstract using virtual keyword.
  • C. Making at least one member function as virtual function.
  • D. Making at least one member function as pure virtual function.

  • Correct Answer
  • Making at least one member function as pure virtual function. 


  • More questions

    • 1. It is a __________ error to pass arguments to a destructor.

    • Options
    • A. logical
    • B. virtual
    • C. syntax
    • D. linker
    • Discuss
    • 2. Which of the following statement is correct whenever an object goes out of scope?

    • Options
    • A. The default constructor of the object is called.
    • B. The parameterized destructor is called.
    • C. The default destructor of the object is called.
    • D. None of the above.
    • Discuss
    • 3. Which of the following statements is correct about the constructors and destructors?

    • Options
    • A. Destructors can take arguments but constructors cannot.
    • B. Constructors can take arguments but destructors cannot.
    • C. Destructors can be overloaded but constructors cannot be overloaded.
    • D. Constructors and destructors can both return a value.
    • Discuss
    • 4. Which of the following statement is correct about the program given below?
      #include<iostream> 
      enum curioustab
      {
          a=1, b, c
      };
      int main()
      {
          int x = c;
          int &y = x;
          int &z = x;
          y = b;
          std::cout<< z--;
          return 0; 
      }

    • Options
    • A. It will result in a compile time error.
    • B. The program will print the output 1.
    • C. The program will print the output 2.
    • D. The program will print the output 3.
    • Discuss
    • 5. 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
    • 6. 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
    • 7. 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
    • 8. Which of the following keyword is used to overload an operator?

    • Options
    • A. overload
    • B. operator
    • C. friend
    • D. override
    • Discuss
    • 9. 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
    • 10. 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


    Comments

    There are no comments.

Enter a new Comment