[Solved]1 Error Following Function Definition Int Findmax Int First Second Int Max 0 First Second Q37224296
1.What is the error in the following function definition?
int find_max(int first, second){ int max = 0; if (first > second) { max = first; } else { max = second; } return max;}
The function returns the minimum instead of the maximum of thetwo parameters.
The function does not return a value.
The function returns 0 if the first and second parameters areequal.
The function does not specify a type for the secondparameter.
2.What is the problem with the code snippet below?
void cost(int price, int reps){ for (int i = 0; i < reps; i++) { cout << price; } return;}int main(){ cout << cost(10, 4) << endl; return 0;}
The function cost is invoked with the wrong parameters.
The function cost uses uninitialized variables.
The function cost returns void and therefore cannot be used in acout statement.
The function cost must return an integer value.
3.What, if anything, is syntactically wrong with the followingfunction definition?
int sign(int x) { if (x < 0) return -1; else if (x > 0) return 1; }
It should have a double argument, not an int.
If x == 0, neither return statement is executed.
The if() statement needs braces {}.
The code has no syntax errors.
4.Which of the following function declarations would beappropriate for a function that updates the largest parameter, ifthe value of the current parameter is greater than largest?
The function body is shown here:
if (largest < current){ largest = current;}
void update_largest(int& largest, int current)
void update_largest(int largest, int current)
void update_largest(int largest, int& current)
void update_largest(int& largest, int& current)
Expert Answer
Answer to 1.What is the error in the following function definition? int find_max(int first, second) { int max = 0; if (first > sec… . . .
OR

