Number Systems and Base Conversion | 数制与进制转换

📚 Number Systems and Base Conversion | 数制与进制转换

In computer science, understanding number systems is fundamental. Computers do not think in decimal like humans; they operate using binary signals represented by 0s and 1s. This chapter explores the key number systems used in IGCSE Computer Science — binary, octal, decimal, and hexadecimal — and explains how to convert between them accurately.

在计算机科学中,理解数制是基础。计算机不像人类那样用十进制思考,而是通过由 0 和 1 表示的二进制信号来运作。本章将探讨 IGCSE 计算机科学中使用的关键数制——二进制、八进制、十进制和十六进制——并解释如何准确地进行它们之间的转换。


1. Why Number Systems Matter | 为什么数制重要

Every piece of data inside a computer — numbers, text, images, sound — is ultimately stored as a sequence of binary digits (bits). The binary system uses only two digits: 0 and 1. This matches the physical reality of electronic circuits, where a switch is either ON (1) or OFF (0).

计算机内部的所有数据——数字、文本、图像、声音——最终都以二进制位(比特)序列的形式存储。二进制系统只使用两个数字:0 和 1。这与电子电路的物理现实相匹配,即开关要么是开(1),要么是关(0)。

However, binary numbers quickly become long and difficult for humans to read. For this reason, hexadecimal (base 16) is often used as a compact shorthand for binary. Octal (base 8) is also useful in some contexts. Mastering these systems and their conversions is a core IGCSE requirement.

然而,二进制数会迅速变得又长又难以阅读。因此,十六进制(基数为 16)常被用作二进制的紧凑简写。八进制(基数为 8)在某些情境下也很有用。掌握这些系统及其转换是 IGCSE 的核心要求。


2. The Decimal System (Base 10) | 十进制系统(基数为 10)

The decimal system is the number system we use in everyday life. It uses ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Each digit has a place value that is a power of 10.

十进制系统是我们在日常生活中使用的数制。它使用十个数字:0, 1, 2, 3, 4, 5, 6, 7, 8, 9。每一位数字都有一个位值,即 10 的幂。

For example, the number 3452 means:

例如,数字 3452 表示:

3452 = 3 × 10³ + 4 × 10² + 5 × 10¹ + 2 × 10⁰

Each position moving from right to left represents units (10⁰), tens (10¹), hundreds (10²), thousands (10³), and so on.

从右向左移动的每个位置分别代表个位(10⁰)、十位(10¹)、百位(10²)、千位(10³),依此类推。


3. The Binary System (Base 2) | 二进制系统(基数为 2)

The binary system uses only two digits: 0 and 1. Its base is 2, so each place value is a power of 2. For example, the binary number 1011 can be converted to decimal as follows:

二进制系统只使用两个数字:0 和 1。它的基数是 2,因此每个位值都是 2 的幂。例如,二进制数 1011 可以按如下方式转换为十进制:

1011₂ = 1 × 2³ + 0 × 2² + 1 × 2¹ + 1 × 2⁰ = 8 + 0 + 2 + 1 = 11₁₀

Notice the subscripts: 1011₂ means binary and 11₁₀ means decimal. This notation helps avoid confusion when working with multiple bases.

注意下标:1011₂ 表示二进制,11₁₀ 表示十进制。在处理多种进制时,这种表示法有助于避免混淆。

Table of binary place values:

二进制位值表:

Power of 2 2⁷ 2⁶ 2⁵ 2⁴ 2⁰
Decimal value 128 64 32 16 8 4 2 1

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

To convert a binary number to decimal, write the binary digits under their place values, then add together the place values where the digit is 1.

要将二进制数转换为十进制数,把二进制数字写在对应的位值下,然后将数字为 1 的那些位值相加。

Example: Convert 11010₂ to decimal.

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

Place value 16 8 4 2 1
Binary digit 1 1 0 1 0

16 + 8 + 0 + 2 + 0 = 26. Therefore, 11010₂ = 26₁₀.

16 + 8 + 0 + 2 + 0 = 26。因此,11010₂ = 26₁₀。

Exam tip: Always write out the place values clearly. This avoids careless errors and helps examiners follow your method.

考试提示:始终清晰写出位值,这能避免粗心错误,也便于考官理解你的解题方法。


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

There are two common methods for converting a decimal number to binary: successive division by 2, and using place values.

将十进制数转换为二进制数有两种常见方法:连续除以 2 法,以及使用位值法。

Method 1: Successive division by 2

方法一:连续除以 2

Divide the decimal number by 2 repeatedly, recording the remainder at each step. Read the remainders from bottom to top to form the binary number.

将十进制数反复除以 2,每一步记录余数。从下往上读取余数,即得到二进制数。

Example: Convert 42₁₀ to binary.

示例:将 42₁₀ 转换为二进制。

  • 42 ÷ 2 = 21, remainder 0
  • 21 ÷ 2 = 10, remainder 1
  • 10 ÷ 2 = 5, remainder 0
  • 5 ÷ 2 = 2, remainder 1
  • 2 ÷ 2 = 1, remainder 0
  • 1 ÷ 2 = 0, remainder 1

Reading remainders from bottom to top: 101010₂. So 42₁₀ = 101010₂.

从下往上读取余数:101010₂。因此 42₁₀ = 101010₂。

Method 2: Using place values

方法二:使用位值法

Find the largest power of 2 that does not exceed the decimal number, and subtract. Repeat with the remainder. Place a 1 in each position used and a 0 in others.

找出不超过该十进制数的最大 2 的幂并相减。对余数重复此操作。在每个使用的位置写 1,其余位置写 0。

For 42: 32 (2⁵) + 8 (2³) + 2 (2¹) = 42. Binary digits from 2⁵ down to 2⁰: 1, 0, 1, 0, 1, 0 → 101010₂.

对于 42:32(2⁵)+ 8(2³)+ 2(2¹)= 42。从 2⁵ 到 2⁰ 的二进制数字:1, 0, 1, 0, 1, 0 → 101010₂。


6. The Hexadecimal System (Base 16) | 十六进制系统(基数为 16)

Hexadecimal, often called “hex”, uses base 16. It has 16 digits: 0-9 and the letters A-F, where A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

十六进制常简称为 “hex”,使用基数 16。它有 16 个数字:0-9 以及字母 A-F,其中 A = 10,B = 11,C = 12,D = 13,E = 14,F = 15。

Hex digit 0 1 2 3 4 5 6 7 8 9 A B C D E F
Decimal value 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Hexadecimal is useful because one hex digit represents exactly four binary digits (bits). This makes it much easier to read long binary values, such as memory addresses or colour codes in web design.

十六进制很有用,因为一位十六进制数字恰好表示四位二进制数字(比特)。这使得读取较长的二进制值更加容易,例如内存地址或网页设计中的颜色代码。


7. Converting Hexadecimal to Decimal | 十六进制转十进制

To convert a hexadecimal number to decimal, use the place values 16⁰, 16¹, 16², etc., starting from the rightmost digit.

要将十六进制数转换为十进制数,从最右边的数字开始使用位值 16⁰、16¹、16² 等。

Example: Convert 3A7₁₆ to decimal.

示例:将 3A7₁₆ 转换为十进制。

3A7₁₆ = 3 × 16² + A × 16¹ + 7 × 16⁰ = 3 × 256 + 10 × 16 + 7 × 1

= 768 + 160 + 7 = 935₁₀. Therefore, 3A7₁₆ = 935₁₀.

= 768 + 160 + 7 = 935₁₀。因此,3A7₁₆ = 935₁₀。

Example: Convert FF₁₆ to decimal.

示例:将 FF₁₆ 转换为十进制。

F = 15, so FF₁₆ = 15 × 16 + 15 = 255₁₀. This is the maximum value of one byte (8 bits).

F = 15,所以 FF₁₆ = 15 × 16 + 15 = 255₁₀。这是一个字节(8 位)的最大值。


8. Converting Decimal to Hexadecimal | 十进制转十六进制

The method is similar to converting decimal to binary, but now we divide by 16 and record remainders as hex digits.

方法与十进制转二进制类似,但现在除以 16,并将余数记录为十六进制数字。

Example: Convert 490₁₀ to hexadecimal.

示例:将 490₁₀ 转换为十六进制。

  • 490 ÷ 16 = 30, remainder 10 = A
  • 30 ÷ 16 = 1, remainder 14 = E
  • 1 ÷ 16 = 0, remainder 1

Reading from bottom to top: 1EA₁₆. So 490₁₀ = 1EA₁₆.

从下往上读取:1EA₁₆。因此 490₁₀ = 1EA₁₆。


9. Binary to Hexadecimal and Back | 二进制与十六进制互转

This is the most important conversion because hexadecimal was invented as a shorthand for binary. Each group of 4 binary bits corresponds to exactly one hex digit.

这是最重要的转换,因为发明十六进制就是为了作为二进制的简写。每 4 个二进制位恰好对应一位十六进制数字。

Binary to hexadecimal:

二进制转十六进制:

  • Starting from the right, split the binary number into groups of 4 bits.
  • If the leftmost group has fewer than 4 bits, pad it with leading zeros.
  • Convert each group of 4 bits to its hex equivalent.
  • 从右边开始,将二进制数分成每 4 位一组。
  • 如果最左边一组不足 4 位,则在前面补零。
  • 将每 4 位二进制数转换为其对应的十六进制数。

Example: Convert 11011110101₂ to hex.

示例:将 11011110101₂ 转换为十六进制。

Group from the right: 0110 1111 0101 (padded with one leading zero).

从右分组:0110 1111 0101(前面补了一个零)。

  • 0110₂ = 6₁₆
  • 1111₂ = F₁₆
  • 0101₂ = 5₁₆

Therefore, 11011110101₂ = 6F5₁₆.

因此,11011110101₂ = 6F5₁₆。

Hexadecimal to binary: Simply reverse the process — convert each hex digit to its 4-bit binary equivalent and concatenate.

十六进制转二进制:只需逆向操作——将每个十六进制数字转换为其 4 位二进制等价形式并拼接起来。

Example: Convert 2C9₁₆ to binary.

示例:将 2C9₁₆ 转换为二进制。

  • 2₁₆ = 0010₂
  • C₁₆ = 1100₂
  • 9₁₆ = 1001₂

Concatenating: 0010 1100 1001 = 1011001001₂ (leading zero can be dropped).

拼接:0010 1100 1001 = 1011001001₂(前导零可以去掉)。


10. The Octal System (Base 8) | 八进制系统(基数为 8)

The octal system uses base 8 with digits 0-7. Each octal digit corresponds to exactly 3 binary bits. Although less common today than hexadecimal, octal still appears in some contexts such as file permissions in Unix-like systems.

八进制系统使用基数 8,数字为 0-7。每一位八进制数字恰好对应 3 个二进制位。虽然如今不如十六进制常用,但在某些场景中仍会出现,例如类 Unix 系统中的文件权限。

Example: Convert 715₂ to octal.

示例:将 715₂ 转换为八进制。

Group from the right into 3s: 111 001 101₂ = 7 1 5. Therefore, 111001101₂ = 715₈.

从右按 3 位分组:111 001 101₂ = 7 1 5。因此,111001101₂ = 715₈。

To convert octal to decimal, use powers of 8: 8⁰, 8¹, 8², etc.

要将八进制转换为十进制,使用 8 的幂:8⁰、8¹、8² 等。

Example: 715₈ = 7 × 64 + 1 × 8 + 5 × 1 = 448 + 8 + 5 = 461₁₀.

示例:715₈ = 7 × 64 + 1 × 8 + 5 × 1 = 448 + 8 + 5 = 461₁₀。


11. Common Exam Questions and Practice | 常见考题与练习

IGCSE exams frequently test number system conversions in multiple-choice, short-answer, and structured questions. Here are typical question types:

IGCSE 考试经常以选择题、简答题和结构化问题考查数制转换。以下是典型的题型:

Type 1: Direct conversion — “Convert the binary number 101101₂ to denary.”

类型一:直接转换——”将二进制数 101101₂ 转换为十进制。”

Solution: 32 + 8 + 4 + 1 = 45₁₀.

解法:32 + 8 + 4 + 1 = 45₁₀。

Type 2: Word problem — “A computer stores a colour using 16 bits. Express the maximum value in hexadecimal.”

类型二:应用题——”一台计算机用 16 位存储一种颜色。用十六进制表示其最大值。”

Solution: 16 bits all set to 1 = 1111111111111111₂ = FFFF₁₆.

解法:16 位全部为 1 = 1111111111111111₂ = FFFF₁₆。

Type 3: Compare and explain — “Explain why hexadecimal is often used to represent binary values in computer science.”

类型三:比较与解释——”解释为什么计算机科学中常用十六进制表示二进制值。”

Key points: It is more compact than binary; conversion between binary and hex is quick and reliable; it reduces human error when reading long binary strings.

要点:它比二进制更紧凑;二进制与十六进制之间的转换快速可靠;它在读取长二进制串时减少人为错误。

Practice questions:

练习题目:

  • Convert 10101011₂ to decimal.
  • Convert 255₁₀ to binary.
  • Convert 3F₁₆ to decimal.
  • Convert 10011101₂ to hexadecimal.
  • Convert 257₁₀ to hexadecimal.
  • 将 10101011₂ 转换为十进制。
  • 将 255₁₀ 转换为二进制。
  • 将 3F₁₆ 转换为十进制。
  • 将 10011101₂ 转换为十六进制。
  • 将 257₁₀ 转换为十六进制。

Answers: 171₁₀; 11111111₂; 63₁₀; 9D₁₆; 101₁₆.

答案:171₁₀;11111111₂;63₁₀;9D₁₆;101₁₆。


12. Summary and Revision Checklist | 总结与复习清单

Mastering number systems requires practice. Keep the following key facts in mind:

掌握数制需要练习。请牢记以下关键要点:

  • Binary uses base 2, with place values 1, 2, 4, 8, 16, 32… (powers of 2).
  • Hexadecimal uses base 16 with digits 0-9 and A-F.
  • Octal uses base 8 with digits 0-7.
  • Each hex digit = 4 binary bits; each octal digit = 3 binary bits.
  • To convert from any base to decimal, multiply each digit by its place value and sum.
  • To convert from decimal to any base, divide successively by the base and read the remainders upward.
  • 二进制使用基数 2,位值为 1、2、4、8、16、32…(2 的幂)。
  • 十六进制使用基数 16,数字为 0-9 和 A-F。
  • 八进制使用基数 8,数字为 0-7。
  • 每个十六进制位 = 4 个二进制位;每个八进制位 = 3 个二进制位。
  • 要将任意进制转换为十进制,将每位数字乘以其位值并求和。
  • 要将十进制转换为任意进制,连续除以基数,然后向上读取余数。

Remember to always show your working in exams. Even if the final answer is wrong, correct working may earn partial marks. Regular practice with past paper questions is the best way to build speed and accuracy.

记住在考试中始终展示你的计算过程。即使最终答案有误,正确的步骤也可能获得部分分数。定期练习往年真题是提升速度和准确率的最佳方式。

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课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply

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

Exit mobile version