17. A function calculates the lowest room rate for a hotel stay from a list of available hotel rates. What should be the input to the function?
Answer: B
The input to the function should be an array of hotel rates.
To calculate the lowest room rate for a hotel stay, the function requires an array of hotel rates as its input. This array allows the function to evaluate all available rates and determine the minimum value.
A) Lowest rate
This option is incorrect because "lowest rate" does not provide the necessary data for the function to process. The function needs a collection of rates to identify the lowest one, rather than a specific rate that may already be known.
B) Array of hotel rates
This is the correct option as it represents a collection of all available hotel rates. By using an array, the function can iterate through the rates and find the minimum value effectively.
C) Number of hotels
While the number of hotels may offer some context, it does not serve as an input that allows the function to calculate the lowest rate. The function requires actual rate values to perform its calculation, not just a count of how many hotels there are.
D) Desired rate
This option is not suitable because the desired rate is subjective and does not reflect the available hotel rates. The function is intended to find the lowest rate among the options provided, making this input irrelevant.
Conclusion
The function must receive an array of hotel rates to accurately compute the lowest rate available. Options A, C, and D do not supply the necessary data for the function's operation, while option B directly fulfills the requirement for calculating the minimum rate. Thus, option B is clearly the most appropriate input for the function.