Cpp Programming Quiz 134 – Constructor is executed when _____.
[B]. an object is used[C]. a class is declared
[D]. an object goes out of scope.
Answer: Option A
Answer: Option A
Answer: Option C
Answer: Option B
#include
const double BixConstant(const int, const int = 0);
int main()
{
const int c = 2 ;
cout<< BixConstant(c, 10)<< " ";
cout<< BixConstant(c, 20)<< endl;
return 0;
}
const double BixConstant(const int x, const int y)
{
return( (y + (y * x) * x % y) * 0.2);
}
[A].The program will print the output 2 4.
[B].The program will print the output 20 40.
[C].The program will print the output 10 20.
[D].The program will print the output 20 4.50.
Answer: Option A
Answer: Option D
#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
[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 A