📚 IGCSE Edexcel Computer Science: Data Representation Key Points | IGCSE Edexcel 计算机:数据表示 考点精讲
Data representation is the foundation of all computer systems. In the IGCSE Edexcel Computer Science syllabus, you are expected to understand how numbers, text, images and sound are stored and processed in binary. Mastering these concepts will not only help you in exams but also give you a deep appreciation of the digital world.
数据表示是所有计算机系统的基础。在 IGCSE Edexcel 计算机科学大纲中,你需要理解数字、文本、图像和声音是如何以二进制形式存储和处理的。掌握这些概念不仅有助于考试,还会让你对数字世界有更深的理解。
1. Why Binary? | 为什么使用二进制?
Computers use binary because they are built from billions of tiny switches called transistors, which can be either ON (1) or OFF (0). This two‑state system is simple, reliable and less prone to errors than systems with more states. Binary also maps perfectly to Boolean logic, which is the basis of all processing inside the CPU.
计算机使用二进制,因为它们由数十亿个称为晶体管的微小开关组成,这些开关只能是开 (1) 或关 (0)。这种双态系统简单、可靠,并且比多态系统更不容易出错。二进制还完美地对应了布尔逻辑,而布尔逻辑是 CPU 内部所有处理的基础。
2. Binary and Denary Conversion | 二进制与十进制转换
A denary (decimal) number uses ten digits, 0–9, while binary uses only 0 and 1. To convert a binary number to denary, multiply each binary digit by its place value (powers of 2) and add the results. For example, the binary number 1101₂ equals (1 × 8) + (1 × 4) + (0 × 2) + (1 × 1) = 13 in denary. To convert denary to binary, repeatedly divide by 2 and read the remainders backwards.
十进制数使用 0–9 十个数字,而二进制只使用 0 和 1。要将二进制数转换为十进制,只需将每个二进制位乘以相应的位权(2 的幂)并相加。例如,二进制数 1101₂ = (1 × 8) + (1 × 4) + (0 × 2) + (1 × 1) = 13(十进制)。要将十进制转换为二进制,则反复除以 2,然后将余数倒序读取。
3. Hexadecimal and Binary | 十六进制与二进制
Hexadecimal (base 16) uses digits 0–9 and letters A–F, where A = 10, B = 11, …, F = 15. It is widely used in computing because one hex digit represents exactly four binary digits (a nibble), making long binary sequences much easier for humans to read and debug. For instance, the binary 1011 1100 can be split into 1011 (B) and 1100 (C), giving BC₁₆. Conversion between hex and binary is straightforward: just group bits into nibbles and convert each one.
十六进制(基数为 16)使用数字 0–9 和字母 A–F,其中 A = 10,B = 11,……,F = 15。它在计算中广泛使用,因为一个十六进制位恰好代表四个二进制位(半字节),使人们能够更轻松地阅读和调试长二进制序列。例如,二进制数 1011 1100 可以拆分为 1011 (B) 和 1100 (C),得到 BC₁₆。十六进制与二进制之间的转换很简单:只需将位数按半字节分组,然后分别转换即可。
4. Signed Integers: Sign‑Magnitude and Two’s Complement | 有符号整数:符号-幅值与补码
Positive numbers are stored in straightforward binary, but negative numbers require a special encoding. In sign‑magnitude, the most significant bit (MSB) indicates the sign (0 for positive, 1 for negative) and the remaining bits show the magnitude. For example, in an 8‑bit system, +12 is 00001100 and –12 is 10001100. However, sign‑magnitude allows two representations of zero (00000000 and 10000000) and complicates arithmetic.
正数以直接二进制形式存储,但负数需要特殊编码。在符号-幅值表示法中,最高有效位 (MSB) 表示符号(0 为正,1 为负),其余位表示数值大小。例如,在 8 位系统中,+12 是 00001100,而 –12 是 10001100。然而,符号-幅值会导致零有两种表示方式(00000000 和 10000000),并且使算术运算变得复杂。
Two’s complement overcomes these problems. To obtain the two’s complement of a negative number: write the positive binary, invert all bits (one’s complement), then add 1. For –12: +12 is 00001100; invert → 11110011; add 1 → 11110100. Two’s complement has only one zero and allows subtraction to be performed by addition.
补码(二进制补码)克服了这些问题。要获得一个负数的补码:先写出正数的二进制形式,将所有位取反(反码),然后加 1。以 –12 为例:+12 是 00001100;取反 → 11110011;加 1 → 11110100。补码只有一种零的表示,并且可以通过加法实现减法运算。
–N = (Invert bits of +N) + 1
5. Binary Addition and Overflow | 二进制加法与溢出
Binary addition follows the same principles as denary addition, carrying over when the sum of a column reaches or exceeds 2. The rules are: 0 + 0 = 0; 0 + 1 = 1; 1 + 0 = 1; 1 + 1 = 0 carry 1; 1 + 1 + 1 (from a previous carry) = 1 carry 1. When two 8‑bit numbers are added and the result requires 9 bits, an overflow error occurs if the computer can only store 8 bits. Overflow happens when the result is outside the range that can be represented with the given number of bits.
二进制加法遵循与十进制加法相同的原则,当某一列的和达到或超过 2 时产生进位。规则为:0 + 0 = 0;0 + 1 = 1;1 + 0 = 1;1 + 1 = 0 进位 1;1 + 1 + 1(来自前一位的进位)= 1 进位 1。当两个 8 位数相加,结果需要 9 位时,如果计算机只能存储 8 位,就会发生溢出错误。当结果超出了给定位数所能表示的范围时,就会产生溢出。
6. Logical Shifts | 逻辑移位
A logical shift moves all bits in a register to the left or right, filling vacant positions with zeros. A left shift by one place multiplies the binary number by 2; a right shift by one place divides by 2 (for unsigned integers). For example, 00101100 (44) shift left → 01011000 (88); shift right → 00010110 (22). Logical shifts are extremely fast operations used in multiplication and division by powers of two.
逻辑移位将寄存器中的所有位向左或向右移动,空出的位用零填充。左移一位相当于将二进制数乘以 2;右移一位相当于除以 2(针对无符号整数)。例如,00101100 (44) 左移 → 01011000 (88);右移 → 00010110 (22)。逻辑移位是非常快速的操作,常用于乘除 2 的幂。
7. Character Encoding: ASCII and Unicode | 字符编码:ASCII 与 Unicode
Text characters are represented inside computers by assigning each character a unique binary code. The 7‑bit ASCII standard (extended ASCII uses 8 bits) can represent 128 characters, including English letters, digits, punctuation and control codes. For example, ‘A’ is 65 (01000001), ‘a’ is 97 (01100001). However, ASCII cannot encode characters from other writing systems or emojis.
文本字符在计算机内部通过为每个字符分配唯一的二进制代码来表示。7 位 ASCII 标准(扩展 ASCII 使用 8 位)可以表示 128 个字符,包括英文字母、数字、标点符号和控制码。例如,‘A’ 是 65 (01000001),‘a’ 是 97 (01100001)。然而,ASCII 无法编码其他书写系统的字符或表情符号。
Unicode was developed to provide a unique code for every character in all languages. It uses up to 32 bits per character and can represent over a million code points. UTF‑8 is a widely used variable‑length encoding that is backward compatible with ASCII. In exams, you should know that Unicode requires more storage space but ensures global compatibility.
Unicode 应运而生,旨在为所有语言的每一个字符提供唯一代码。它每个字符最多使用 32 位,可以表示超过一百万个码点。UTF‑8 是一种广泛使用的可变长度编码,向后兼容 ASCII。在考试中,你应该了解 Unicode 需要更多存储空间,但确保了全球兼容性。
8. Representing Images | 图像表示
Images on a screen are made up of tiny dots called pixels. In a black‑and‑white image, each pixel is stored as a single bit (1 for white, 0 for black). For colour images, each pixel is given a binary value representing the amounts of red, green and blue (RGB). A common representation uses 24 bits per pixel: 8 bits for each colour component, giving 2²⁴ possible colours (over 16 million). The resolution of an image is the number of pixels in the grid, e.g. 1920 × 1080. Higher resolution and greater colour depth produce better image quality but increase file size.
屏幕上的图像由称为像素的微小点组成。在黑白图像中,每个像素存储为单个位(1 表示白,0 表示黑)。对于彩色图像,每个像素被赋予一个二进制值,表示红、绿、蓝 (RGB) 的强度。常见的表示方式为每像素 24 位:每个颜色分量 8 位,可产生 2²⁴ 种可能的颜色(超过 1600 万种)。图像的分辨率是网格中的像素数量,例如 1920 × 1080。更高的分辨率和更大的颜色深度会带来更好的图像质量,但也会增加文件大小。
Image file size (bits) = width × height × colour depth
9. Representing Sound | 声音表示
Sound is analogue by nature, so it must be converted into digital data by sampling. The analogue sound wave is measured at regular intervals (sample rate, measured in Hz) and each measurement is stored as a binary number (bit depth). The sample rate determines how accurately the waveform is captured: common rates are 44.1 kHz (CD quality) and 48 kHz. Bit depth controls the dynamic range; 16‑bit audio provides 65,536 discrete levels. The file size of an uncompressed sound clip can be calculated using the formula:
声音本质上是模拟信号,因此必须通过采样转换为数字数据。模拟声波以固定间隔被测量(采样频率,单位为 Hz),每次测量结果存储为二进制数(位深度)。采样频率决定了波形的捕获精度:常见的频率有 44.1 kHz(CD 质量)和 48 kHz。位深度控制动态范围;16 位音频提供 65536 个离散级别。未压缩音频片段的大小可使用以下公式计算:
File size (bits) = sample rate (Hz) × bit depth × duration (s) × number of channels
Increasing sample rate or bit depth improves fidelity but creates larger files, just like adding more pixels to an image.
提高采样频率或位深度可以提高保真度,但会生成更大的文件,就像给图像增加更多像素一样。
10. Data Compression | 数据压缩
Data compression reduces file size, making storage and transmission more efficient. There are two main types:
数据压缩可以减小文件大小,使存储和传输更加高效。主要有两种类型:
- Lossy compression permanently removes some data deemed less important. It is commonly used for images (JPEG), sound (MP3) and video (MPEG). The file cannot be restored to the original quality, but the reduction in size can be dramatic.
- 有损压缩会永久性地移除一些被认为不太重要的数据。它通常用于图像 (JPEG)、声音 (MP3) 和视频 (MPEG)。文件无法恢复到原始质量,但尺寸可以大幅减小。
- Lossless compression takes advantage of patterns and redundancy to encode data more efficiently without losing any information. Examples include run‑length encoding (RLE) for simple graphics and ZIP for documents. The original data can be perfectly reconstructed.
- 无损压缩利用模式和冗余来更高效地编码数据,而不丢失任何信息。例如针对简单图形的游程编码 (RLE) 以及针对文档的 ZIP。原始数据可以被完美还原。
In the exam, you may be asked to explain the difference and give suitable uses for each type. Remember that repeated text, such as ‘AAAA’ can be stored as ‘4A’ in RLE, which is a classic exam example.
在考试中,你可能会被要求解释两者的区别,并给出每种类型的适当用途。请记住,重复的文本,如 ‘AAAA’ 在游程编码中可以存储为 ‘4A’,这是一个经典的考试示例。
11. Units of Data and Storage | 数据单位与存储
Understanding the terminology for data sizes is essential. The smallest unit is the bit (b). A nibble is 4 bits, and a byte (B) is 8 bits. From there, the sequence follows powers of 2, though in some contexts decimal prefixes are used. The IGCSE syllabus uses the binary prefixes: kibibyte (KiB) = 2¹⁰ bytes, mebibyte (MiB) = 2²⁰, gibibyte (GiB) = 2³⁰, and tebibyte (TiB) = 2⁴⁰. You should also know the common metric terms (KB, MB, GB, TB) as they often appear in computer specifications.
理解数据大小的术语至关重要。最小单位是比特 (b)。半字节 (nibble) 是 4 位,字节 (B) 是 8 位。以此类推,序列遵循 2 的幂次,尽管在某些场合也会使用十进制前缀。IGCSE 大纲使用二进制前缀:kibibyte (KiB) = 2¹⁰ 字节,mebibyte (MiB) = 2²⁰,gibibyte (GiB) = 2³⁰,tebibyte (TiB) = 2⁴⁰。你还需要了解常见的十进制术语(KB、MB、GB、TB),因为它们经常出现在计算机规格中。
12. Exam Tips and Key Formula Summary | 考试技巧与关键公式汇总
When tackling data representation questions, always show your working, especially in binary–denary conversions and addition. Keep these essential formulas in mind:
在解答数据表示问题时,务必展示你的计算步骤,尤其是在二进制与十进制转换和加法运算中。请牢记以下关键公式:
| Concept | Formula / Key Point |
|---|---|
| Binary → Denary | Sum of (bit × 2⁽ⁿ⁻¹⁾) |
| Two’s complement | Invert + 1; MSB as –2⁽ⁿ⁻¹⁾ |
| Bitmap image size | Width × height × bit depth (pixels × bits) |
| Sound file size | Sample rate × bit depth × duration × channels |
| Range of n‑bit unsigned | 0 to 2ⁿ – 1 |
| Range of n‑bit two’s complement | –2⁽ⁿ⁻¹⁾ to 2⁽ⁿ⁻¹⁾ – 1 |
Check for overflow in binary addition, and remember that logical shifts do not preserve the sign in two’s complement — for that you would need arithmetic shifts, which are not explicitly required at this level but are useful background knowledge.
在二进制加法中要检查溢出,并记住逻辑移位不会保留补码中的符号位——为此需要算术移位,虽然该级别不明确要求,但作为背景知识很有用。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply