Data Representation in IGCSE AQA Computer Science | IGCSE AQA 计算机:数据表示 考点精讲

📚 Data Representation in IGCSE AQA Computer Science | IGCSE AQA 计算机:数据表示 考点精讲

Computers store and process all data – numbers, text, images, sound – as sequences of binary digits (bits). Understanding how different types of data are represented using binary, hexadecimal and various encoding schemes is fundamental to computer science. This article covers every key concept listed in the IGCSE AQA specification for data representation, including number bases, binary arithmetic, character sets, image and sound encoding, and compression techniques.

计算机以二进制数字(比特)序列的形式存储和处理所有数据——数字、文本、图像、声音。理解不同类型的数据如何用二进制、十六进制及各种编码方案表示,是计算机科学的基础。本文涵盖IGCSE AQA数据表示大纲中列出的每个关键概念,包括数制、二进制算术、字符集、图像与声音编码以及压缩技术。

1. Bits, Bytes and Measurement Units | 位、字节与计量单位

A bit (binary digit) is the smallest unit of data in a computer, holding either 0 or 1. A nibble is a group of 4 bits, and a byte consists of 8 bits. Larger units follow powers of 2: 1 kilobyte (KB) equals 1024 bytes, 1 megabyte (MB) is 1024 KB, 1 gigabyte (GB) is 1024 MB, and 1 terabyte (TB) is 1024 GB. These binary-based units are distinct from the decimal kilo (1000), though storage manufacturers sometimes use decimal measures.

比特(二进制位)是计算机中最小的数据单位,保存0或1。半个字节(nibble)是4位组,一个字节(byte)由8位组成。更大的单位遵循2的幂:1千字节(KB)等于1024字节,1兆字节(MB)为1024 KB,1千兆字节(GB)为1024 MB,1太字节(TB)为1024 GB。这些基于二进制的单位与十进制的千(1000)不同,尽管存储制造商有时使用十进制计量。

2. Converting Between Binary and Denary | 二进制与十进制转换

Denary (decimal) numbers use base 10 with digits 0–9. Binary uses base 2 with digits 0 and 1. To convert a binary number to denary, sum the place values where a 1 appears. 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 record the remainders, reading them from bottom to top. The largest value of an n-bit binary number is 2ⁿ – 1.

十进制数以10为基数,使用数字0–9。二进制以2为基数,使用数字0和1。要将二进制数转换为十进制,将出现1的位权值相加。例如,二进制数1101₂等于(1×8)+(1×4)+(0×2)+(1×1)= 十进制13。要将十进制转换为二进制,反复除以2并记录余数,从下往上读。一个n位二进制数的最大值为2ⁿ – 1。

3. Hexadecimal Number System | 十六进制数字系统

Hexadecimal (hex) uses base 16, with digits 0–9 and letters A–F representing values 10–15. Hex is used in computing as a more compact and human-readable way to represent binary sequences, since one hex digit corresponds exactly to four bits (a nibble). It is commonly seen in memory addresses, colour codes in web design (e.g., #FF0033) and error messages.

十六进制使用基数16,数字0–9和字母A–F分别表示值10–15。十六进制在计算中用作表示二进制序列的更紧凑、更易读的方式,因为一个十六进制数字恰好对应四个比特(半个字节)。它常见于内存地址、网页设计中的颜色代码(如#FF0033)和错误信息。

4. Binary-to-Hexadecimal and Hexadecimal-to-Binary Conversion | 二进制与十六进制相互转换

To convert binary to hex, split the binary number into nibbles (groups of four bits) starting from the right, then convert each nibble to its hex equivalent. For instance, 1101 0111₂ becomes D7₁₆ because 1101₂ = D and 0111₂ = 7. To convert hex to binary, replace each hex digit with its 4-bit binary form. Example: A5₁₆ = 1010 0101₂.

要将二进制转换为十六进制,从右侧开始将二进制数分割为半字节(四位一组),然后将每个半字节转换为相应的十六进制。例如,1101 0111₂ 变为 D7₁₆,因为 1101₂ = D,0111₂ = 7。要将十六进制转换为二进制,将每个十六进制数字替换为其4位二进制形式。示例:A5₁₆ = 1010 0101₂。

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

Binary addition follows these rules: 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, 1 + 1 = 0 carry 1, 1 + 1 + 1 = 1 carry 1. When adding two 8-bit numbers, if the result requires more than 8 bits, an overflow error occurs. The computer’s CPU has a status register with an overflow flag to indicate this. In an 8-bit system using two’s complement for signed numbers, overflow can cause an incorrect sign in the result.

二进制加法遵循以下规则:0+0=0,0+1=1,1+0=1,1+1=0进1,1+1+1=1进1。当两个8位数字相加,如果结果需要超过8位,则发生溢出错误。计算机的CPU有一个状态寄存器,其中包含溢出标志以指示此情况。在使用补码表示有符号数的8位系统中,溢出可能导致结果符号错误。

6. Binary Logical Shifts | 二进制逻辑移位

A logical shift moves all bits left or right and fills the vacant positions with zeros. A left shift of one place multiplies a binary number by 2; a right shift divides by 2 (integer division, discarding remainder). For example, 00001100 (12) shifted left once gives 00011000 (24). Shifting right once gives 00000110 (6). Left shifts can lead to overflow if bits are shifted out of the leftmost positions; right shifts lose the least significant bits. Logical shifts are used in low-level multiplication and division when speed is critical.

逻辑移位将所有位向左或向右移动,并用零填充空位。左移一位将二进制数乘以2;右移一位除以2(整数除法,丢弃余数)。例如,00001100(12)左移一位得到00011000(24)。右移一位得到00000110(6)。如果位被移出最左端位置,左移可能导致溢出;右移会丢失最低有效位。逻辑移位用于对速度要求高的底层乘法和除法。

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

Characters are represented by numeric codes. Standard ASCII uses 7 bits to encode 128 characters including control codes, uppercase/lowercase letters, digits and punctuation. Extended ASCII uses 8 bits for 256 characters, adding accented letters and symbols. Unicode was developed to represent virtually all writing systems globally. Common Unicode encodings include UTF-8 and UTF-16. UTF-8 is backward-compatible with ASCII and uses 1 to 4 bytes per character, allowing efficient storage of text in multiple languages.

字符由数字代码表示。标准ASCII使用7位编码128个字符,包括控制码、大小写字母、数字和标点符号。扩展ASCII使用8位表示256个字符,增加了重音字母和符号。Unicode的开发旨在表示全球几乎所有书写系统。常见的Unicode编码包括UTF-8和UTF-16。UTF-8与ASCII向后兼容,每个字符使用1到4字节,可以高效存储多语言文本。

8. Image Representation – Pixels, Resolution and Colour Depth | 图像表示 – 像素、分辨率与颜色深度

A bitmap image is made of a grid of pixels, each assigned a binary colour value. The image resolution is the total number of pixels (width × height), e.g. 1920 × 1080. Colour depth (bit depth) is the number of bits used for each pixel. With a colour depth of n bits, 2ⁿ different colours can be represented. For example, 8‑bit colour gives 256 colours, 24‑bit true colour gives 16.7 million colours. Metadata (width, height, colour depth) is stored alongside the pixel data.

位图图像由像素网格组成,每个像素分配一个二进制颜色值。图像分辨率是像素总数(宽×高),例如1920×1080。颜色深度(位深度)是每个像素使用的位数。在n位颜色深度下,可以表示2ⁿ种不同颜色。例如,8位颜色可显示256种颜色,24位真彩色可显示约1670万色。元数据(宽度、高度、颜色深度)与像素数据一同存储。

9. Calculating Image File Size | 图像文件大小计算

Image file size can be estimated using the formula:

File size (bits) = width × height × colour depth

Then convert to bytes by dividing by 8, and if needed to KB, MB etc. by dividing by 1024. Example: an image of 800 × 600 pixels with 24-bit colour depth requires 800 × 600 × 24 = 11,520,000 bits = 1,440,000 bytes ≈ 1.37 MB. Note that actual file sizes also include metadata and compression, so this is a theoretical minimum.

图像文件大小可以使用公式估算:

文件大小(位)= 宽 × 高 × 颜色深度

然后除以8转换为字节,如果需要KB、MB等,再除以1024。示例:800×600像素、24位颜色深度的图像需要800×600×24 = 11,520,000位 = 1,440,000字节 ≈ 1.37 MB。注意实际文件大小还包括元数据和压缩,因此这只是理论最小值。

10. Sound Representation – Sampling and Bit Depth | 声音表示 – 采样与位深度

Sound is analogue and must be digitised by sampling: measuring the amplitude of the sound wave at regular intervals. The sample rate is the number of samples taken per second, measured in hertz (Hz). A higher sample rate captures higher frequencies more accurately (Nyquist theorem: sample rate ≥ 2 × highest frequency). Bit depth (e.g. 16‑bit) is the number of bits per sample; it determines the precision of amplitude measurement. Higher bit depth gives a wider dynamic range and less quantisation noise.

声音是模拟信号,必须通过采样数字化:每隔固定时间测量声波的幅度。采样率是每秒采样的数量,以赫兹(Hz)为单位。更高的采样率可以更准确地捕捉较高频率(奈奎斯特定理:采样率 ≥ 2 × 最高频率)。位深度(如16位)是每个样本的位数,它决定了幅度测量的精度。更高的位深度提供更宽的动态范围和更低的量化噪声。

11. Calculating Sound File Size | 声音文件大小计算

Sound file size is calculated by:

File size (bits) = sample rate (Hz) × bit depth × duration (seconds) × number of channels

For a 10-second stereo audio clip at 44,100 Hz with 16‑bit depth, the minimum size is 44,100 × 16 × 10 × 2 = 14,112,000 bits = 1,764,000 bytes ≈ 1.68 MB. Compression techniques can reduce this substantially.

声音文件大小计算如下:

文件大小(位)= 采样率(Hz)× 位深度 × 时长(秒)× 声道数

对于10秒立体声音频片段,44,100 Hz采样率,16位深度,最小大小为44,100×16×10×2 = 14,112,000位 = 1,764,000字节 ≈ 1.68 MB。压缩技术可以大幅减小该数值。

12. Data Compression – Lossless and Lossy | 数据压缩 – 无损压缩与有损压缩

Compression reduces file size for storage and transmission. Lossless compression preserves all original data; examples include run-length encoding (RLE), dictionary-based methods (LZW) and file formats like PNG and FLAC. Lossy compression permanently removes some data to achieve higher compression ratios, exploiting limitations of human perception. Common lossy formats include JPEG for images and MP3 for audio. The choice depends on whether exact reproduction is required. AQA candidates should understand the principles and be able to compare both types.

压缩可减小文件大小,便于存储和传输。无损压缩保留所有原始数据;例子包括游程编码(RLE)、基于字典的方法(LZW)以及PNG和FLAC等文件格式。有损压缩永久移除部分数据以获取更高压缩比,利用人类感知的局限性。常见的有损格式包括图像的JPEG和音频的MP3。选择取决于是否需要精确再现。AQA考生应理解其原理并能够比较两种类型。


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