Constructors and Destructors

Q1: Which of the following statement is correct about the program given below?
#include<iostream.h> 
class AptitudeCrack
{
    int x, y; 
    public:
        AptitudeCrack()
        {
            x = 0;
            y = 0; 
        }
        AptitudeCrack(int xx, int yy)
        {
            x = xx;
            y = yy; 
        }
        AptitudeCrack(AptitudeCrack *objB)
        {
            x = objB->x;
            y = objB->y; 
        }
        void Display()
        {
            cout<< x << ' ' << y;
        }
};
int main()
{
    AptitudeCrack objAptitude( new AptitudeCrack(20, 40) );
    objAptitude.Display();
    return 0; 
}

A The program will print the output 0 0 .

B The program will print the output 20 40 .

C The program will print the output Garbage Garbage .

D The program will report compile time error.

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

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.