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 1 – 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 BixFunction(int m)
{
m *= m;
return((10)*(m /= m));
}
int main()
{
int c = 9, *d = &c, e;
int &z = e;
e = BixFunction(c-- % 3 ? ++*d :(*d *= *d));
z = z + e / 10;
cout<< c << " " << e;
return 0;
}

[A]. It will result in a compile time error.
[B].The program will print the output 64 9.
[C]. The program will print the output 64 10.
[D]. The program will print the output 64 11.

Answer: Option D

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

Cpp Programming, References

Cpp Programming Quiz 2 – 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 main()
{
int x = 10, y = 20;
int *ptr = &x;
int &ref = y;

*ptr++;
ref++;

cout<< x << " " << y; return 0; }

[A]. The program will print the output 10 20.
[B]. The program will print the output 10 21.
[C]. The program will print the output 11 20.
[D]. The program will print the output 11 21.
 
Answer: Option B

 

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

Cpp Programming, References

Cpp Programming Quiz 3 – What will be the output of the program given below?

Question: What will be the output of the program given below?

#include
class BixBase
{
int x;
public:
BixBase(int xx = 0)
{
x = xx;
}
void Display()
{
cout<< x ; } }; class BixDerived : public BixBase { int y; public: BixDerived(int yy = 0) { y = yy; } void Display() { cout<< y ; } }; int main() { BixBase objBase(10); BixBase &objRef = objBase; BixDerived objDev(20); objRef = objDev; objDev.Display(); return 0; }

[A].0
[B].10
[C].20
[D].Garbage-value 

Answer: Option C

Cpp Programming Quiz 3 – What will be the output of the program given below? Read More »

Cpp Programming, References

Cpp Programming Quiz 4 – 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 main()
{
int m = 2, n = 6;
int &x = m++;
int &y = n++;
m = x++;
x = m++;
n = y++;
y = n++;
cout<< m << " " << n; return 0; }

[A].The program will print output 3 7.
[B].The program will print output 4 8.
[C].The program will print output 5 9.
[D].The program will print output 6 10.

Answer: Option E

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

Cpp Programming, References

Cpp Programming Quiz 5 – 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 main()
{
int m = 2, n = 6;
int &x = m;
int &y = n;
m = x++;
x = m++;
n = y++;
y = n++;
cout<< m << " " << n; return 0; }

[A].The program will print output 2 6.
[B].The program will print output 3 7.
[C].The program will print output 4 8.
[D].The program will print output 5 9. 

Answer: Option C

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

Cpp Programming, References

Cpp Programming Quiz 6 – 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 main()
{
int x = 0;
int &y = x; y = 5;
while(x <= 5) { cout<< y++ << " "; x++; } cout<< x; return 0; }

[A].The program will print the output 5 6 7 8 9 10.
[B].The program will print the output 5 6 7 8 9 10 7.
[C].The program will print the output 5 7.
[D].It will result in a compile time error. 

Answer: Option C

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

Cpp Programming, References

Cpp Programming Quiz 7 – 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
{
int x, y;
public:
IndiaBix(int xx = 0, int yy = 0)
{
x = xx;
y = yy;
}
void Display()
{
cout<< x << " " << y; } IndiaBix operator +(IndiaBix z) { IndiaBix objTemp; objTemp.x = x + z.x; objTemp.y = y + z.y; return objTemp; } }; int main() { IndiaBix objBix1(90, 80); IndiaBix objBix2(10, 20); IndiaBix objSum; IndiaBix &objRef = objSum; objRef = objBix1 + objBix2; objRef.Display(); return 0; }

[A].It will result in a runtime error.
[B].It will result in a compile time error.
[C].The program will print the output 9 4.
[D].The program will print the output 100 100. 

Answer: Option D

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

Cpp Programming, References

Cpp Programming Quiz 8 – 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
{
int x, y;
public:
void SetValue(int &xx, int &yy)
{
x = xx++;
y = yy;
cout<< xx << " " << yy; } }; int main() { int x = 10; int &y = x; IndiaBix objBix; objBix.SetValue(x , y); return 0; }

[A].The program will print the output 10 10.
[B].The program will print the output 10 11.
[C].The program will print the output 11 10.
[D].The program will print the output 11 11. 

Answer: Option D

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

Cpp Programming, References

Cpp Programming Quiz 9 – 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
{
int x, y;
public:
void SetValue(int &xx, int &yy)
{
x = xx ++;
y = yy;
Display();
}
void Display()
{
cout<< x << " " << y; } }; int main() { int x = 10; int &y = x; IndiaBix objBix; objBix.SetValue(x , y); return 0; }

[A].The program will print the output 10 10.
[B].The program will print the output 10 11.
[C].The program will print the output 11 11.
[D].The program will print the output 11 10. 

Answer: Option B

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

Cpp Programming, References

Cpp Programming Quiz 10 – 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 i, j;
class IndiaBix
{
public:
IndiaBix(int x = 0, int y = 0)
{
i = x;
j = x;
Display();
}
void Display()
{
cout<< j <<" "; } }; int main() { IndiaBix objBix(10, 20); int &s = i; int &z = j; i++; cout<< s-- << " " << ++z; return 0; }

[A].The program will print the output 0 11 21.
[B].The program will print the output 10 11 11.
[C].The program will print the output 10 11 21.
[D].The program will print the output 10 11 12. 

Answer: Option B

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

Cpp Programming, References