Functions

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

A 8

B 9

C 6

D 16

E 15


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.