[B]. All global functions in the program.[C]. Any member function of that class.
[D]. Only public member functions of that class.
Answer: Option C
Answer: Option C
Answer: Option D
Answer: Option C
Answer: Option B
Answer: Option B
[D]. Friend
Answer: Option C
#include
const double BixConstant(const int, const int = 0);
int main()
{
const int c = 2 ;
cout<< BixConstant(c, 10)<< " ";
cout<< BixConstant(c, 20)<< endl;
return 0;
}
const double BixConstant(const int x, const int y)
{
return( (y + (y * x) * x % y) * 0.2);
}
[A].The program will print the output 2 4.
[B].The program will print the output 20 40.
[C].The program will print the output 10 20.
[D].The program will print the output 20 4.50.
Answer: Option A
#include
double BixFunction(double, double, double = 0, double = 0, double = 0);
int main()
{
double d = 2.3;
cout<< BixFunction(d, 7) << " ";
cout<< BixFunction(d, 7, 6) << endl;
return 0;
}
double BixFunction(double x, double p, double q, double r, double s)
{
return p +(q +(r + s * x)* x) * x;
}
[A].7 20
[B].7 19.8
[C].7 Garbage
[D].7 20.8
Answer: Option D
#include
class BaseCounter
{
protected:
long int count;
public:
void CountIt(int x, int y = 10, int z = 20)
{
count = 0;
cout<< x << " " << y << " " << z << endl;
}
BaseCounter()
{
count = 0;
}
BaseCounter(int x)
{
count = x ;
}
};
class DerivedCounter: public BaseCounter
{
public:
DerivedCounter()
{ }
DerivedCounter(int x): BaseCounter(x)
{ }
};
int main()
{
DerivedCounter objDC(30);
objDC.CountIt(40, 50);
return 0;
}
[A].30 10 20
[B].Garbage 10 20
[C].40 50 20
[D].20 40 50
Answer: Option C
#include
class BixArray
{
int array[3][3];
public:
BixArray(int arr[3][3] = NULL)
{
if(arr != NULL)
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++)
array[i][j] = i+j;
}
void Display(void)
{
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++)
cout<< array[i][j] << " ";
}
};
int main()
{
BixArray objBA;
objBA.Display();
return 0;
}
[A].The program will report error on compilation.
[B].The program will display 9 garbage values.
[C].The program will display NULL 9 times.
[D].The program will display 0 1 2 1 2 3 2 3 4.
Answer: Option B