References

Q1: Which of the following statement is correct about the program given below?
#include<iostream.h> 
class AptitudeCrack
{
    int x, y; 
    public:
    AptitudeCrack(int xx = 0, int yy = 0)
    {
        x = xx; 
        y = yy;
    }
    void Display()
    {
        cout<< x << ' ' << y;
    }
    AptitudeCrack operator +(AptitudeCrack z)
    {
        AptitudeCrack objTemp;
        objTemp.x = x + z.x;
        objTemp.y = y + z.y;
        return objTemp; 
    }
};
int main()
{
    AptitudeCrack objAptitude1(90, 80); 
    AptitudeCrack objAptitude2(10, 20); 
    AptitudeCrack objSum; 
    AptitudeCrack &objRef = objSum; 
    objRef = objAptitude1 + objAptitude2; 
    objRef.Display(); 
    return 0; 
}

A The program will print the output 100 100.

B The program will print the output 9 4.

C It will result in a runtime error.

D It will result in a compile time error.

ANS:A - It will result in a runtime error.

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.