Skip to content

2.1 Binary Numbers 二进制数字

The way a computer represents data internally is different from the way the data are interpreted and displayed for the user. Programs are used to translate data into a representation more easily understood by people.

  • 计算机内部表示数据的方式与数据被解释和显示给用户的方式不同。程序用于将数据转换为更容易被人们理解的表示形式。

核心要点 Core Points

  1. Data values can be stored in variables, lists of items, or standalone constants and can be passed as input to (or output from) procedures.

    • 数据值可以存储在变量、项目列表或独立常量中,并可以作为输入传递给过程(或从过程输出)。
  2. Computing devices represent data digitally, meaning that the lowest-level components of any value are bits.

    • 计算设备以数字方式表示数据,这意味着任何值的最低级组件都是位。
  3. Bit is shorthand for binary digit and is either 0 or 1.

    • 位是二进制数字的简写,要么是0要么是1。
  4. A byte is 8 bits.

    • 一个字节是8位。
  5. Abstraction is the process of reducing complexity by focusing on the main idea. By hiding details irrelevant to the question at hand and bringing together related and useful details, abstraction reduces complexity and allows one to focus on the idea.

    • 抽象是通过专注于主要思想来减少复杂性的过程。通过隐藏与当前问题无关的细节并汇集相关和有用的细节,抽象减少了复杂性并允许人们专注于这个思想。
  6. Bits are grouped to represent abstractions. These abstractions include, but are not limited to, numbers, characters, and color.

    • 位被分组来表示抽象。这些抽象包括但不限于数字、字符和颜色。
  7. The same sequence of bits may represent different types of data in different contexts.

    • 相同的位序列可能在不同上下文中表示不同类型的数据。
  8. Analog data have values that change smoothly, rather than in discrete intervals, over time. Some examples of analog data include pitch and volume of music, colors of a painting, or position of a sprinter during a race.

    • 模拟数据具有随时间平滑变化的值,而不是在离散间隔中变化。模拟数据的一些例子包括音乐的音调和音量、绘画的颜色或短跑运动员在比赛中的位置。
  9. The use of digital data to approximate real-world analog data is an example of abstraction.

    • 使用数字数据来近似现实世界的模拟数据是抽象的一个例子。
  10. Analog data can be closely approximated digitally using a sampling technique, which means measuring values of the analog signal at regular intervals called samples. The samples are measured to figure out the exact bits required to store each sample.

    • 模拟数据可以使用采样技术在数字上密切近似,这意味着在称为样本的规则间隔处测量模拟信号的值。测量样本以确定存储每个样本所需的确切位数。
  11. In many programming languages, integers are represented by a fixed number of bits, which limits the range of integer values and mathematical operations on those values. This limitation can result in overflow or other errors.

    • 在许多编程语言中,整数由固定数量的位表示,这限制了整数值的范围和这些值的数学运算。这种限制可能导致溢出或其他错误。
  12. Other programming languages provide an abstraction through which the size of representable integers is limited only by the size of the computer's memory; this is the case for the language defined in the exam reference sheet.

    • 其他编程语言提供了一种抽象,通过这种抽象,可表示整数的大小仅受计算机内存大小的限制;考试参考表中定义的语言就是这种情况。
  13. In programming languages, the fixed number of bits used to represent real numbers limits the range and mathematical operations on these values; this limitation can result in round-off and other errors. Some real numbers are represented as approximations in computer storage.

    • 在编程语言中,用于表示实数的固定位数限制了这些值的范围和数学运算;这种限制可能导致舍入和其他错误。一些实数在计算机存储中表示为近似值。
  14. Number bases, including binary and decimal, are used to represent data.

    • 数字基数,包括二进制和十进制,用于表示数据。
  15. Binary (base 2) uses only combinations of the digits zero and one.

    • 二进制(基数2)只使用数字零和一的组合。
  16. Decimal (base 10) uses only combinations of the digits 0-9.

    • 十进制(基数10)只使用数字0-9的组合。
  17. Similar to decimal, a digit's position in a binary sequence determines its numeric value. This numeric value is equal to the bit's value (0 or 1) multiplied by the place value of its position.

    • 与十进制类似,数字在二进制序列中的位置决定其数值。这个数值等于位的值(0或1)乘以其位置的位值。
  18. The place value of each position is determined by the base raised to the power of the position. Positions are numbered starting at the rightmost position with 0 and increasing by 1 for each subsequent position to the left.

    • 每个位置的位值由基数提高到位置次幂确定。位置从最右边的位置开始编号为0,每个后续位置向左增加1。

学生活动 Student Activities

  1. Explain how data can be represented using bits.

    • 解释如何使用位来表示数据。
  2. Explain the consequences of using bits to represent data.

    • 解释使用位表示数据的后果。
  3. Calculate the binary (base 2) equivalent of a positive integer (base 10) and vice versa.

    • 计算正整数的二进制(基数2)等价物,反之亦然。
  4. Compare and order binary numbers.

    • 比较和排序二进制数字。

必背单词

  1. analog data 模拟数据
  2. digital data 数字数据
  3. binary 二进制
  4. decimal 十进制
  5. represent 代表,表示
  6. internally (计算机)内部
  7. interpret 解释,说明
  8. standalone (计算机)独立运行的;
  9. constant 常数,恒量;不变的事物
  10. complexity 复杂性
  11. irrelevant 不相关的,不相干的
  12. context 背景,环境;上下文,语境
  13. discrete 分离的,各别的
  14. pitch <英>体育场地,球场;程度,强度;音准,音高;
  15. volume 体积,容积;总数,总量;音量,响度;
  16. sprinter 短跑选手
  17. approximate 接近;模仿,模拟
  18. integers 整数
  19. real number 实数
  20. vice versa 反之亦然
  21. round-off error 舍入错误
  22. overflow error 溢出错误

基于 VitePress 构建的 AP CSP 学习平台