Q.1

Which of the following statement is correct?

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

A constructor that accepts __________ parameters is called the default constructor.

  • one
  • two
  • no
  • three
Q.3

Which of the following statement is correct?

  • Constructor has the same name as that of the class.
  • Destructor has the same name as that of the class with a tilde symbol at the beginning.
  • Both A and B.
  • Destructor has the same name as the first member function of the class.
Q.4

To ensure that every object in the array receives a destructor call, always delete memory allocated as an array with operator __________ .

  • destructor
  • delete
  • delete[]
  • kill[]
  • free[]
Q.5

Which of the following statement is correct about constructors?

  • A constructor has a return type.
  • A constructor cannot contain a function call.
  • A constructor has no return type.
  • A constructor has a void return type.
Q.6

Destructor calls are made in which order of the corresponding constructor calls?

  • Reverse order
  • Forward order
  • Depends on how the object is constructed
  • Depends on how many objects are constructed
Q.7

Which of the following statement is correct?

  • A constructor of a derived class can access any public and protected member of the base class.
  • Constructor cannot be inherited but the derived class can call them.
  • A constructor of a derived class cannot access any public and protected member of the base class.
  • Both A and B.
Q.8

A __________ is a constructor that either has no parameters, or if it has parameters, all the parameters have default values.

  • default constructor
  • copy constructor
  • Both A and B
  • None of these
Q.9

How many default constructors per class are possible?

  • Only one
  • Two
  • Three
  • Unlimited
Q.10

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

#include<iostream.h> 
class IndiaBix
{
    int *p; 
    public:
    IndiaBix(int xx, char ch)
    {
        p  = new int(); 
        *p = xx + int(ch); 
        cout<< *p;
    }
    ~IndiaBix() 
    {
        delete p;
    }
};
int main()
{
    IndiaBix objBix('B'); 
    return}
  • The program will print the output 76.
  • The program will print the output 108.
  • The program will print the output garbage value.
  • The program will report compile time error.
Q.11

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

#include<iostream.h> 
class IndiaBix
{
    int x; 
    public:
    IndiaBix(short ss)
    {
        cout<< "Short" << endl;
    }
    IndiaBix(int xx)
    {
        cout<< "Int" << endl;
    }
    IndiaBix(char ch)
    {
        cout<< "Char" << endl;
    }
    ~IndiaBix() 
    {
        cout<< "Final";
    }
};
int main()
{
    IndiaBix *ptr = new IndiaBix('B');
    return
}
  • The program will print the output Short .
  • The program will print the output Int .
  • The program will print the output Char .
  • The program will print the output Final .
  • None of the above
Q.12

What will be the out of the following program?

#include<iostream.h> 
class BixBase
{
    protected:
    int x, y; 
    public:
    BixBase(int xx =int yy =    {
        x = xx;
        y = yy; 
    } 
    void Show()
    {
        cout<< x * this->y << endl;
    }
};
class BixDerived
{
    private:
        BixBase objBase; 
    public:
    BixDerived(int xx, int yy) : objBase(xx, yy)
    {
        objBase.Show();
    } 
    ~BixDerived()
    { }
};
int main()
{
    BixDerived objDev(20); 
    return}
  • 0
  • 100
  • 200
  • 400
  • The program will report compile time error.
Q.13

What will be the output of the following program?

#include<iostream.h> 
class IndiaBix
{
    int x; 
    public:
    IndiaBix(int xx, float yy)
    {
        cout<< char(yy);
    } 
}; 
int main()
{
    IndiaBix *p = new IndiaBix(99.50f);
    return
}
  • 99
  • ASCII value of 99
  • Garbage value
  • 99.50
Q.14

Which of the following constructor is used in the program given below?

#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}
  • Copy constructor
  • Simple constructor
  • Non-parameterized constructor
  • Default constructor
Q.15

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

#include<iostream.h> 
class IndiaBix
{
    int x; 
    public:
    IndiaBix(short ss)
    {
        cout<< "Short" << endl;
    }
    IndiaBix(int xx)
    {
        cout<< "Int" << endl;
    }
    IndiaBix(float ff)
    {
        cout<< "Float" << endl;
    }
    ~IndiaBix() 
    {
        cout<< "Final";
    }
};
int main()
{
    IndiaBix *ptr = new IndiaBix('B');
    return
}
  • The program will print the output Short .
  • The program will print the output Int .
  • The program will print the output Float .
  • The program will print the output Final .
  • None of the above
Q.16

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

#include<iostream.h> 
class IndiaBix
{
    int x; 
    public:
        IndiaBix()
        {
           x =        }
        IndiaBix(int xx)
        {
            x = xx; 
        }
        IndiaBix(IndiaBix &objB)
        {
            x = objB.x; 
        }
        void Display()
        {
            cout<< x << " ";
        }
};
int main()
{
    IndiaBix objA(25);
    IndiaBix objB(objA);
    IndiaBix objC = objA;
    objA.Display();
    objB.Display();
    objC.Display();
    return
}
  • The program will print the output 25 25 25 .
  • The program will print the output 25 Garbage 25 .
  • The program will print the output Garbage 25 25 .
  • The program will report compile time error.
Q.17

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

#include<iostream.h> 
class IndiaBix
{
    public:
    IndiaBix()
    {
        cout<< "India";
    }
    ~IndiaBix()
    {
        cout<< "Bix";
    }
};
int main()
{
    IndiaBix objBix;
    return
}
  • The program will print the output India.
  • The program will print the output Bix.
  • The program will print the output IndiaBix.
  • The program will report compile time error.
Q.18

What will be the output of the following program?

#include<iostream.h>
class BixBase
{   
    public:
    BixBase()
    {
        cout<< "Base OK. "; 
    }
};
class BixDerived: public BixBase
{
    public:
    BixDerived()
    { 
        cout<< "Derived OK. "; 
    }
    ~BixDerived()
    { 
        cout<< "Derived DEL. "; 
    }
};
int main()
{
    BixBase    objB;
    BixDerived objD;
    objD.~BixDerived();
    return}
  • Base OK. Derived OK. Derived DEL.
  • Base OK. Base OK. Derived OK. Derived DEL.
  • Base OK. Derived OK. Derived DEL. Derived DEL.
  • Base OK. Base OK. Derived OK. Derived DEL. Derived DEL.
  • The program will report compile time error.
Q.19

What will be the output of the following program?

#include<iostream.h>
class BixBase
{   
    public:
    BixBase()
    {
        cout<< "Base OK. "; 
    }
    ~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.20

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

#include<iostream.h> 
class IndiaBix
{
    int x, y; 
    public:
        IndiaBix()
        {
            x =            y =
        }
        IndiaBix(int xx, int yy)
        {
            x = xx;
            y = yy; 
        }
        IndiaBix(IndiaBix *objB)
        {
            x = objB->x;
            y = objB->y; 
        }
        void Display()
        {
            cout<< x << " " << y;
        }
};
int main()
{
    IndiaBix objBix( new IndiaBix();
    objBix.Display();
    return
}
  • The program will print the output 0 0 .
  • The program will print the output 20 40 .
  • The program will print the output Garbage Garbage .
  • The program will report compile time error.
0 h : 0 m : 1 s