Comprehensive and Detailed Explanation From Exact Extract:
A function that calculates the average of two numbers (x and y) needs to take those numbers as inputs (parameters) and return their average as the output. According to foundational programming principles (e.g., Certiport Scripting and Programming Foundations Study Guide), functions should accept necessary inputs and return computed results, avoiding unnecessary parameters or outputs.
Option A: "Parameters: x, y, average; Return value: none." This is incorrect. Including average as a parameter is unnecessary since it is the result to be computed. A function with no return value (void in C) would not provide the average to the caller, which defeats the purpose.
Option B: "Parameters: x, y; Return value: average." This is correct. The function needs x and y as inputs to compute (x + y) / 2. The average is returned to the caller. For example, in Python: def average(x, y): return (x + y) / 2.
Option C: "Parameters: none; Return values: x, y." This is incorrect. Without parameters, the function cannot access x and y to compute the average. Returning x and y is irrelevant to the task.
Option D: "Parameters: average; Return values: x, y." This is incorrect. average is the output, not an input, and returning x and y does not provide the computed average.
Certiport Scripting and Programming Foundations Study Guide (Section on Functions).
Python Documentation: “Defining Functions” (https://docs.python.org/3/tutorial/controlflow.html#defining-functions).
W3Schools: “C Functions” (https://www.w3schools.com/c/c_functions.php).