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

1. Which of the following is a valid function prototype for a function (named fe

ID: 3603111 • Letter: 1

Question

1. Which of the following is a valid function prototype for a function (named fee) that receives an integer first and a number with a decimal place second, then returns a number with a decimal place?

fee(int base, double rate);

int fee(int, double)

double fee(int base, double rate)

double fee(int, double);

2. Which of the following is a valid function header for a function (named fee) that receives an integer first and a number with a decimal place second, then returns a number with a decimal place?

fee(int base, double rate);

int fee(int base, double rate)

double fee(double base, int rate)

double fee(int base, double rate)

3. Which of the following instructs a function to return the contents of the stateTax variable to the main() function?

restore stateTax;

return stateTax

return to main(stateTax);

none of the above

4. If the statement netPay = calcNet(gross, taxes); passes the contents of the gross and taxes variables to the calcNet() function, the variables are said to be passed _____.

by address

by content

by reference

by value

fee(int base, double rate);

int fee(int, double)

double fee(int base, double rate)

double fee(int, double);

Explanation / Answer

1)

Prototype of a function will be like this,

Return type function name ( type of argument1,type of argument2……..)

Return type is double, so options c,d.

Argument name is not there in prototype, so just int, double.

Correct option is d, double fee(int,double)

2)

Return type is double, so options are c,d. and first argument type is int and second argument type is double. So, correct option is d.

3)

Correct option is b

4)

Correct option is d, passed by value