Are the expressions arr and &arr same for an array of 10 integers?
[A].
[B].
Answer: Option B
Explanation:
Both mean two different things. arr gives the address of the first int, whereas the &arr gives the address of array of ints.
[B].
Answer: Option B
Explanation:
Both mean two different things. arr gives the address of the first int, whereas the &arr gives the address of array of ints.
#include
#include
class IndiaBix
{
char txtMsg[50];
public:
IndiaBix(char *str = NULL)
{
if(str != NULL)
strcpy(txtMsg, str);
}
int BixFunction(char ch);
};
int IndiaBix::BixFunction(char ch)
{
static int i = 0;
if(txtMsg[i++] == ch)
return strlen((txtMsg + i)) - i;
else
return BixFunction(ch);
}
int main()
{
IndiaBix objBix("Welcome to IndiaBix.com!");
cout<< objBix.BixFunction('t');
return 0;
}
[A].6
[B].8
[C].9
[D].15
Answer: Option A
class Bix
{
public:
static void MyFunction();
};
int main()
{
void(*ptr)() = &Bix::MyFunction;
return 0;
}
[A].The program reports an error as pointer to member function cannot be defined outside the definition of class.
[B].The program reports an error as pointer to static member function cannot be defined.
[C].The program reports an error as pointer to member function cannot be defined without object.
[D].The program reports linker error.
Answer: Option D
class Bike
{
Engine objEng;
};
class Engine
{
float CC;
};
[A].kind of relationship
[B].has a relationship
[C].Inheritance
[D].Both A and B
Answer: Option B
#include
class PowerFinder
{
public:
void Power(int x = 1, int y = 1)
{
int P = 1, i = 1;
while(++i <= y)
{
P *= x;
}
cout<< P << endl;
}
};
int main()
{
PowerFinder FP;
FP.Power(2, 6);
return 0;
}
[A].The program will print the output 12.
[B].The program will print the output 16.
[C].The program will print the output 32.
[D].The program will print the output 36.
Answer: Option C
[A]. Only II is correct.
[B]. Both I and II are correct.[C]. Only I is correct.
[D]. Both I and II are incorrect.
Answer: Option C
#include
class IndiaBix
{
int a, b, c;
public:
void SetValue(int x, int y ,int z)
{
a = x;
b = y;
c = z;
}
void Display()
{
cout<< a << " " << b << " " << c;
}
};
int main()
{
IndiaBix objBix;
int x = 2;
int &y = x;
y = 5;
objBix.SetValue(x, ++y, x + y);
objBix.Display();
return 0;
}
[A].The program will print the output 5 6 10.
[B].The program will print the output 6 6 10.
[C].The program will print the output 6 6 12.
[D].It will result in a compile time error.
Answer: Option B