Functions

Q1: Which of the following statement is correct about the program given below?
#include<iostream.h> 
class AptitudeCrack
{
    int x; 
    float y; 
    public:
    AptitudeCrack(int x)
    {
        x = x;
    }
    AptitudeCrack(int p = 0, int q = 10)
    {
        x = p += 2; 
        y = q * 1.0f;
    }
    void SetValue(int &y, float z)
    {
        x = y;
        y = (int)z;
    }
    void Display(void)
    {
        cout<< x;
    }
};
int main()
{
    int val = 12; 
    AptitudeCrack objAptitude(val); 
    AptitudeCrack objTmp();
    objAptitude.SetValue(val, 3.14f); 
    objAptitude.Display(); 
    return 0; 
}

A The program will print the output 12.

B The program will not compile successfully.

C The program will report run time error.

D The program will print the output 2.

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

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.