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

Cpp Programming

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

Cpp Programming Quiz 154 – 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 IndiaBix
{
public:
void Bix(int x = 15)
{
x = x/2;
if(x > 0)
Bix();
else
cout<< x % 2; } }; int main() { IndiaBix objIB; objIB.Bix(); return 0; }

[A]. The program will display 1.
[B]. The program will display 2.
[C]. The program will display 15.
[D]. The program will go into an infinite loop. 

Answer: Option D

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

Cpp Programming, Functions

Cpp Programming Quiz 156 – 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 Matrix[3][3];
public:
BixArray()
{
for(int i = 0; i<3; i++) for(int j = 0; j < 3; j++) Matrix[j][i] = i + j; } void Display(void) { for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++) cout<< Matrix[j][i] << " "; } }; int main() { BixArray objBix; objBix.Display(); return 0; }

[A].The program will display the output 4 3 2 3 2 1 2 1 0.
[B].The program will display the output 0 1 2 1 2 3 2 3 4.
[C].The program will display the output 9 garbage values.
[D].The program will report error on compilation. 

Answer: Option B

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

Cpp Programming, Functions

Cpp Programming Quiz 157 – 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
#include
#include
class BixString
{
char txtName[20];
public:
BixString(char *txtTemp = NULL)
{
if(txtTemp != NULL)
strcpy(txtName, txtTemp);
}
void Display(void)
{
cout<

[A].Above program will display IndiaBIX 8.
[B].Above program will display IndiaBIX 9.
[C].Above program will display size of integer.
[D].Above program will display IndiaBIX and size of integer. 

Answer: Option B

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

Cpp Programming, Functions

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

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

#include
class AreaFinder
{
float l, b, h;
float result;
public:
AreaFinder(float hh = 0, float ll = 0, float bb = 0)
{
l = ll;
b = bb;
h = hh;
}
void Display(int ll)
{
if(l = 0)
result = 3.14f * h * h;
else
result = l * b;
cout<< result; } }; int main() { AreaFinder objAF(10, 10, 20); objAF.Display(0); return 0; }

[A].0
[B].314
[C].314.0000
[D].200.0000 

Answer: Option A

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

Cpp Programming, Functions

Cpp Programming Quiz 159 – 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 GetNumber(long int Number)
{
return --Number;
}
float GetNumber(int Number)
{
return ++Number;
}
int main()
{
int x = 20;
int y = 30;
cout<< GetNumber(x) << " "; cout<< GetNumber(y) ; return 0; }

[A].The program will print the output 19 31.
[B].The program will print the output 20 30.
[C].The program will print the output 21 31.
[D].The program will print the output 21 29. 

Answer: Option C

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

Cpp Programming, Functions

Cpp Programming Quiz 160 – 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
struct MyStructure
{
class MyClass
{
public:
void Display(int x, float y = 97.50, char ch = 'a')
{
cout<< x << " " << y << " " << ch; } }Cls; }Struc; int main() { Struc.Cls.Display(12, 'b'); return 0; }

[A].The program will print the output 12 97.50 b.
[B].The program will print the output 12 97.50 a.
[C].The program will print the output 12 98 a.
[D].The program will print the output 12 Garbage b. 

Answer: Option C

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

Cpp Programming, Functions