Question: Given this function definition int foo(int& x, int y) { int z = x + y; x = 0; y = 0; return z; }
-
Given this function definition int foo(int& x, int y) { int z = x + y; x = 0; y = 0; return z; } which of the following is NOT true?the return value of foo depends on the original values of x and y.
if we removed the assignments to x and y, the return value of foo would not be changed, only a side effect.
the variable passed as x will always be 0 after foo returns.
the variable passed as y will always be 0 after foo returns.
QUESTION 2
-
Given the definition: enum Month { JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, NOVEMBER, DECEMBER }; which of the following statements will cause a compile-time error?Month m = DECEMBER;
int m = 13; // m is a month!
Month m = 0;
Month m = 12;
QUESTION 3
-
If we run the following code, what is the value of x after it completes? int x = 0; do { x++; } while (x < 10);11
0
10
9
QUESTION 4
-
If we run the following code, what is the value of x after it completes? int x = 0; while (x < 10) { x++; }0
10
11
9
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
