20. What are two examples of valid function calls?
Answer: B,E
B) round_number(4.723, 2) and E) PrintSample()
Both round_number(4.723, 2) and PrintSample() are valid function calls, as they adhere to proper syntax and argument requirements in programming.
A) function Sample(float 2.0)
This option is incorrect because the syntax is not valid; function names cannot contain spaces, and "float 2.0" is not a properly formatted argument. Function calls must follow the correct parameter type declaration and cannot use a numeric literal directly in this manner.
B) round_number(4.723, 2)
This option is correct as it follows the standard function call format, which includes the function name followed by parentheses enclosing valid arguments. The arguments provided are a floating-point number and an integer, which are acceptable inputs for a rounding function.
C) GetHeight(Integer 3, integer 4)
This option is incorrect due to the improper syntax; the types "Integer" and "integer" should not be part of the function call. Function calls should only specify the function name and its arguments, without type declarations.
D) convert_value(12) returns cVal
This option is incorrect because it improperly mixes function call syntax with a return statement. A function call should not include a return value in the call itself; instead, the return value is handled within the function's definition.
E) PrintSample()
This option is correct as it demonstrates a valid function call with no arguments. It follows the correct syntax and does not contain any extraneous elements, making it a straightforward example of a function call.
F) CountFactors(96 integer)
This option is incorrect because it incorrectly includes the type declaration "integer" within the function call. A valid function call should consist solely of the function name followed by its arguments without type specifications.
Conclusion
The correct answer, consisting of round_number(4.723, 2) and PrintSample(), reflects valid function calls that conform to standard programming syntax. All other options fail due to improper syntax, misuse of argument types, or incorrect formatting, demonstrating the importance of adhering to function call conventions in programming.