Functions

Q1: What will be the output of the following program?
#include<iostream.h> 
class TestDrive
{
    int x; 
    public:
    TestDrive(int xx)
    {
        x = xx;
    }
    int DriveIt(void);
};
int TestDrive::DriveIt(void)
{
    static int value = 0;
    int m;
    m = x % 2;
    x = x / 2;
    if((x / 2)) DriveIt(); 
    value = value + m * 10; 
    return value;
}
int main()
{
    TestDrive TD(1234);
    cout<< TD.DriveIt() * 10 << endl;
    return 0; 
}

A 300

B 200

C Garbage value

D 400

ANS:A - 300

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.