MCQOPTIONS
Saved Bookmarks
| 1. |
What is the output of following program? #include <iostream> using namespace std; int max(int& x, int& y, int& z) { if (x > y && y > z) { y++; z++; return x++; } else { if (y > x) return y++; else return z++; } } int main() { int A, B; int a = 10, b = 13, c = 8; A = max(a, b, c); cout << a++ << " " << b-- << " " << ++c << endl; B = max(a, b, c); cout << ++A << " " << --B << " " << c++ << endl; return 0; } |
| A. | 10 14 8 or 14 13 8 |
| B. | 10 13 8 or 11 14 9 |
| C. | 10 14 9 or 14 12 9 |
| D. | 11 12 8 or 13 14 8 |
| Answer» D. 11 12 8 or 13 14 8 | |