AP-Style MC Practice QuestionsAP 风格选择题练习
Unit 2: Data第 2 单元:数据CSP
Multiple Choice)Choose the best answer. Items marked Select two answers have exactly two correct choices. Code uses the AP CSP Exam Reference Sheet pseudocode: list indices start at 1, and a ← b assigns the value of b to a.选择最合适的答案。标有选择两个答案的题目恰好有两个正确选项。代码使用 AP CSP 考试参考表的伪代码:列表下标从 1 开始,a ← b 表示把 b 的值赋给 a。
A device stores an unsigned integer as the binary sequence 1011010.设备将一个无符号整数存储为二进制(binary)序列 1011010。
What is the decimal value of the integer?该整数的十进制(decimal)值是多少?
A sensor assigns each possible reading a distinct unsigned 9-bit code. All 9-bit patterns are available.传感器为每个可能的读数分配一个不同的无符号 9 位代码。所有 9 位模式均可使用。
What is the maximum number of distinct readings that can be encoded?最多可以编码多少个不同的读数?
A museum digitizes a continuously changing sound. One version records more samples per second than another, while both use the same number of bits per sample.一家博物馆将连续变化的声音数字化。其中一个版本每秒记录的采样(sample)次数更多,两个版本每个采样使用的位数相同。
Which statement best describes the trade-off?以下哪项最恰当地描述了这种权衡?
A message has 7 consecutive A symbols, followed by 4 B symbols, 10 C symbols, and 3 D symbols. Its original representation uses 3 bits per symbol. A lossless scheme represents each consecutive run using 3 bits for the symbol and 5 bits for the run length. All four run lengths fit in 5 bits.一条消息由连续的 7 个 A、4 个 B、10 个 C 和 3 个 D 依次组成。原始表示中每个符号使用 3 位。一种无损压缩(lossless compression)方案用 3 位表示符号,再用 5 位表示该符号连续出现的次数。四段的长度均可用 5 位表示。
How many bits does this scheme use to represent the compressed message?该方案用多少位表示压缩后的消息?
A laboratory must store measurement files so that every original bit can be recovered later. Reducing file size is desirable but not as important as exact recovery.实验室需要存储测量文件,要求之后能恢复原文件的每一位。减小文件大小是可取的,但不如精确恢复重要。
Which approach best meets the requirement?哪种方法最符合要求?
A news service compares compression methods for photographs and documents.一家新闻机构正在比较用于照片和文档的压缩方法。
Which two statements are correct? Select two answers. Select two answers.以下哪两项说法正确?请选择两个答案。 选择两个答案。
A city finds that neighborhoods with more bicycle lanes also have lower average air pollution. The data do not include traffic volume or industrial activity.某市发现,自行车道较多的社区平均空气污染程度也较低。数据中不包含交通流量或工业活动情况。
Which conclusion is best supported by these data?这些数据最能支持以下哪项结论?
A photo organizer stores image pixels together with a creation date and camera model.一个照片管理程序将图像像素与创建日期和相机型号一起存储。
What can the creation date and camera model help the organizer do?创建日期和相机型号可以帮助该程序完成什么任务?
A transit agency wants to estimate satisfaction among all riders. Its current survey is available only through a smartphone app, and many riders do not use the app.一家交通机构想估计所有乘客的满意度。目前问卷只能通过智能手机应用填写,而许多乘客并不使用该应用。
Which change would best address the main limitation?哪项改变最有助于解决主要限制?
A school combines two attendance files. One uses the label "New York" and the other uses "NY" for the same city. Some records have missing student IDs, and different students can share a name.一所学校合并两份出勤文件。一份用“New York”,另一份用“NY”表示同一个城市。有些记录缺少学生 ID,且不同学生可能同名。
Which two actions are appropriate when preparing these data for analysis? Select two answers. Select two answers.准备分析这些数据时,哪两项操作是恰当的?请选择两个答案。 选择两个答案。
A program processes a list of measurements.一个程序处理测量值列表(list)。
values ← [4, 9, 0, 7, 6, 3] total ← 0 count ← 0 FOR EACH value IN values { IF(value > 3 AND value MOD 2 = 0) { total ← total + value count ← count + 1 } } DISPLAY(total) DISPLAY(count)
What does the program display? The displayed values are separated by a space.程序显示什么?显示的值之间用空格分隔。
A program removes missing-value markers, represented by 0, from a copy of a list.一个程序从列表的副本中删除用 0 表示的缺失值标记。
original ← [3, 0, 8, 0, 5] clean ← original i ← 1 REPEAT UNTIL(i > LENGTH(clean)) { IF(clean[i] = 0) { REMOVE(clean, i) } ELSE { i ← i + 1 } } DISPLAY(original[2]) DISPLAY(LENGTH(clean)) DISPLAY(clean[2])
What does the program display? The displayed values are separated by spaces.程序显示什么?显示的值之间用空格分隔。
Two lists contain corresponding daily records. The first list gives rainfall in centimeters, and the second gives the number of visitors on the same days.两个列表包含按日期一一对应的记录。第一个列表给出降雨量,单位为厘米;第二个列表给出同一天的访客人数。
rain ← [2, 0, 4, 1] visitors ← [10, 20, 30, 40] i ← 1 total ← 0 REPEAT UNTIL(i > LENGTH(rain)) { IF(rain[i] ≥ 2) { total ← total + visitors[i] } i ← i + 1 } DISPLAY(total)
What does the program display?程序显示什么?
A program examines consecutive measurements to count increases.一个程序检查相邻的测量值,并统计数值上升的次数。
readings ← [2, 5, 3, 6] i ← 2 count ← 0 REPEAT UNTIL(i > LENGTH(readings)) { IF(readings[i] > readings[i - 1]) { count ← count + 1 } i ← i + 1 } DISPLAY(count)
What does the program display?程序显示什么?
A list uses negative values to mark invalid measurements. The procedure calculates the average of the remaining values. The list is guaranteed to contain at least one nonnegative value.一个列表用负值标记无效测量值。下面的过程计算其余值的平均值。已知列表中至少有一个非负值。
PROCEDURE validAverage(data) { total ← 0 count ← 0 FOR EACH value IN data { IF(value ≥ 0) { total ← total + value count ← count + 1 } } RETURN(total / count) } measurements ← [-1, 8, 0, 4, -1] DISPLAY(validAverage(measurements))
What value does the program display?程序显示的值是多少?