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 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

Cpp Programming Quiz 18 – 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, int &yy)
{
x = xx;
y = yy;
Display();
}
void Display()
{
cout<< x << " " << y; } }; int main() { int x1 = 10; int &p = x1; int y1 = 20; int &q = y1; IndiaBix objBix(p, q); return 0; }

[A].It will result in a compile time error.
[B].The program will print the output 10 20.
[C].The program will print two garbage values.
[D].The program will print the address of variable x1 and y1. 

Answer: Option B

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

Cpp Programming, References

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

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

#include
enum xyz
{
a, b, c
};
int main()
{
int x = a, y = b, z = c;
int &p = x, &q = y, &r = z;
p = z;
p = ++q;
q = ++p;
z = ++q + p++;
cout<< p << " " << q << " " << z; return 0; }

[A].2 3 6
[B].4 4 7
[C].4 5 8
[D].3 4 6 

Answer: Option B

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

Cpp Programming, References

Cpp Programming Quiz 20 – 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 xyz
{
a, b, c
};
int main()
{
int x = a, y = b, z = c;
int &p = x, &q = y, &r = z;
p = ++x;
q = ++y;
r = ++c;
cout<< p << q << r; return 0; }

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

Answer: Option D

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

Cpp Programming, References