Binary in A-Level CIE Computer Science | A-Level CIE 计算机:二进制 考点精讲

📚 Binary in A-Level CIE Computer Science | A-Level CIE 计算机:二进制 考点精讲

Binary is the fundamental language of all digital computers, representing data and instructions as sequences of 0s and 1s. A strong grasp of binary representation, arithmetic, and data interpretation is essential for success in the CIE A-Level Computer Science examination. This guide covers all key binary topics in the 9618 syllabus, from basic number conversion to floating-point representation, with clear explanations and exam-focused tips.

二进制是所有数字计算机的基础语言,用 0 和 1 的序列表示数据和指令。扎实掌握二进制表示、算术运算与数据解读对于在 CIE A-Level 计算机科学考试中取得成功至关重要。本指南涵盖 9618 教学大纲中所有二进制核心考点——从基础数制转换到浮点表示,配有清晰的解释和面向考试的技巧。


1. Binary Digits and Magnitudes | 二进制位与单位

Binary uses only two digits: 0 and 1. Each binary digit is a bit. Bits are grouped into larger units: a nibble is 4 bits, a byte is 8 bits, and a word length depends on the processor architecture (commonly 16, 32, or 64 bits).

二进制只使用两个数字:0 和 1。每一个二进制位称为一个比特 (bit)。比特可以组合成更大的单位:一个半字节 (nibble) 是 4 比特,一个字节 (byte) 是 8 比特,而字长取决于处理器架构(常见的为 16、32 或 64 比特)。

You must know the binary magnitude prefixes: kilobyte (kB) = 10³ bytes, megabyte (MB) = 10⁶ bytes, gigabyte (GB) = 10⁹ bytes, terabyte (TB) = 10¹² bytes, petabyte (PB) = 10¹⁵ bytes. The binary equivalents use powers of 2: 1 KiB = 2¹⁰ bytes = 1024 bytes, 1 MiB = 2²⁰ bytes, etc.

你必须熟悉二进制数量级前缀:千字节 (kB) = 10³ 字节,兆字节 (MB) = 10⁶ 字节,吉字节 (GB) = 10⁹ 字节,太字节 (TB) = 10¹² 字节,拍字节 (PB) = 10¹⁵ 字节。二进制等价单位使用 2 的幂:1 KiB = 2¹⁰ 字节 = 1024 字节,1 MiB = 2²⁰ 字节,依此类推。


2. Converting Binary to Decimal | 二进制转十进制

To convert a binary integer to decimal, multiply each bit by its positional weight (power of two) and sum the products. For an 8‑bit number, the weights are 2⁷, 2⁶, …, 2⁰.

要将二进制整数转换为十进制,将每个比特乘以其位权(2 的幂),再求和。对于 8 位数,位权为 2⁷、2⁶、…、2⁰。

Example: Convert 1011 0101₂ to decimal.

示例:将 1011 0101₂ 转换为十进制。

Weight 128 (2⁷) 64 (2⁶) 32 (2⁵) 16 (2⁴) 8 (2³) 4 (2²) 2 (2¹) 1 (2⁰)
Binary 1 0 1 1 0 1 0 1

Add the weights where the bit is 1: 128 + 32 + 16 + 4 + 1 = 181₁₀.

将比特为 1 的权值相加:128 + 32 + 16 + 4 + 1 = 181₁₀。

For binary fractions, weights after the binary point are negative powers of two: ½, ¼, ⅛, etc. So 101.101₂ = 4 + 1 + ½ + ⅛ = 5.625₁₀. We will explore fractions in detail later.

对于二进制小数,小数点后的位权是 2 的负幂:½、¼、⅛ 等。所以 101.101₂ = 4 + 1 + ½ + ⅛ = 5.625₁₀。稍后会详细探讨小数。


3. Converting Decimal to Binary | 十进制转二进制

To convert a decimal integer to binary, use the repeated division‑by‑2 method. Divide the number by 2, record the remainder (0 or 1), and continue dividing the quotient until it becomes 0. The binary result is the sequence of remainders read from bottom to top.

要将十进制整数转换为二进制,可使用重复除 2 法。将数字除以 2,记录余数(0 或 1),然后继续用商除以 2 直到商为 0。二进制结果是自下而上读取的余数序列。

Example: 29₁₀ → binary.

示例:29₁₀ → 二进制。

29 ÷ 2 = 14 r 1 ; 14 ÷ 2 = 7 r 0 ; 7 ÷ 2 = 3 r 1 ; 3 ÷ 2 = 1 r 1 ; 1 ÷ 2 = 0 r 1. Read remainders upwards: 11101₂.

29 ÷ 2 = 14 余 1;14 ÷ 2 = 7 余 0;7 ÷ 2 = 3 余 1;3 ÷ 2 = 1 余 1;1 ÷ 2 = 0 余 1。余数自下往上读:11101₂。

For decimal fractions, multiply by 2 repeatedly, taking the integer part (0 or 1) as the next binary digit and continuing with the fractional part. Be prepared to stop after a specified number of bits.

对于十进制小数,反复乘以 2,取整数部分(0 或 1)作为下一位二进制数字,并继续用小数部分操作。准备好在指定位数后停止。

0.3125₁₀: 0.3125×2=0.625 (0), 0.625×2=1.25 (1), 0.25×2=0.5 (0), 0.5×2=1.0 (1) → 0.0101₂.

0.3125₁₀:0.3125×2=0.625 (0),0.625×2=1.25 (1),0.25×2=0.5 (0),0.5×2=1.0 (1) → 0.0101₂。


4. Binary Addition | 二进制加法

Binary addition follows simple rules: 0+0=0, 0+1=1, 1+0=1, 1+1=0 with a carry of 1 to the next higher column, and 1+1+1=1 with a carry of 1.

二进制加法遵循简单规则:0+0=0,0+1=1,1+0=1,1+1=0 并向高位进位 1,1+1+1=1 进位 1。

Add 0110 1101₂ (109₁₀) and 0001 0111₂ (23₁₀):

加 0110 1101₂ (109₁₀) 和 0001 0111₂ (23₁₀):

0110 1101
+ 0001 0111
───────────
1000 0100

The result is 1000 0100₂ = 132₁₀. No overflow in an 8‑bit register here, but watch for the carry out of the most significant bit.

结果为 1000 0100₂ = 132₁₀。在此 8 位寄存器中没有溢出,但要留意最高位的进位。

Examiners often ask you to show carries explicitly. Always align bits and indicate a carry by writing a small ‘1’ above the column.

考官常要求明确标出进位。始终对齐每一位,并在该列上方写一个小 ‘1’ 表示进位。


5. Two’s Complement and Subtraction | 二进制补码与减法

In two’s complement notation, the most significant bit (MSB) is the sign bit (0 = positive, 1 = negative). To obtain the negative of a number, invert all bits and add 1 to the least significant bit.

在补码表示法中,最高有效位 (MSB) 是符号位(0 = 正,1 = 负)。要得到某个数的负数,将所有位取反再加 1 到最低有效位。

For 8 bits, the positive range is 0 to +127 (0111 1111₂), and negative range is -1 to -128 (1000 0000₂). The most negative number has no positive counterpart in the same number of bits.

对于 8 位,正数范围为 0 到 +127 (0111 1111₂),负数范围为 -1 到 -128 (1000 0000₂)。最负的数在相同位数中没有对应的正数。

Subtraction is performed by adding the two’s complement of the subtrahend. To compute 15 – 9 using 8‑bit two’s complement: 15 = 0000 1111₂, 9 = 0000 1001₂. The two’s complement of 9 is 1111 0111₂. Add: 0000 1111 + 1111 0111 = 1 0000 0110. The carry beyond the 8th bit is discarded, leaving 0000 0110₂ = 6.

减法通过加上减数的补码来实现。使用 8 位补码计算 15 – 9:15 = 0000 1111₂,9 = 0000 1001₂。9 的补码为 1111 0111₂。相加:0000 1111 + 1111 0111 = 1 0000 0110。超出第 8 位的进位被丢弃,留下 0000 0110₂ = 6。

Always check that the result fits within the allowed range; otherwise, an overflow error occurs.

务必检查结果是否在允许范围内,否则会发生溢出错误。


6. Binary Multiplication and Division | 二进制乘除法

Binary multiplication resembles decimal long multiplication: multiply the multiplicand by each bit of the multiplier, shifting left for each step, then add the partial products.

二进制乘法与十进制长乘法相似:用乘数的每一位乘以被乘数,每一步左移一位,然后将部分积相加。

Multiply 1011₂ (11) by 101₂ (5):

计算 1011₂ (11) 乘以 101₂ (5):

1011
× 101
─────────
1011 (×1, no shift)
0000 (×0, shift 1)
+ 1011 (×1, shift 2)
─────────
110111 (32+16+4+2+1 = 55)

Binary division follows the same long‑division process: determine how many times the divisor fits into portions of the dividend, writing a 1 in the quotient and subtracting the shifted divisor. Continue until all bits are processed.

二进制除法遵循相同的长除法过程:确定除数在被除数部分中适合多少次,在商中写 1 并减去移位后的除数。继续此过程直到处理完所有位。

Exam questions often require you to show the working, and you may be asked to perform integer division with remainder.

考试题目通常要求展示计算步骤,可能还会要求进行带余数的整数除法。


7. Overflow and Its Detection | 溢出及其检测

Overflow occurs when the result of an arithmetic operation exceeds the range that can be represented with the available number of bits. In two’s complement addition, overflow is detected when the carry into the sign bit is different from the carry out of the sign bit.

当算术运算的结果超出可用位数所能表示的范围时,就会发生溢出。在补码加法中,当进入符号位的进位与符号位的进位输出不同时,就检测到溢出。

For example, in an 8‑bit system, adding +100 (0110 0100) and +50 (0011 0010) gives 1001 0110, which is a negative number in two’s complement. The carries: into sign bit = 1, out of sign bit = 0 → overflow (result should be +150, which exceeds +127).

例如,在 8 位系统中,将 +100 (0110 0100) 和 +50 (0011 0010) 相加得到 1001 0110,这在补码中是一个负数。进位情况:进入符号位的进位 = 1,符号位进位输出 = 0 → 溢出(结果应为 +150,超出了 +127)。

Always check overflow when adding two numbers with the same sign or when subtracting a negative number from a positive one. CIE expects you to state whether overflow has occurred and to explain your reasoning.

当两个同号数相加或从正数中减去负数时,务必检查溢出。CIE 要求你说明是否发生了溢出并解释理由。


8. Fixed-Point Binary Fractions | 二进制定点小数

Fixed‑point representation allocates a fixed number of bits for the integer part and the fractional part, separated by an implicit binary point. The place values to the right of the point are 2⁻¹ (½), 2⁻² (¼), 2⁻³ (⅛), and so on.

定点表示法为整数部分和小数部分分配固定数量的位,由隐式的二进制小数点隔开。小数点右边的位权为 2⁻¹ (½)、2⁻² (¼)、2⁻³ (⅛),依此类推。

Example: 0101.1100₂ (with 4 integer and 4 fractional bits) = 4 + 1 + ½ + ¼ = 5.75₁₀.

示例:0101.1100₂(4 位整数,4 位小数)= 4 + 1 + ½ + ¼ = 5.75₁₀。

Negative fractions can be represented in two’s complement fixed‑point form. The weight of the MSB is negative: for a 4.4 format, the integer MSB weight is -8, followed by 4, 2, 1; fractional weights are positive ½, ¼, etc. So 1101.1000₂ = -8 + 4 + 1 + ½ = -2.5₁₀.

负数可以用补码定点形式表示。最高有效位的权值为负:在 4.4 格式中,整数 MSB 权为 -8,然后是 4、2、1;小数位权为正,如 ½、¼ 等。因此 1101.1000₂ = -8 + 4 + 1 + ½ = -2.5₁₀。

You must be able to convert between decimal fractions and fixed‑point binary, and determine the range and precision for a given number of bits.

你必须能够在十进制小数与定点二进制之间进行转换,并能确定给定位数下的范围和精度。


9. Floating-Point Binary Numbers | 二进制浮点数

Floating‑point representation stores a number as mantissa × 2exponent. In the CIE syllabus, both the mantissa and exponent are usually in two’s complement form, and the binary point is assumed to be at the left of the mantissa (after the sign bit) for normalised numbers.

浮点表示法以 尾数 × 2指数 的形式存储数字。在 CIE 考纲中,尾数和指数通常都采用补码形式,对于规格化数,假定的二进制小数点在尾数最左端(符号位之后)。

A normalised floating‑point number has a mantissa that starts with 01 for positive numbers or 10 for negative numbers

Published by TutorHao | A-Level Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading