Cpp Programming Quiz 218 – What will be the output of the following program?
[A].
3
[B].4
[C].
5
[D].
Garbage-value
Answer: Option B
Explanation:
No answer description available for this question.
5
[D].
Garbage-value
Answer: Option B
Explanation:
No answer description available for this question.
#include
class BixData
{
int x, y, z;
public:
BixData(int xx, int yy, int zz)
{
x = ++xx;
y = ++yy;
z = ++zz;
}
void Show()
{
cout<< "" << x++ << " " << y++ << " " << z++;
}
};
int main()
{
BixData objData(1, 2, 3);
objData.Show();
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 4 5 6.
[D].The program will report compile time error.
Answer: Option B
A constructor cannot contain a function call.
[C].
A constructor has no return type.
[D].
A constructor has a void return type.
Answer: Option C
Explanation:
No answer description available for this question.
Answer: Option D
[B].
Answer: Option B
Explanation:
Both mean two different things. arr gives the address of the first int, whereas the &arr gives the address of array of ints.
#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
Answer: Option B