Q.1

Which of the following statement is correct about the program given below?

#include<iostream.h> 
class Bix
{
      int x; 
    public:
      Bix();
     ~Bix();
      void Show() const;
};
Bix::Bix()
{
    x =}
void Bix::Show() const
{
    cout<< x;
}
int main()
{
    Bix objB;
    objB.Show();
    return
}
  • The program will print the output 25.
  • The program will print the output Garbage-value.
  • The program will report compile time error.
  • The program will report runtime error.
Q.2

What will be the output of the following program?

#include<iostream.h> 
class IndiaBix
{
    int x, y; 
    public:
    IndiaBix(int xx)
    {
        x = ++xx;
    } 
    ~IndiaBix()
    {
        cout<< x - 1 << " ";
    }
    void Display()
    {
        cout<< --x + 1 << " ";
    } 
};
int main()
{
    IndiaBix objBix(5);
    objBix.Display();
    int *p = (int*) &objBix;
    *p =    objBix.Display();
    return
}
  • 6 6 4
  • 6 6 5
  • 5 40 38
  • 6 40 38
  • 6 40 39
Q.3

What will be the output of the following program?

#include<iostream.h>
class BixBase
{   
    public:
    BixBase()
    {
        cout<< "Base OK. "; 
    }
    virtual ~BixBase()
    {
        cout<< "Base DEL. "; 
    }
};
class BixDerived: public BixBase
{
    public:
    BixDerived()
    { 
        cout<< "Derived OK. "; 
    }
    ~BixDerived()
    { 
        cout<< "Derived DEL. "; 
    }
};
int main()
{
    BixBase *basePtr = new BixDerived();
    delete basePtr;
    return}
  • Base OK. Derived OK.
  • Base OK. Derived OK. Base DEL.
  • Base OK. Derived OK. Derived DEL.
  • Base OK. Derived OK. Derived DEL. Base DEL.
  • Base OK. Derived OK. Base DEL. Derived DEL.
Q.4

What will be the out of the following program?

#include<iostream.h> 
class BixBase
{
    public:
    int x, y; 
    public:
    BixBase(int xx =int yy =    {
        x = xx;
        y = yy; 
    } 
 };
class BixDerived : public BixBase
{
    private:
        BixBase objBase; 
    public:
    BixDerived(int xx, int yy) : BixBase(xx), objBase(yy)
    {
        cout << this->x   << " " 
             << this->y   << " "  
             << objBase.x << " "
             << objBase.y << " ";
    } 
    ~BixDerived()
    { }
};
int main()
{
    BixDerived objDev(22); 
    return}
  • 11 22 0 0
  • 11 0 0 22
  • 11 0 22 0
  • 11 22 11 22
  • The program will report compile time error.
Q.5

Which of the following statement is correct about the program given below?

#include<iostream.h> 
class Bix
{
      int x; 
    public:
      Bix();
      void Show() const;
      ~Bix(){}
};
Bix::Bix()
{
    x =}
void Bix::Show() const
{
    cout<< x;
}
int main()
{
    Bix objB;
    objB.Show();
    return
}
  • The program will print the output 5.
  • The program will print the output Garbage-value.
  • The program will report compile time error.
  • The program will report runtime error.
Q.6

What is the technical word for the function ~IndiaBix() defined in the following program?

#include<iostream.h> 
class IndiaBix
{
    int x, y; 
    public:
    IndiaBix(int xx =int yy =)
    {
        x = xx; 
        y = yy;
    }
    void Display()
    {
        cout<< x << " " << y << endl;
    } 
    ~IndiaBix()
    { } 
};
int main()
{
    IndiaBix objBix; 
    objBix.Display(); 
    return}
  • Constructor
  • Destructor
  • Default Destructor
  • Function Template
Q.7

What will be the output of the following program?

#include<iostream.h> 
class BixBase
{
    public:
    int x, y;
    BixBase(int xx =int yy =    {
        x = ++xx; 
        y = --yy;
    }
    void Display()
    {
        cout<< --y;
    } 
    ~BixBase(){} 
};
class BixDerived : public BixBase
{
    public:
    void Increment()
    {
        y++;
    }
    void Display()
    {
        cout<< --y;
    } 
}; 
int main()
{
    BixDerived objBix;
    objBix.Increment();
    objBix.Display();
    return
}
  • 3
  • 4
  • 5
  • Garbage-value
  • The program will report compile time error.
Q.8

What will be the out of the following program?

#include<iostream.h> 
class BixBase
{
    public:
    int x, y; 
    public:
    BixBase(int xx =int yy =    {
        x = xx;
        y = yy; 
    } 
 };
class BixDerived : public BixBase
{
    private:
        BixBase objBase; 
    public:
    BixDerived(int xx, int yy) : BixBase(xx), objBase(yy)
    {
        cout << x          << " " 
             << this->x    << " "  
             << BixBase::x << " "     
             << this->objBase.x ;
    } 
    ~BixDerived()
    { }
};
int main()
{
    BixDerived objDev(22); 
    return}
  • 11 22 0 0
  • 11 11 0 22
  • 11 11 11 0
  • 11 11 11 22
  • The program will report compile time error.
Q.9

Which of the following statement is correct?

  • Destructor destroys only integer data members of the object.
  • Destructor destroys only float data members of the object.
  • Destructor destroys only pointer data members of the object.
  • Destructor destroys the complete object.
Q.10

What will be the output of the following program?

#include<iostream.h> 
int val =
class IndiaBix
{
    public: 
    IndiaBix()
    {
        cout<< ++val;
    }
    ~IndiaBix()
    {
        cout<< val--; 
    } 
}; 
int main()
{
    IndiaBix objBixobjBixobjBix    {
        IndiaBix objBix    } 
    return}
  • 1234
  • 4321
  • 12344321
  • 12341234
  • 43211234
Q.11

Which of the following statement is correct?

  • A constructor has the same name as the class in which it is present.
  • A constructor has a different name than the class in which it is present.
  • A constructor always returns an integer.
  • A constructor cannot be overloaded.
Q.12

A class's __________ is called when an object is destroyed.

  • constructor
  • destructor
  • assignment function
  • copy constructor
Q.13

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

  • logical
  • virtual
  • syntax
  • linker
Q.14

A function with the same name as the class, but preceded with a tilde character (~) is called __________ of that class.

  • constructor
  • destructor
  • function
  • object
Q.15

Which constructor function is designed to copy objects of the same class type?

  • Create constructor
  • Object constructor
  • Dynamic constructor
  • Copy constructor
Q.16

Which of the following gets called when an object is being created?

  • constructor
  • virtual function
  • destructor
  • main
Q.17

Which of the following implicitly creates a default constructor when the programmer does not explicitly define at least one constructor for a class?

  • Preprocessor
  • Linker
  • Loader
  • Compiler
Q.18

A destructor takes __________ arguments.

  • one
  • two
  • three
  • no
Q.19

Destructors __________ for automatic objects if the program terminates with a call to function exit or function abort.

  • are called
  • are inherited
  • are not called
  • are created
Q.20

If the programmer does not explicitly provide a destructor, then which of the following creates an empty destructor?

  • Preprocessor
  • Compiler
  • Linker
  • main() function
0 h : 0 m : 1 s