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

Cpp Programming Quiz 21 – 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 Bix
{
int x, y;
public:
Bix(int x, int y)
{
this->x = x;
this->y = y;
}
void Display()
{
cout<< x << " " << y; } }; int main() { int x = 50; int &y = x ; Bix b(y, x); return 0; }

[A].The program will print the output 50 50.
[B].The program will print the two garbage values.
[C].It will result in a compile time error.
[D].The program will print nothing. 

Answer: Option D

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

Cpp Programming, References

Cpp Programming Quiz 22 – 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 = 25;
y = 50;
cout<< x << " " << --y; return 0; }

[A].The program will print the output 25 49.
[B].It will result in a compile time error.
[C].The program will print the output 50 50.
[D].The program will print the output 49 49. 

Answer: Option D

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

Cpp Programming, References

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

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

Answer: Option A

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

Cpp Programming, References

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

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

Answer: Option D

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

Cpp Programming, References

Cpp Programming Quiz 25 – 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 Bix
{
short n;
};
int main()
{
Bix b;
Bix& rb = b;
b.n = 5;
cout << b.n << " " << rb.n << " "; rb.n = 8; cout << b.n << " " << rb.n; return 0; }

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

Answer: Option C

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

Cpp Programming, References

Cpp Programming Quiz 26 – Which of the following statements is correct?

Question: Which of the following statements is correct?
  1. Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.
  2. A reference is not a constant pointer.

[A].Only 1 is correct.
[B].Only 2 is correct.[C].Both 1 and 2 are correct.
[D].Both 1 and 2 are incorrect.

Answer: Option D

Cpp Programming Quiz 26 – Which of the following statements is correct? Read More »

Cpp Programming, References

Cpp Programming Quiz 27 – Which of the following statements is correct?

Question: Which of the following statements is correct?
  1. An array of references is acceptable.
  2. We can also create a reference to a reference.

[A].
Only 1 is correct.
[B].Only 2 is correct.
[C].

Both 1 and 2 are correct.
[D].

Both 1 and 2 are incorrect.

Answer: Option D

Explanation:

No answer description available for this question.

Cpp Programming Quiz 27 – Which of the following statements is correct? Read More »

Cpp Programming, References