Binary: Exam-Focused Revision for IGCSE AQA Computer Science | 二进制:IGCSE AQA 计算机科学考点精讲

📚 Binary: Exam-Focused Revision for IGCSE AQA Computer Science | 二进制:IGCSE AQA 计算机科学考点精讲

Binary is the fundamental language of all modern computers. In IGCSE AQA Computer Science, a solid grasp of binary – from number base conversions and binary arithmetic to data representation – is essential for exam success. This revision guide breaks down each core concept, pairing clear English explanations with Chinese translations, so you can master the topic thoroughly.

二进制是现代计算机的基础语言。在 IGCSE AQA 计算机科学中,牢牢掌握二进制——从数制转换、二进制算术到数据表示——是考试成功的关键。这份复习指南拆解每个核心概念,将清晰的英文解释与中文翻译配对呈现,帮助你彻底掌握这个主题。


1. Number Bases: Decimal, Binary and Hexadecimal | 数制:十进制、二进制与十六进制

The number system we use every day is base-10 (decimal), with digits 0 to 9. Computers, however, operate using base-2 (binary), where only two digits, 0 and 1, exist. For humans, long binary strings are hard to read, so base-16 (hexadecimal) is used as a shorthand. Hexadecimal uses digits 0-9 and letters A-F, where A=10, B=11, …, F=15.

我们日常使用的数制是基数为 10 的十进制,数字为 0 到 9。然而,计算机使用基数为 2 的二进制,只存在 0 和 1 两个数字。对人类来说,长串二进制难以阅读,因此基数为 16 的十六进制被用作简写。十六进制使用数字 0-9 和字母 A-F,其中 A=10,B=11,……,F=15。

Each digit in a number has a place value based on the base raised to a power. For decimal, the place values are … 10²=100, 10¹=10, 10⁰=1. For binary, place values are powers of 2: … 2³=8, 2²=4, 2¹=2, 2⁰=1. For hexadecimal, place values are powers of 16: … 16²=256, 16¹=16, 16⁰=1.

一个数中的每一位都有一个基于基数的幂的位值。对于十进制,位值是 …… 10²=100,10¹=10,10⁰=1。对于二进制,位值是 2 的幂:…… 2³=8,2²=4,2¹=2,2⁰=1。对于十六进制,位值是 16 的幂:…… 16²=256,16¹=16,16⁰=1。


2. Converting Between Binary and Decimal | 二进制与十进制相互转换

To convert a binary number to decimal, write down the binary digits under their place values (powers of 2) and add up the values where a 1 appears. For example, binary 10110₂: place values are 16, 8, 4, 2, 1. The digits 1,0,1,1,0 give 16 + 4 + 2 = 22 in decimal.

要将二进制数转换为十进制,在各位位值(2 的幂)下写下二进制数字,然后相加出现 1 的那些位值。例如,二进制 10110₂:位值分别为 16、8、4、2、1。数字 1、0、1、1、0 得出 16 + 4 + 2 = 22(十进制)。

To convert decimal to binary, repeatedly divide the decimal number by 2 and record the remainders. Read the remainders from bottom to top to get the binary equivalent. For 22: 22 ÷ 2 = 11 r 0, 11 ÷ 2 = 5 r 1, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1. Reading from the last remainder upwards gives 10110₂.

要将十进制转换为二进制,反复将十进制数除以 2,记录余数。从下往上读取余数即可得到二进制等价物。对于 22:22 ÷ 2 = 11 余 0,11 ÷ 2 = 5 余 1,5 ÷ 2 = 2 余 1,2 ÷ 2 = 1 余 0,1 ÷ 2 = 0 余 1。从最后一个余数向上读取得到 10110₂。


3. Converting Between Hexadecimal and Binary/Decimal | 十六进制与二进制/十进制转换

Hexadecimal to binary is straightforward: each hex digit corresponds to a nibble (4 bits). For example, hex 2F: 2 is 0010, F (15) is 1111, so 2F₁₆ = 0010 1111₂, often written as 101111₂. To convert binary to hex, group bits in fours from the right, then convert each nibble.

十六进制转二进制很简单:每个十六进制数字对应一个半字节(4 位)。例如,十六进制 2F:2 是 0010,F (15) 是 1111,所以 2F₁₆ = 0010 1111₂,通常写作 101111₂。要将二进制转换为十六进制,从右每四位一组,然后转换每个半字节。

Hex to decimal uses place values of 16. For 2F₁₆: (2×16¹) + (15×16⁰) = 32 + 15 = 47₁₀. Decimal to hex can be done by repeated division by 16, recording remainders (use letters for 10-15).

十六进制转十进制使用 16 的位值。对于 2F₁₆:(2×16¹) + (15×16⁰) = 32 + 15 = 47₁₀。十进制转十六进制可以通过反复除以 16,记录余数(10-15 使用字母)来完成。


4. Binary Addition and Overflow | 二进制加法与溢出

Binary addition follows simple rules: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (write 0, carry 1), 1+1+carry=11 (write 1, carry 1). Add two binary numbers column by column from the rightmost bit, just like decimal addition.

二进制加法遵循简单规则:0+0=0,0+1=1,1+0=1,1+1=10(写 0,进位 1),1+1+进位 = 11(写 1,进位 1)。就像十进制加法一样,从最右边的位开始逐列将两个二进制数相加。

When the result of an addition exceeds the maximum value that can be stored in a fixed number of bits, an overflow error occurs. For example, in an 8-bit system, adding 10000000₂ (128) + 10000000₂ (128) would give a 9-bit result (1 00000000₂) that cannot fit into 8 bits. The most significant bit is lost, causing an incorrect answer.

当相加的结果超出固定位数所能存储的最大值时,就会发生溢出错误。例如,在一个 8 位系统中,将 10000000₂ (128) 与 10000000₂ (128) 相加会得到一个 9 位结果 (1 00000000₂),无法放进 8 位中。最高位丢失,导致答案错误。


5. Binary Shifts (Logical) | 二进制移位

A left shift moves all bits one position to the left, inserting a 0 at the rightmost bit. Each left shift multiplies the original number by 2. For example, 00001100₂ (12) left shifted once becomes 00011000₂ (24). A right shift moves bits to the right, inserting 0 at the leftmost bit, and effectively divides by 2 (ignoring remainders). So 00011000₂ (24) right shifted once gives 00001100₂ (12).

左移将所有位向左移动一位,在最右位插入 0。每次左移将原数乘以 2。例如,00001100₂ (12) 左移一位变成 00011000₂ (24)。右移将位向右移动,在最左位插入 0,相当于除以 2(忽略余数)。因此,00011000₂ (24) 右移一位得到 00001100₂ (12)。

Be careful with shifts that push a ‘1’ bit out: that bit is lost, which can cause data loss. Also, logical shifts do not preserve the sign; they are used for unsigned integers. (Arithmetic shifts preserve the sign bit for signed numbers, but logical shifts are what AQA primarily tests at this level.)

注意:当移位将 ‘1’ 位移出时,该位会丢失,这可能导致数据丢失。此外,逻辑移位不保留符号;它们用于无符号整数。(算术移位为有符号数保留符号位,但在这个级别,AQA 主要考查逻辑移位。)


6. Negative Numbers: Sign-Magnitude and Two’s Complement | 负数表示:原码与补码

The simplest way to represent negative numbers is sign-magnitude: the leftmost bit is the sign (0=positive, 1=negative) and the remaining bits store the magnitude. For example, in 8-bit sign-magnitude, +12 is 00001100, and -12 is 10001100. However, this method leads to two zeros (+0 and -0) and complicates arithmetic.

表示负数的最简单方法是原码:最左位是符号位(0=正,1=负),其余位存储数值大小。例如,在 8 位原码中,+12 为 00001100,-12 为 10001100。然而,这种方法会导致两个零(+0 和 -0),并使算术运算复杂化。

Two’s complement is the standard method in modern computers. To find the two’s complement of a number, invert all bits (find the one’s complement) and add 1. Using 8 bits, +12 = 00001100. For -12: invert bits → 11110011, then add 1 → 11110100. The most significant bit still indicates sign (1 for negative), and there is only one zero (00000000).

补码(二进制补码)是现代计算机使用的标准方法。要找到一个数的补码,将所有位取反(求反码),然后加 1。使用 8 位,+12 = 00001100。对于 -12:取反位 → 11110011,然后加 1 → 11110100。最高位仍然指示符号(1 表示负),并且只有一个零(00000000)。

To convert a negative two’s complement number back to decimal: note the most significant bit is 1, so treat the whole binary as a negative value. The value is -128 + (remaining bits as positive). For 11110100: the leading bit is 1 (-128), the rest 1110100 = 116, so the number is -128 + 116 = -12.

要将负的补码数转换回十进制:注意最高位为 1,因此将整个二进制视为负值。数值为 -128 +(剩余位正数值)。对于 11110100:前导位为 1(-128),其余 1110100 = 116,因此数值为 -128 + 116 = -12。


7. Character Encoding: ASCII and Unicode | 字符编码:ASCII 与 Unicode

Computers store characters as binary codes. The American Standard Code for Information Interchange (ASCII) uses 7 bits to represent 128 characters, including English letters, digits, punctuation and control codes. For example, ‘A’ is 65 (01000001). Extended ASCII uses 8 bits, giving 256 characters.

计算机以二进制代码存储字符。美国信息交换标准代码(ASCII)使用 7 位表示 128 个字符,包括英文字母、数字、标点符号和控制码。例如,’A’ 是 65(01000001)。扩展 ASCII 使用 8 位,提供 256 个字符。

ASCII cannot represent characters from all global languages. Unicode was developed to solve this, supporting over 143,000 characters across multiple scripts. Unicode standards like UTF-8 are backward compatible with ASCII but use variable-length encoding (1 to 4 bytes per character). UTF-8 is widely used on the web.

ASCII 无法表示来自全球所有语言的字符。Unicode 的制定解决了这个问题,它支持超过 143,000 个字符,涵盖多种书写系统。UTF-8 等 Unicode 标准向后兼容 ASCII,但使用变长编码(每个字符 1 到 4 字节)。UTF-8 在网络上被广泛使用。


8. Representing Images: Pixels and Colour Depth | 图像表示:像素与颜色深度

Bitmap images are made up of a grid of tiny dots called pixels. Each pixel is assigned a binary value representing its colour. The colour depth is the number of bits used for each pixel. A 1-bit image can display only 2 colours (0=black, 1=white, for example). An 8-bit colour depth allows 2⁸ = 256 colours, and 24-bit (True Colour) uses 8 bits for each red, green and blue component, producing 2²⁴ ≈ 16.7 million colours.

位图图像由称为像素的小点网格组成。每个像素被分配一个表示其颜色的二进制值。颜色深度是每个像素使用的位数。1 位图像只能显示 2 种颜色(例如 0=黑色,1=白色)。8 位颜色深度允许 2⁸ = 256 种颜色,而 24 位(真彩色)为每个红色、绿色和蓝色分量使用 8 位,产生 2²⁴ ≈ 1670 万种颜色。

The resolution of an image is the number of pixels in the width and height (e.g., 1920×1080). Increasing resolution or colour depth improves image quality but increases file size. Metadata (like width, height, colour depth, date created) is also stored in the image file.

图像的分辨率是宽度和高度的像素数(例如 1920×1080)。提高分辨率或颜色深度可以改善图像质量,但会增加文件大小。元数据(如宽度、高度、颜色深度、创建日期)也存储在图像文件中。


9. Representing Sound: Sampling and Bit Rate | 声音表示:采样与比特率

Sound is analog and continuous, so to store it digitally, we take samples of the sound wave at regular intervals. The sample rate is the number of samples taken per second, measured in hertz (Hz). A typical CD-quality sample rate is 44,100 Hz (44.1 kHz), meaning 44,100 samples per second.

声音是模拟且连续的,因此要将其数字化存储,我们以固定间隔对声波进行采样。采样率是每秒采集的样本数,以赫兹(Hz)为单位。典型的 CD 质量采样率为 44,100 Hz(44.1 kHz),意味着每秒 44,100 个样本。

Bit depth (or sample resolution) is the number of bits used to record each sample. CD audio uses 16 bits per sample, allowing 2¹⁶ = 65,536 different amplitude levels. Higher sample rate and bit depth produce better sound quality but result in larger files.

位深度(或采样分辨率)是用于记录每个样本的位数。CD 音频使用每个样本 16 位,允许 2¹⁶ = 65,536 个不同的振幅级别。更高的采样率和位深度产生更好的音质,但也会导致更大的文件。

Bit rate is calculated as: sample rate × bit depth × number of channels (e.g., 44100 × 16 × 2 for stereo ≈ 1.41 Mbps). This rate directly affects file size and streaming bandwidth.

比特率计算为:采样率 × 位深度 × 声道数(例如,立体声为 44100 × 16 × 2 ≈ 1.41 Mbps)。这个速率直接影响文件大小和流媒体带宽。


10. File Size Calculations | 文件大小计算

Estimating file sizes is a key exam skill. Use these formulas, remembering to convert bits to bytes: 1 byte = 8 bits, 1 kilobyte (KB) = 1000 bytes (in decimal; sometimes 1024 in some contexts but exam will specify).

估算文件大小是一项关键的考试技能。使用以下公式,记住将位转换为字节:1 字节 = 8 位,1 千字节(KB)= 1000 字节(十进制;有时在某些上下文中是 1024,但考试会明确说明)。

Image file size (bits) = width in pixels × height in pixels × colour depth in bits. For a 200×300 image with 24-bit colour: 200 × 300 × 24 = 1,440,000 bits = 180,000 bytes ≈ 180 KB.

图像文件大小(位)= 宽度(像素)× 高度(像素)× 颜色深度(位)。对于 200×300 图像,24 位颜色:200 × 300 × 24 = 1,440,000 位 = 180,000 字节 ≈ 180 KB。

Sound file size (bits) = sample rate (Hz) × bit depth × duration (seconds) × number of channels. For 1 minute of stereo CD-quality audio: 44100 × 16 × 60 × 2 = 84,672,000 bits ≈ 10.58 MB.

声音文件大小(位)= 采样率(Hz)× 位深度 × 时长(秒)× 声道数。对于 1 分钟的立体声 CD 质量音频:44100 × 16 × 60 × 2 = 84,672,000 位 ≈ 10.58 MB。


11. Compression: Lossy vs Lossless | 压缩:有损与无损

Compression reduces file size for storage or transmission. Lossless compression reduces file size without losing any data; the original file can be perfectly reconstructed. Common algorithms like run-length encoding (RLE) are used for text or BMP images. For example, in RLE, ‘AAAABB’ might become ‘4A2B’.

压缩可减少文件大小以便存储或传输。无损压缩减小文件大小而不丢失任何数据,原始文件可以完美重建。像游程编码(RLE)这样的常用算法用于文本或 BMP 图像。例如,在 RLE 中,’AAAABB’ 可能变成 ‘4A2B’。

Lossy compression permanently removes some data, aiming to discard less noticeable information. It achieves much smaller file sizes, but the original cannot be restored exactly. JPEG is lossy for images; MP3 is lossy for audio. The exam expects you to distinguish between the two and explain trade-offs between file size and quality.

有损压缩会永久性地移除一些数据,旨在丢弃不太引人注意的信息。它能实现更小的文件大小,但原始文件无法精确恢复。JPEG 对图像是有损的;MP3 对音频是有损的。考试要求你区分二者,并解释文件大小与质量之间的权衡。

Choosing the right compression depends on the situation: for archiving text, lossless is essential; for streaming music, lossy may be acceptable to save bandwidth.

选择正确的压缩方式取决于场景:存档文本必须用无损压缩;而流媒体音乐为了节省带宽,有损压缩可能可以接受。


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