Consider the following two implementations of the same algorithm, each written in a different language. 考虑以下同一算法的两种实现,每种实现都使用不同的语言编写。 Language A:  语言 A: Calculate the average daily rainfall for the week (averageRainfall) by adding together the rainfall totals for each of the 7 days of the week (sun, mon, tue, wed, thu, fri, and sat) and dividing the sum by 7. 将一周 7 天(周日、周一、周二、周三、周四、周五和周六)每天的降雨量总数相加,然后将总和除以 7,计算出一周的平均每日降雨量(平均降雨量)。 Language B:  语言 B: Take the total amount of rain from each day of the week (sunday, monday, tuesday, wednesday, thursday, friday and saturday) and then average them together to get the average daily rainfall for the week (averageRainfall). 计算一周中每天(星期日、星期一、星期二、星期三、星期四、星期五和星期六)的总降雨量,然后将其平均,得到该周的平均每日降雨量(平均降雨量)。 Which of the following statements about these two implementations is true? 以下关于这两种实现的说法中哪一项是正确的?单项选择题

A

Language A is ambiguous because it is unclear what sun, mon, tue, wed, thu, fri, and sat refer to in context with the problem. 语言 A 具有歧义,因为不清楚 sun、mon、tue、wed、thu、fri 和 sat 在问题上下文中指的是什么。

B

Language B is ambiguous because the process of “average” is not explained well 语言 B 有歧义,因为“平均”的过程没有得到很好的解释

C

The algorithms in both languages are ambiguous because they do not specify the actual values of the seven daily rainfall totals. 这两种语言的算法都比较模糊,因为它们没有指定七天降雨总量的实际值。

D

Neither of these languages is clear enough that a programmer could write a correct solution in a high-level programming language. 这两种语言都不够清晰,程序员无法用高级编程语言编写出正确的解决方案。

登录即可查看完整答案

我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!