logo

CuriousTab

CuriousTab

Discussion


Home C++ Programming Constructors and Destructors See What Others Are Saying!
  • Question
  • Which of the following are NOT provided by the compiler by default?


  • Options
  • A. Zero-argument Constructor
  • B. Destructor
  • C. Copy Constructor
  • D. Copy Destructor

  • Correct Answer
  • Copy Destructor 


  • More questions

    • 1. Which of the following statements is correct?

      1. Once the variable and the reference are linked they are tied together.
      2. Once the reference of a variable is declared another reference of that variable is not allowed.

    • 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 of the following header file includes definition of cin and cout?

    • Options
    • A. istream.h
    • B. ostream.h
    • C. iomanip.h
    • D. iostream.h
    • Discuss
    • 3. Which of the following statement is incorrect?

    • Options
    • A. Constructor is a member function of the class.
    • B. The compiler always provides a zero argument constructor.
    • C. It is necessary that a constructor in a class should always be public.
    • D. Both B and C.
    • Discuss
    • 4. If the programmer does not explicitly provide a destructor, then which of the following creates an empty destructor?

    • Options
    • A. Preprocessor
    • B. Compiler
    • C. Linker
    • D. main() function
    • Discuss
    • 5. Which of the following statement is correct about destructors?

    • Options
    • A. A destructor has void return type.
    • B. A destructor has integer return type.
    • C. A destructor has no return type.
    • D. A destructors return type is always same as that of main().
    • Discuss
    • 6. Which of the following problem causes an exception?

    • Options
    • A. Missing semicolon in statement in main().
    • B. A problem in calling function.
    • C. A syntax error.
    • D. A run-time error.
    • Discuss
    • 7. Which of the following statement will be correct if the function has three arguments passed to it?

    • Options
    • A. The trailing argument will be the default argument.
    • B. The first argument will be the default argument.
    • C. The middle argument will be the default argument.
    • D. All the argument will be the default argument.
    • Discuss
    • 8. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      static int b = 0; 
      void DisplayData(int *x, int *y = &b)
      {
          cout<< *x << " " << *y;
      }
      int main()
      {
          int a = 10, b = 20 ;
          DisplayData(&a, &b);
          return 0; 
      }

    • Options
    • A. The program will print the output 10 20.
    • B. The program will print the output 10 0.
    • C. The program will print the output 10 garbage.
    • D. The program will report compile time error.
    • Discuss
    • 9. Which of the following statement is correct about the program given below?
      #include<iostream.h> 
      static int Result;
      class India
      {
          public:
          void Change(int x = 10, int y = 20, int z = 30)
          {
              cout<< x + y + z;
          }
          void Display(int x = 40, float y = 50.00)
          {
              Result = x % x; 
              cout<< Result;
          }
      };
      class CuriousTab
      {
          int x, y; 
          public:
          void Change(int x, int y = 50)
          {
              cout<< x + y;
          }
      };
      class CuriousTab: public India, public CuriousTab
      {
          public:
          void Display(int x = 10, int xx = 100, int xxx = 1000)
          {
              Result = x + xx % x * x;
              cout<< Result ; 
          }
      };
      int main()
      {
          CuriousTab objCuriousTab;
          objCuriousTab.India::Display(10, 20.00);
          return 0; 
      }

    • Options
    • A. The program will print the output 0.
    • B. The program will print the output 10.
    • C. The program will print the output 30.
    • D. The program will print the output 40.
    • E. The program will report compile time error.
    • Discuss
    • 10. Which one of the following is the correct way to declare a pure virtual function?

    • Options
    • A. virtual void Display(void){0};
    • B. virtual void Display = 0;
    • C. virtual void Display(void) = 0;
    • D. void Display(void) = 0;
    • Discuss


    Comments

    There are no comments.

Enter a new Comment