Objects and Classes

Q1:
What will be the output of the following program?
#include<iostream.h>
#include<string.h> 
class AptitudeCrack
{
    char str[50]; 
    char tmp[50]; 
    public:
    AptitudeCrack(char *s)
    {
        strcpy(str, s);
    }
    int AptitudeFunction()
    {
        int i = 0, j = 0; 
        while(*(str + i))
        {
            if(*(str + i++) == ' ')
                *(tmp + j++) = *(str + i);
        }
        *(tmp + j) = 0; 
        return strlen(tmp); 
    }
};
int main()
{
    char txt[] = "Welcome to AptitudeCrack.com!";
    AptitudeCrack objAptitude(txt); 
    cout<< objAptitude.AptitudeFunction();
    return 0;
}

A 1

B 2

C 24

D 25

ANS:B - 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.