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

C++ Programming

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

Cpp Programming Quiz 11 -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
enum bix
{
a=1, b, c
};
int main()
{
int x = c;
int &y = x;
int &z = x;
y = b;
cout<< z--; return 0; }

[A].It will result in a compile time error.
[B].The program will print the output 1.
[C].The program will print the output 2.
[D].The program will print the output 3. 

Answer: Option C

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

Cpp Programming, References

Cpp Programming Quiz 12 – 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 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

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

Cpp Programming, References

Cpp Programming Quiz 13 – 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 &a, int &b)
{
a = 100;
x = a;
y = b;
Display();
}
void Display()
{
cout<< x << " " << y; } }; int main() { int x = 10; IndiaBix objBix; objBix.SetValue(x, x); return 0; }

[A].The program will print the output 100 10.
[B].The program will print the output 100 100.
[C].The program will print the output 100 garbage.
[D].The program will print two garbage values. 

Answer: Option B

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

Cpp Programming, References

Cpp Programming Quiz 14 – 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;
int &y = x;
x++;
cout<< x << " " << y++; return 0; }

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

Answer: Option B

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

Cpp Programming, References

Cpp Programming Quiz 15 – 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 arr[] = {1, 2 ,3, 4, 5};
int &zarr = arr;
for(int i = 0; i <= 4; i++) { arr[i] += arr[i]; } for(i = 0; i <= 4; i++) cout<< zarr[i]; return 0; }

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

Answer: Option D

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

Cpp Programming, References

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

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

#include
class BixTest
{
public:
BixTest(int &x, int &y)
{
x++;
y++;
}
};
int main()
{
int a = 10, b = 20;
BixTest objBT(a, b);
cout<< a << " " << b; return 0; }

[A].10 20
[B].11 21
[C].Garbage Garbage
[D].It will result in a compile time error. 

Answer: Option B

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

Cpp Programming, References

Cpp Programming Quiz 17- 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 x, y;
class BixTest
{
public:
BixTest(int xx = 0, int yy = 0)
{
x = xx;
y = yy;
Display();
}
void Display()
{
cout<< x << " " << y << " "; } }; int main() { BixTest objBT(10, 20); int &rx = x; int &ry = y; ry = x; rx = y; cout<< rx--; return 0; }

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

Answer: Option B

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

Cpp Programming, References