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

Which of the following is NOT a valid function prototype? int sum(); void sum();

ID: 3596222 • Letter: W

Question

Which of the following is NOT a valid function prototype?

int sum();

void sum();

void sum(int);

int (int sum);

What is the value of x after the following code is executed, given the function definition that follows:

float x = fcall(3.0, 2); // code in mainfloat

fcall (float a, int b) // function definition

{

a = a + b;

return (a / b);

}

2.5

3.5

1

0.5

What is the output of the following code?

int m = 5, c = 0;

while (c < 100)

  {

m = m + 1;

}

cout << m;

105

An infinite loop

10005

5

int sum();

void sum();

void sum(int);

int (int sum);

Explanation / Answer

1.d) int (int sum); is not a valid function prototype because there is no function name

2. a) 2.5 is the answer. Because first a= a+b assigns 5.0 to a, then a/b gives 2.5

3. b) An infinite loop is the answer because c is initialized to 0 , but then in while loop it should be incremented or decrement for the break condition. Since there is no break condition in while loop. It results in infinite loop.

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