Question: Given this function definition int foo(int& x, int y) { int z = x + y; x = 0; y = 0; return z; }

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

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

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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!