IGCSE CIE Computer Science: Binary – Key Points Explained | IGCSE CIE 计算机:二进制 考点精讲

📚 IGCSE CIE Computer Science: Binary – Key Points Explained | IGCSE CIE 计算机:二进制 考点精讲

Binary is the most fundamental concept in computer science. For the IGCSE CIE syllabus, you must be able to convert between number bases, perform binary arithmetic, understand logical shifts, and work with two’s complement for negative numbers. This guide walks you through every essential exam point with clear explanations, conversions, and common pitfalls—all in one place.

二进制是计算机科学中最基础的概念。在 IGCSE CIE 教学大纲中,你必须掌握不同进制之间的转换、进行二进制运算、理解逻辑移位,并能使用二进制补码表示负数。本文逐一讲解每个重要考点,包括清晰的解释、转换方法与常见陷阱,帮助你在考试中拿下稳扎稳打的高分。

1. Why Computers Use Binary | 为什么计算机使用二进制

Computers are built from billions of transistors that act as tiny switches. These switches only have two reliable states: ON (1) and OFF (0). Using just two voltage levels makes the circuits simpler, less prone to error, and cheaper to manufacture than trying to distinguish ten different voltage levels for denary.

计算机由数十亿个晶体管构成,它们就像微型开关,仅有两种稳定状态:开 (1) 和关 (0)。只使用两种电压电平比试图为十进制区分十种电压电平更简单、更不易出错,制造成本也更低。

All data—numbers, text, images, sound—is ultimately represented as sequences of binary digits (bits). This is why everything in a computer, from machine code instructions to pixel colours, stems from binary.

所有数据——数字、文字、图像、声音——最终都以二进制位(比特)序列的形式表示。这就是为什么计算机中一切内容,从机器码指令到像素颜色,都源于二进制。


2. Place Values in Binary | 二进制的位值

Just as denary (base 10) has place values of powers of 10, binary (base 2) uses powers of 2. The rightmost bit is the least significant bit (LSB) with value 2⁰ = 1. Moving left, each place value doubles: 2¹ = 2, 2² = 4, 2³ = 8, and so on.

就像十进制(基数为 10)的位值是 10 的幂次一样,二进制(基数为 2)的位值是 2 的幂次。最右边的位是最低有效位 (LSB),其值为 2⁰ = 1。向左移动,每一位的值翻倍:2¹ = 2、2² = 4、2³ = 8,依此类推。

For an 8-bit binary number, the place values are:

对于 8 位二进制数,位值如下:

Bit position 7 (MSB) 6 5 4 3 2 1 0 (LSB)
Place value 2⁷ = 128 2⁶ = 64 2⁵ = 32 2⁴ = 16 2³ = 8 2² = 4 2¹ = 2 2⁰ = 1

To find the denary value of a binary number, add up the place values wherever a 1 appears. For example, 0010 1011 has 1s in positions 5, 3, 1, and 0: 32 + 8 + 2 + 1 = 43.

要计算二进制数的十进制值,只需将所有出现 1 的位值相加。例如,0010 1011 在第 5、3、1、0 位上有 1:32 + 8 + 2 + 1 = 43。


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

Draw a place value table, write the binary digits underneath, and sum the values of the columns with a 1. Always start from the right to avoid misalignment. A quick check: the largest 8-bit binary number is 1111 1111, which equals 255 (128+64+32+16+8+4+2+1).

绘制一个位值表,将二进制数字写在下方,然后将有 1 的列的值相加。始终从右开始以避免错位。快速验证:最大的 8 位二进制数是 1111 1111,等于 255 (128+64+32+16+8+4+2+1)。

For a nibble (4 bits), the maximum is 1111₂ = 15. This relationship is frequently used in hex conversions. Exam tip: show your working by listing the place values and ticking columns with a 1.

对于半字节(4 位),最大值为 1111₂ = 15。这种关系在十六进制转换中经常用到。考试提示:列出位值并在有 1 的列上打勾,以展示解题过程。


4. Converting Denary to Binary | 十进制转二进制

One reliable method is successive division by 2. Divide the denary number by 2, record the remainder (0 or 1), and continue dividing the quotient by 2 until the quotient is 0. Read the remainders from bottom to top to obtain the binary number.

一种可靠的方法是连续除以 2。将十进制数除以 2,记录余数(0 或 1),继续用商除以 2,直到商为 0。从下往上读取余数,即可得到二进制数。

Example: Convert 78 to binary.

示例:将 78 转换为二进制。

78 ÷ 2 = 39 remainder 0
39 ÷ 2 = 19 remainder 1
19 ÷ 2 = 9 remainder 1
9 ÷ 2 = 4 remainder 1
4 ÷ 2 = 2 remainder 0
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Reading upwards: 1001110₂. To express in 8 bits, pad with leading zeros: 0100 1110.

78 ÷ 2 = 39 余 0
39 ÷ 2 = 19 余 1
19 ÷ 2 = 9 余 1
9 ÷ 2 = 4 余 1
4 ÷ 2 = 2 余 0
2 ÷ 2 = 1 余 0
1 ÷ 2 = 0 余 1
从下往上读:1001110₂。要用 8 位表示,前面补零:0100 1110。

Alternatively, use the subtraction method: find the largest power of 2 less than or equal to the number, place a 1, subtract, and repeat with the remainder. Both methods are acceptable in exams.

另一种方法是减法:找到小于或等于该数的最大 2 的幂次,在该位放 1,减去该值,用余数重复上述步骤。两种方法考试都接受。


5. Binary Addition | 二进制加法

Binary addition follows four basic rules: 0+0=0, 0+1=1, 1+0=1, and 1+1=0 with a carry of 1 into the next left column. For 1+1+1 (carry in from previous column), the result is 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 the binary equivalents of 25 and 14: 0001 1001 + 0000 1110. Work from right to left, just like denary addition. The result is 0010 0111, which is 39.

将 25 和 14 的二进制数相加:0001 1001 + 0000 1110。从右向左计算,就像十进制加法一样。结果为 0010 0111,即 39。

Always line up the bits by their place values. If the sum exceeds 8 bits, you have a 9-bit result, which leads to overflow.

始终按位值对齐各位。如果结果超过 8 位,就会得到一个 9 位结果,从而导致溢出。


6. Overflow Errors | 溢出错误

An overflow occurs when the result of an addition requires more bits than the register can store. In an 8-bit system, for example, adding two numbers whose sum exceeds 255 will cause the most significant carry to be lost, generating an incorrect result.

当加法结果的位数超出寄存器所能存储的位数时,就会发生溢出。例如,在 8 位系统中,两个数相加之和超过 255 时,最高位的进位会丢失,从而产生错误结果。

The CPU typically sets an overflow flag to indicate that a result is invalid. You must be able to recognise overflow from a binary addition working, usually by spotting a carry into the 9th bit that cannot be stored.

CPU 通常会设置溢出标志,指示结果无效。你必须能够通过二进制加法过程识别溢出,通常是发现无法存储的、进入第 9 位的进位。

Overflow is distinct from a carry flag: overflow applies to signed arithmetic (two’s complement), but in IGCSE it often means simply that the sum exceeds the maximum value for the given bit width.

溢出与进位标志不同:溢出针对带符号算术(补码),但在 IGCSE 中,它常常仅指和超过了给定位宽的最大值。


7. Logical Shifts | 逻辑移位

A logical left shift moves every bit one place to the left. The leftmost bit is discarded, and a 0 is filled at the rightmost position. Each left shift multiplies the denary value by 2 (ignoring overflow bits).

逻辑左移将每一位向左移动一位。最左边的位被丢弃,最右边的位补 0。每次左移将十进制值乘以 2(忽略溢出位)。

A logical right shift moves every bit one place to the right. The rightmost bit is discarded, and a 0 is placed at the leftmost. This divides the denary value by 2, ignoring any remainder (integer division).

逻辑右移将每位向右移动一位。最右边的位被丢弃,最左边补 0。这会将十进制值除以 2,忽略余数(整数除法)。

Example: 0010 1100 (44) left-shifted once → 0101 1000 (88). Right-shifted once → 0001 0110 (22). In exams, you may be asked to identify the new binary pattern and the effect on the number.

示例:0010 1100 (44) 左移一次 → 0101 1000 (88)。右移一次 → 0001 0110 (22)。考试中可能要求你确定新的二进制模式及其对数值的影响。

Note: In logical shifts, the sign bit is not preserved. For negative numbers, an arithmetic shift is needed, but CIE IGCSE mainly tests logical shifts with positive numbers.

注意:逻辑移位中,符号位不会被保留。对于负数,需要使用算术移位,但 CIE IGCSE 主要考察正数的逻辑移位。


8. Two’s Complement Representation | 二进制补码表示

Two’s complement is the method used to represent both positive and negative integers in binary. For an n-bit number, the most significant bit (MSB) is given a negative place value: –2ⁿ⁻¹. The other bits remain positive.

二进制补码是一种用二进制表示正负整数的方法。对于 n 位数,最高有效位 (MSB) 分配一个负的位值:–2ⁿ⁻¹。其他位仍为正。

In an 8-bit two’s complement system, the place values are: –128, 64, 32, 16, 8, 4, 2, 1. To find the value, add the negative weight of the MSB (if it is 1) and the positive weights of the remaining 1s.

在 8 位补码系统中,位值为:–128、64、32、16、8、4、2、1。要计算数值,将 MSB 的负权重(如果该位为 1)与其余位为 1 的正权重相加即可。

-128 64 32 16 8 4 2 1
1 0 0 1 1 0 1 0

1001 1010: MSB = 1, so value = –128 + 16 + 8 + 2 = –102. A positive number in two’s complement always has a 0 as the MSB, and the range for 8 bits is –128 to +127.

1001 1010:MSB=1,因此值 = –128 + 16 + 8 + 2 = –102。补码表示的正数 MSB 始终为 0,8 位数的范围是 –128 到 +127。


9. Two’s Complement Conversion Tricks | 补码转换技巧

To find the two’s complement of a positive number to represent its negative, flip all bits (1’s complement) and add 1. For example, to represent –25 in 8 bits: write +25 as 0001 1001, flip to 1110 0110, add 1 → 1110 0111. This is the two’s complement representation of –25.

要找到一个正数的二进制补码以表示其负数,将所有位取反(反码)再加 1。例如,用 8 位表示 –25:写出 +25 为 0001 1001,取反得到 1110 0110,加 1 → 1110 0111。这就是 –25 的补码表示。

You can also read a negative two’s complement number by applying the same trick backwards: flip the bits of the negative number and add 1 to get the corresponding positive magnitude. So 1110 0111 flipped → 0001 1000, add 1 → 0001 1001 (25), confirming it is –25.

你也可以反向运用同样的技巧读取负补码:将负数的位取反后加 1,得到对应的正值大小。因此 1110 0111 取反 → 0001 1000,加 1 → 0001 1001 (25),确认它是 –25。

Common exam mistake: forgetting to add 1 after flipping bits. Always stress the ‘+1’ step.

常见考试错误:取反后忘记加 1。务必强调“加 1”这一步。


10. Binary and Hexadecimal Link | 二进制与十六进制的联系

Hexadecimal (base 16) provides a compact way to represent binary numbers. Each hex digit corresponds to a nibble (4 bits). This makes reading and writing long binary strings much easier for humans.

十六进制(基数为 16)为二进制数提供了一种紧凑的表示方式。每个十六进制数字对应一个半字节(4 位)。这使人们更容易阅读和书写长二进制串。

To convert binary to hex, split the binary number into groups of four bits from the right, then convert each group to its hex equivalent. 0010 1111 becomes 2F. For denary 10–15, use letters A–F.

要将二进制转换为十六进制,从右开始将二进制数每四位分成一组,然后将每组转换为其对应的十六进制值。0010 1111 变为 2F。十进制 10–15 使用字母 A–F。

Hex is tested both ways: you may be asked to convert hex to binary by expanding each digit into a 4-bit nibble. For A3, A=1010, 3=0011 → 1010 0011.

十六进制双向考查:可能要求你通过将每个十六进制数字展开为 4 位半字节,将十六进制转换为二进制。对于 A3,A=1010,3=0011 → 1010 0011。


11. Common Exam Mistakes and How to Avoid Them | 常见考试陷阱与对策

  • Misaligned binary columns: Always write the place value headings above your binary digits. Never rely on guesswork.
  • 二进制列未对齐:务必在二进制数字上方写出位值标题。切勿凭猜测行事。
  • Forgetting to pad with leading zeros: An 8-bit answer must have exactly 8 bits. ‘1101’ is not an acceptable 8-bit answer; write ‘0000 1101’.
  • 忘记在高位补零:8 位答案必须恰好 8 位。“1101”不能作为 8 位答案,应写成“0000 1101”。
  • Ignoring overflow: In binary addition, if the carry bit spills beyond the given bit width, clearly state ‘overflow’ or show the flag.
  • 忽略溢出:在二进制加法中,若进位超出给定位宽,要明确指出“溢出”或显示溢出标志。
  • Two’s complement sign confusion: Keep in mind that in negative two’s complement the MSB is 1, but the value is not simply negative of the magnitude of the remaining bits. Use the flip-and-add-1 method to verify.
  • 补码符号混淆:记住,在负数的补码中 MSB 为 1,但其值并不简单地等于其余位大小的负值。使用取反加 1 的方法加以验证。
  • Mixing logical and arithmetic shift: At IGCSE level, unless specified, assume logical shift for positive numbers and note that MSB does not retain its value after right logical shift.
  • 混淆逻辑移位与算术移位:在 IGCSE 阶段,除特别说明外,假设对正数使用逻辑移位,并注意逻辑右移后 MSB 不保留其值。

Published by TutorHao | 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