Which statement will send the value generated by a function procedure, called CalculateTax, back to the calling code?

  1. Return Sales*0.08

  2. CalculateTax = Sales*0.08

  3. Return CalculateTax (Sales*0.08)

  4. Both a and b.

  5. All of the above.


Correct Option: D
Explanation:

To send the value generated by a function procedure back to the calling code, you need to use the "return" statement.

Option A) Return Sales*0.08 - This option is correct because it uses the "return" statement to send the value of Sales multiplied by 0.08 back to the calling code.

Option B) CalculateTax = Sales*0.08 - This option is incorrect because it assigns the value of Sales multiplied by 0.08 to the variable CalculateTax, but it does not send the value back to the calling code.

Option C) Return CalculateTax(Sales*0.08) - This option is incorrect because it tries to call the CalculateTax function recursively, which is not necessary and can lead to an infinite loop.

Option D) Both a and b - This option is correct because it includes both the correct options A and B.

Option E) All of the above - This option is incorrect because option C is incorrect.

Therefore, the correct answer is D) Both a and b.

Find more quizzes: