Constructors and Destructors

Q1: Which of the following statement is correct about the program given below?
#include<iostream.h> 
class AptitudeCrack
{
    int x; 
    public:
        AptitudeCrack()
        {
           x = 0;
        }
        AptitudeCrack(int xx)
        {
            x = xx; 
        }
        AptitudeCrack(AptitudeCrack &objB)
        {
            x = objB.x; 
        }
        void Display()
        {
            cout<< x << ' ';
        }
};
int main()
{
    AptitudeCrack objA(25);
    AptitudeCrack objB(objA);
    AptitudeCrack objC = objA;
    objA.Display();
    objB.Display();
    objC.Display();
    return 0; 
}

A The program will print the output 25 25 25 .

B The program will print the output 25 Garbage 25 .

C The program will print the output Garbage 25 25 .

D The program will report compile time error.

ANS:A - The program will print the output 25 25 25 .

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.