Functions

Q1: Which of the following statement is correct about the program given below?
#include<iostream.h> 
class AptitudeCrack
{ 
    public:
    void Aptitude(int x = 15)
    {
        x = x/2; 
        if(x > 0)
            Aptitude(); 
        else
            cout<< x % 2; 
    } 
};
int main()
{
    AptitudeCrack objIB;
    objIB.Aptitude();
    return 0; 
}

A The program will display 1.

B The program will display 2.

C The program will display 15.

D The program will go into an infinite loop.

E The program will report error on compilation.

ANS:D - The program will go into an infinite loop.

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.