Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

Functions

Cpp Programming Quiz 144 – Which of the following statement is correct about the program given below?

Question: Which of the following statement is correct about the program given below?

#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

Cpp Programming Quiz 144 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 145 – What will be the output of the following program?

Question: What will be the output of the following program?

#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

Cpp Programming Quiz 145 – What will be the output of the following program? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 146 – What will be the output of the following program?

Question: What will be the output of the following program?

#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

Cpp Programming Quiz 146 – What will be the output of the following program? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 147 – Which of the following statement is correct about the program given below?

Question: Which of the following statement is correct about the program given below?

#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

Cpp Programming Quiz 147 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 148 – What will be the output of the following program?

Question: What will be the output of the following program?

#include
class TestDrive
{
int x;
public:
TestDrive(int xx)
{
x = xx;
}
int DriveIt(void);
};
int TestDrive::DriveIt(void)
{
static int value = 0;
int m;
m = x % 2;
x = x / 2;
if((x / 2)) DriveIt();
value = value + m * 10;
return value;
}
int main()
{
TestDrive TD(1234);
cout<< TD.DriveIt() * 10 << endl; return 0; }

[A].300
[B].200
[C].Garbage value
[D].400

Answer: Option D

Cpp Programming Quiz 148 – What will be the output of the following program? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 149 – Which of the following statement is correct about the program given below?

Question: Which of the following statement is correct about the program given below?

#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

Cpp Programming Quiz 149 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 150 – Which of the following statement is correct about the program given below?

Question: Which of the following statement is correct about the program given below?

#include
void Tester(int xx, int yy = 5);
class IndiaBix
{
int x;
int y;
public:
void Tester(int xx, int yy = 5)
{
x = xx;
y = yy;
cout<< ++x % --y; } }; int main() { IndiaBix objBix; objBix.Tester(5, 5); return 0; }

[A].The program will print the output 0.
[B].The program will print the output 1.
[C].The program will print the output 2.
[D].The program will print the output garbage value.

Answer: Option C

Cpp Programming Quiz 150 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 151 – Which of the following statement is correct about the program given below?

Question: Which of the following statement is correct about the program given below?

#include
int BixTest(int x, int y);
int BixTest(int x, int y, int z = 5);
int main()
{
cout<< BixTest(2, 4) << endl; return 0; } int BixTest(int x, int y) { return x * y; } int BixTest(int x, int y, int z = 5) { return x * y * z; }

[A].The program will print the output 5.
[B].The program will print the output 8.
[C].The program will print the output 40.
[D].The program will report compile time error. 

Answer: Option D

Cpp Programming Quiz 151 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 152 – What will be the output of the following program?

Question: What will be the output of the following program?

#include
class IndiaBix
{
public:
int x, y;
IndiaBix(int xx = 10, int yy = 20)
{
x = xx;
y = yy;
}
void Exchange(int *, int *);
};
int main()
{
IndiaBix objA(30, 40);
IndiaBix objB(50);
objA.Exchange(&objA.x, &objB.y);
cout<< objA.x << " " << objB.y << endl; return 0; } void IndiaBix::Exchange(int *x, int *y) { int t; t = *x; *x = *y; *y = t ; }

[A].20 10
[B].30 20
[C].20 30
[D].30 40 

Answer: Option C

Cpp Programming Quiz 152 – What will be the output of the following program? Read More »

Cpp Programming, Functions

Cpp Programming Quiz 153 – Which of the following statement is correct about the program given below?

Question: Which of the following statement is correct about the program given below?

#include
long FactFinder(long = 5);
int main()
{
for(int i = 0; i<= 0; i++) cout<< FactFinder() << endl; return 0; } long FactFinder(long x) { if(x < 2) return 1; long fact = 1; for(long i = 1; i <= x-1; i++) fact = fact * i; return fact; }

[A].The program will print the output 1.
[B].The program will print the output 24.
[C].The program will print the output 120.
[D].The program will print the output garbage value. 

Answer: Option B

Cpp Programming Quiz 153 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Functions