Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is the output of this code, given the following function definition? int x

ID: 3596226 • Letter: W

Question

What is the output of this code, given the following function definition?

int x =5, y = 3;

y = test (x, y);

cout << x;

int test (int &p, int t) //function definition

{

p = p * t;

return p + 1;

}

15

10

16

11

What is the value of b after the following function call?

int b = 3;

test (b); // function call

void test (int &val) //function definition

   {

      for (int c = 0; c < 2; c++)

      val += 2;

   }

13

7

3

15

What is the value of x after the following function call, given the function definition below?

int x;

aTest (3, x); // function call

void aTest (int a, int& b) // function definition

{

b = a * 3 + 1;

}

16

3

12

10

Given the function prototype and variable declarations, which of the following is avalid function call?

void compute (int, float&, char, int& ); // function prototype

int x, y; //variable declarations

float p, q;

char r, s;

compute (5, p + q, r, y);

compute (5, p, ‘c’ , y);

compute (x, 7.3, ‘c’, y);

compute (y, p, s, x + y);

15

10

16

11

Explanation / Answer

1. 15

2. 7

3. 10

4. compute (5, p + q, r, y);

Above are the answers after compiling the codes.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote