IGCSE Computer Science: Data Storage & File Compression | IGCSE计算机:数据存储与文件压缩

📚 IGCSE Computer Science: Data Storage & File Compression | IGCSE计算机:数据存储与文件压缩

In the IGCSE Computer Science syllabus (CIE 0478), candidates must understand how data is represented in binary, how storage requirements are calculated, and how file compression reduces the size of data. These concepts are fundamental to almost every aspect of computing, from saving a photograph to streaming a video over the internet.

在 IGCSE 计算机科学(CIE 0478)考纲中,考生需要理解数据如何以二进制表示、如何计算存储需求,以及文件压缩如何减小数据体积。这些概念几乎是计算机领域一切应用的基础,从保存一张照片到在互联网上流媒体播放视频,都离不开它们。

This article covers all key ideas, including bits and bytes, units of storage, file size calculations, and both lossless and lossy compression. By the end, you will have a clear revision guide for the exam.

本文将涵盖所有关键知识点,包括比特与字节、存储单位、文件大小计算,以及无损压缩和有损压缩。学完本文,你将获得一份清晰的考试复习指南。


1. Bits and Bytes | 比特与字节

A computer stores all data as binary digits, known as bits. A single bit can have one of two values: 0 or 1. Eight bits grouped together form one byte. One byte can represent 256 different values (2⁸ = 256), which is enough to encode a single character such as ‘A’ or ‘7’ using ASCII.

计算机将所有数据以二进制数字存储,这种数字称为比特(bit)。一个比特只能取两个值之一:0 或 1。八个比特组合在一起构成一个字节(byte)。一个字节可以表示 256 种不同的值(2⁸ = 256),足以用 ASCII 编码一个字符,例如 ‘A’ 或 ‘7’。

It is crucial to remember the difference: a bit is the smallest unit of data, while a byte is the basic addressable unit in most computer systems.

务必牢记两者的区别:比特是最小的数据单位,而字节是大多数计算机系统中最基本的可寻址单位。


2. Units of Storage | 存储单位

The table below shows the common units you need to know for the IGCSE exam. All units follow powers of 2, except for some marketing contexts where 1000 is used.

下表列出了 IGCSE 考试中需要掌握的常见存储单位。除部分商业宣传场景使用 1000 外,这些单位均以 2 的幂次递增。

Unit Size Approx. Value
Bit 1 binary digit 0 or 1
Nibble 4 bits 16 values
Byte 8 bits 256 values
Kilobyte (KB) 2¹⁰ bytes = 1024 bytes approx. 10³ bytes
Megabyte (MB) 2²⁰ bytes = 1,048,576 bytes approx. 10⁶ bytes
Gigabyte (GB) 2³⁰ bytes = 1,073,741,824 bytes approx. 10⁹ bytes
Terabyte (TB) 2⁴⁰ bytes approx. 10¹² bytes

A common exam question asks: ‘How many bits are there in 2 MB?’ The correct method is to multiply: 2 × 1024 × 1024 × 8 = 16,777,216 bits.

一个常见考题是:’2 MB 中有多少比特?’ 正确方法是相乘:2 × 1024 × 1024 × 8 = 16,777,216 比特。


3. How Characters Are Stored | 字符的存储方式

Text characters are stored using character codes. The two main systems are ASCII (American Standard Code for Information Interchange) and Unicode. ASCII uses 7 bits to represent 128 characters, but it is often stored in one byte. Unicode supports many more characters, including Chinese, emoji, and other symbols, and can use 16 or 32 bits per character.

文本字符通过字符编码存储。两大主要系统是 ASCII(美国信息交换标准码)和 Unicode。ASCII 使用 7 位表示 128 个字符,但通常以一个字节存储。Unicode 支持更多字符,包括中文、表情符号及其他符号,每个字符可使用 16 位或 32 位。

For IGCSE, you should be able to state that the ASCII code for ‘A’ is 65 in decimal (binary 01000001), and ‘a’ is 97. You do not need to memorise the full table, but you must understand the principle.

在 IGCSE 中,你应该能说出字符 ‘A’ 的 ASCII 码是十进制 65(二进制 01000001),’a’ 是 97。你不需要背下完整编码表,但必须理解其原理。


4. How Images Are Stored | 图像的存储方式

A digital image is made up of tiny squares called pixels (picture elements). Each pixel stores a colour value. The number of bits per pixel (colour depth) determines how many colours can be displayed. For example, a 1-bit image can show only 2 colours (usually black and white), while an 8-bit image can show 2⁸ = 256 colours, and a 24-bit image can show 2²⁴ = 16,777,216 colours (true colour).

数字图像由称为像素的微小方格组成。每个像素存储一个颜色值。每像素位数(颜色深度)决定了可显示的颜色数量。例如,1 位图像只能显示 2 种颜色(通常是黑和白),8 位图像可显示 2⁸ = 256 种颜色,而 24 位图像可显示 2²⁴ = 16,777,216 种颜色(真彩色)。

The file size of an uncompressed image is calculated using:

未压缩图像的文件大小计算公式为:

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

For example, an image that is 1920 pixels wide, 1080 pixels high, and has a colour depth of 24 bits has a file size of 1920 × 1080 × 24 = 49,766,400 bits, which is about 5.93 MB.

例如,一张宽 1920 像素、高 1080 像素、颜色深度为 24 位的图像,其文件大小约为 1920 × 1080 × 24 = 49,766,400 比特,约 5.93 MB。


5. How Sound Is Stored | 声音的存储方式

Sound waves are analogue signals, but computers store sound in digital form. To do this, a process called sampling is used. The sound wave is measured at regular intervals. The number of samples taken per second is the sampling rate (measured in hertz, Hz). Each sample is assigned a value, and the number of bits used per sample is the sample resolution (or bit depth).

声波是模拟信号,但计算机以数字形式存储声音。为此需要一种称为采样的过程。声波以固定时间间隔被测量。每秒采集的样本数量称为采样率(单位是赫兹 Hz)。每个样本被赋予一个数值,每个样本使用的比特数称为采样精度(或位深)。

The formula for an uncompressed sound file is:

未压缩声音文件的计算公式为:

File size (bits) = sampling rate × sample resolution × duration (seconds)

For a stereo recording, you must multiply by 2 (the number of channels). For example, a 30-second stereo recording with a sampling rate of 44,100 Hz and 16-bit resolution has a file size of 44,100 × 16 × 30 × 2 = 42,336,000 bits, which is about 5.04 MB.

对于立体声录音,还需要乘以 2(声道数)。例如,一段 30 秒的立体声录音,采样率为 44,100 Hz,位深 16 位,其文件大小为 44,100 × 16 × 30 × 2 = 42,336,000 比特,约 5.04 MB。


6. Why Compression Is Needed | 为什么需要压缩

Large files consume storage space and increase transmission time. Compression reduces the number of bits needed to represent data, making files easier to store and faster to transfer. For example, streaming a video would be impossible without compression because the data rate would be too high for most internet connections.

大文件会消耗存储空间并增加传输时间。压缩能减少表示数据所需的比特数,使文件更容易存储、传输更快。例如,如果没有压缩,视频流传输几乎不可能实现,因为大多数互联网连接无法承受如此高的数据速率。

There are two main types of compression: lossless and lossy. The choice depends on the type of data and the required quality.

压缩主要有两种类型:无损压缩有损压缩。选择哪种取决于数据类型和质量要求。


7. Lossless Compression | 无损压缩

Lossless compression reduces file size without losing any data. When the file is decompressed, the original data is perfectly recovered. This is essential for text documents, executable programs, and databases, where even a single wrong bit causes problems.

无损压缩在减小文件体积的同时不丢失任何数据。解压缩后,原始数据被完美恢复。这对于文本文档、可执行程序和数据库至关重要,因为哪怕一个错误的比特也会导致严重问题。

Common lossless techniques include:

常见的无损压缩技术包括:

  • Run-length encoding (RLE): Repeated consecutive data values are stored as a single value and a count. For example, the sequence ‘AAAAABBBCC’ becomes ‘5A3B2C’.
  • 游程编码(RLE):将连续重复的数据值存储为一个值和出现次数。例如,序列 ‘AAAAABBBCC’ 可表示为 ‘5A3B2C’。
  • Huffman coding: Frequently used symbols are given shorter codes, while less frequent symbols get longer codes. This is a variable-length coding method.
  • 霍夫曼编码:频率高的符号用更短的编码,频率低的符号用较长的编码。这是一种变长编码方法。

RLE is simple but works best with data that has many repeated patterns, such as simple images or certain sound files. Huffman coding is more flexible and is used in formats like PNG and ZIP.

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