📚 CCEA Year 9 Computer Science: Quick Reference Handbook of Formulas and Theorems | CCEA 九年级计算机科学:公式定理速查手册
This quick reference handbook brings together the essential formulas, laws and theorems you will meet in the CCEA Year 9 Computer Science course. From binary conversions and Boolean algebra to file size calculations and algorithm efficiency, every key idea is presented here with clear explanations and ready‑to‑use formulas. Keep this guide close when revising or solving exam‑style questions.
这本速查手册汇集了 CCEA 九年级计算机科学课程中的核心公式、定律和定理。从二进制转换、布尔代数到文件大小计算和算法效率,每一个关键知识点都配有清晰的解释和即用型公式。复习或解答考试题型时,请将本指南放在手边。
1. Number Systems and Conversions | 数制与转换
Computers use the binary number system (base 2), but we often work with decimal (base 10) and hexadecimal (base 16). Being able to convert between these bases is fundamental. The formula below sums each bit multiplied by its place value in powers of two.
计算机使用二进制(基数 2),但我们通常使用十进制(基数 10)和十六进制(基数 16)。能够在这些进制之间进行转换是基础技能。下面的公式将每个位乘以其 2 的幂次权重再求和。
Decimal = Σ (bitᵢ × 2ⁱ) for i = 0,1,2,... from rightmost bit
十进制 = Σ (位ᵢ × 2ⁱ) i 从最右边一位开始取 0,1,2,...
To convert from decimal to binary, repeatedly divide the decimal number by 2 and record the remainders. The binary equivalent is the sequence of remainders read from bottom to top (last remainder to first). Hexadecimal conversions use base 16, where digits 10–15 are represented by letters A–F.
将十进制转换为二进制时,反复将十进制数除以 2 并记录余数。余数从下往上(最后一个余数到第一个)排列即为对应的二进制数。十六进制转换使用基数 16,其中数字 10 到 15 用字母 A 到 F 表示。
2. Units of Storage | 存储单位
Digital data is measured in bits and bytes. Larger units follow powers of two in most technical contexts, though some storage manufacturers may use decimal definitions. The exact binary multiples are essential for precise calculations in computer science.
数字数据以位和字节为单位。在大多数技术场景中,更大的单位遵循 2 的幂,尽管一些存储设备制造商可能使用十进制定义。精确的二进制倍数对计算机科学中的精确计算至关重要。
1 nibble = 4 bits
1 byte = 8 bits
1 kilobyte (KB) = 2¹⁰ bytes = 1024 bytes
1 megabyte (MB) = 2²⁰ bytes = 1,048,576 bytes
1 gigabyte (GB) = 2³⁰ bytes
1 terabyte (TB) = 2⁴⁰ bytes
1 个半字节 = 4 位
1 字节 = 8 位
1 千字节 (KB) = 2¹⁰ 字节 = 1024 字节
1 兆字节 (MB) = 2²⁰ 字节 = 1,048,576 字节
1 吉字节 (GB) = 2³⁰ 字节
1 太字节 (TB) = 2⁴⁰ 字节
When converting between units, multiply or divide by 1024 (not 1000) for each step up or down between KB, MB, GB and TB unless specifically instructed otherwise by an exam question.
在 KB、MB、GB 和 TB 之间逐步转换时,除非题目另有说明,每一步应乘以或除以 1024(而非 1000)。
3. Boolean Algebra Laws | 布尔代数定律
Boolean algebra works with true/false values, often written as 1 and 0. Understanding its laws helps simplify logic expressions and design efficient circuits. The most important laws are listed below, where A, B and C are Boolean variables, AND is written as a dot (·) or simply AND, OR as a plus (+) or OR, and NOT as an overbar or tilde (~).
布尔代数处理真/假值,通常写作 1 和 0。理解其定律有助于简化逻辑表达式和设计高效电路。最重要的定律如下所示,其中 A、B 和 C 是布尔变量,AND 写作点号 (·) 或直接写 AND,OR 写作加号 (+) 或直接写 OR,NOT 写作上划线或波浪号 (~)。
Commutative Laws | 交换律
A AND B = B AND A
A OR B = B OR A
Associative Laws | 结合律
(A AND B) AND C = A AND (B AND C)
(A OR B) OR C = A OR (B OR C)
Distributive Laws | 分配律
A AND (B OR C) = (A AND B) OR (A AND C)
A OR (B AND C) = (A OR B) AND (A OR C)
Identity Laws | 同一律
A AND 1 = A A OR 0 = A
Annihilation Laws | 湮灭律
A AND 0 = 0 A OR 1 = 1
Idempotent Laws | 幂等律
A AND A = A A OR A = A
Double Negation | 双重否定律
NOT (NOT A) = A
De Morgan's Theorems | 德摩根定理
NOT (A AND B) = (NOT A) OR (NOT B)
NOT (A OR B) = (NOT A) AND (NOT B)
You can prove each law by constructing a truth table. De Morgan's theorems are particularly useful for transforming complex conditions into simpler ones when designing algorithms or digital circuits.
你可以通过构造真值表来验证每一条定律。在设计算法或数字电路时,德摩根定理对于将复杂条件转化为更简单的形式尤其有用。
4. Logic Gates and Truth Tables | 逻辑门与真值表
Logic gates are the building blocks of digital circuits. Each gate implements a basic Boolean function. The six most common gates are AND, OR, NOT, NAND, NOR and XOR. Below are their symbols, Boolean expressions and truth tables.
逻辑门是数字电路的基本构件。每种门实现一个基本的布尔函数。六种最常见的门是与门、或门、非门、与非门、或非门和异或门。以下是它们的符号、布尔表达式和真值表。
| Gate | 门 | Symbol | 符号 | Expression | 表达式 | Truth Table | 真值表 |
|---|---|---|---|
| AND | A·B | Output = A AND B | 0·0=0, 0·1=0, 1·0=0, 1·1=1 |
| OR | A+B | Output = A OR B | 0+0=0, 0+1=1, 1+0=1, 1+1=1 |
| NOT | ~A or A' | Output = NOT A | NOT 0 = 1, NOT 1 = 0 |
| NAND | ~(A·B) | Output = NOT (A AND B) | 0 NAND 0=1, 0 NAND 1=1, 1 NAND 0=1, 1 NAND 1=0 |
| NOR | ~(A+B) | Output = NOT (A OR B) | 0 NOR 0=1, 0 NOR 1=0, 1 NOR 0=0, 1 NOR 1=0 |
| XOR | A ⊕ B | Output = A XOR B | 0 ⊕ 0=0, 0 ⊕ 1=1, 1 ⊕ 0=1, 1 ⊕ 1=0 |
For a gate with more than two inputs, the same rules apply: AND produces 1 only when all inputs are 1; OR produces 1 when at least one input is 1; XOR produces 1 when an odd number of inputs are 1 (for multiple‑input XOR). NAND and NOR are simply the negation of AND and OR respectively.
对于有两个以上输入的门,适用相同的规则:AND 门仅在所有输入都为 1 时输出 1;OR 门在至少一个输入为 1 时输出 1;异或门在输入中有奇数个 1 时输出 1(多输入异或)。与非门和或非门分别是与门和或门的取反。
5. Character Encoding | 字符编码
Text is stored in computers using numeric codes that map to characters. The two most common encoding standards are ASCII and Unicode. ASCII uses 7 bits to represent 128 characters (0–127), including English letters, digits and punctuation. Extended ASCII uses 8 bits for 256 characters.
文本通过映射到字符的数字编码存储在计算机中。两种最常见的编码标准是 ASCII 和 Unicode。ASCII 使用 7 位表示 128 个字符 (0–127),包括英文字母、数字和标点。扩展 ASCII 使用 8 位表示 256 个字符。
ASCII character count = 2⁷ = 128 (7‑bit code)
ASCII 字符数 = 2⁷ = 128 (7 位编码)
Unicode provides a unique number for every character across all languages and symbols. UTF‑8, a common Unicode encoding, uses 1 to 4 bytes per character. The first 128 characters of Unicode match ASCII for backward compatibility.
Unicode 为所有语言和符号中的每个字符提供一个唯一编号。常见的 Unicode 编码 UTF‑8 每个字符使用 1 到 4 个字节。Unicode 的前 128 个字符与 ASCII 一致,保持向后兼容。
6. Image Representation and File Size | 图像表示与文件大小
A bitmap image is made up of a grid of pixels. Each pixel has a colour represented by a binary code, and the number of bits used per pixel is called the colour depth. The file size of an uncompressed image depends on the image dimensions and colour depth.
位图图像由像素网格构成。每个像素都有一个用二进制代码表示的颜色,每个像素使用的位数称为颜色深度。未压缩图像的文件大小取决于图像尺寸和颜色深度。
mage file size (bits) = width in pixels × height in pixels × colour depth (bits per pixel)
图像文件大小(位)= 宽度(像素)× 高度(像素)× 颜色深度(每像素位数)
an image uses a palette of 256 colours, the colour depth is 8 bits (since 2⁸ = 256). A 24‑bit colour depth (true colour) allows over 16 million colours (2²⁴ ≈ 16.7 million).
要转换为字节,将总的位数除以 8。要表示为千字节或兆字节,再分别除以 1024 或 1024²。当图像使用 256 色调色板时,颜色深度为 8 位(因为 2⁸ = 256)。24 位颜色深度(真彩色)可显示超过 1600 万种颜色(2²⁴ ≈ 1670 万)。
7. Sound Representation and File Size | 声音表示与文件大小
Sound is captured by sampling the analogue wave at regular intervals. The sample rate (measured in hertz) determines how many samples are taken per second. The sample depth (bit depth) indicates the number of bits used to record each sample. Stereo sound requires two channels, doubling the data.
声音通过按固定间隔对模拟波形进行采样来捕获。采样率(以赫兹为单位)决定每秒采集多少个样本。采样深度(位深度)表示每个样本记录的位数。立体声需要两个声道,数据量翻倍。
(bits) = sample rate (Hz) × sample depth (bits) × duration (seconds) × number of channels
声音文件大小(位)= 采样率 (Hz) × 采样深度(位)× 时长(秒)× 声道数
For a mono recording of 10 seconds at 44.1 kHz with 16‑ ou to calculate sizes in bytes, kilobytes or megabytes, so always check the required unit.
对于 10 秒单声道、44.1 kHz、16 位采样的录音,原始大小为:44100 × 16 × 10 × 1 = 7,056,000 位 = 882,000 字节 ≈ 861 KB。考试题目经常要求以字节、千字节或兆字节计算大小,因此务必检查所需单位。
8. Algorithm Efficiency Basics | 算法效率基础
When comparing searching and sorting algorithms, we often count the maximum number of comparisons or swaps. This helps us understand which algorithm performs better with large data sets. Below are key performance formulas for the algorithms covered in Year 9.
在比较搜索和排序算法时,我们通常计算最大比较次数或交换次数。这有助于我们理解哪种算法在处理大数据集时表现更好。以下是九年级涉及的算法的关键性能公式。
Linear Search | 线性搜索
Maximum comparisons = n (where n is the number of items)
最大比较次数 = n (n 为元素个数)
Binary Search | 二分搜索 (on sorted data | 在有序数据上)
Maximum comparisons ≈ log₂(n) + 1
最大比较次数 ≈ log₂(n) + 1
Bubble Sort | 冒泡排序
Maximum passes = n – 1
Maximum comparisons = (n – 1) + (n – 2) + … + 1 = n(n – 1)/2
最大趟数 = n – 1
最大比较次数 = (n – 1) + (n – 2) + … + 1 = n(n – 1)/2
Bubble sort would require around 499,500 comparisons, which illustrates why more efficient algorithms are preferred for large data sets.
对于一个含有 1,000 个元素的列表,线性搜索在最坏情况下可能需要多达 1,000 次比较,而二分搜索仅需约 11 次(因为 2¹⁰ = 1024)。冒泡排序则需要大约 499,500 次比较,这说明为什么处理大数据集时更高效的算法更受青睐。
9. Network Data Transfer | 网络数据传输
The time taken to send data over a network depends on the size of the data and the transfer speed of the connection. Transfer speed is usually given in bits per second (bps), while file sizes are often given in bytes. Always align units before calculating.
通过网络传输数据所需的时间取决于数据大小和连接速度。传输速度通常以比特每秒 (bps) 为单位,而文件大小通常以字节为单位。计算前务必统一单位。
Transfer time (seconds) = Data size (bits) / Transfer rate (bps)
传输时间(秒)= 数据大小(位)/ 传输速率 (bps)
s 2 megabits per second (2,000,000 bps), the time is approximately 41.9 seconds. Remember that real‑world factors such as network congestion are ignored in these simplified calculations.
如果一个文件是 10 兆字节(10 × 1024 × 1024 × 8 位),而连接速度是 2 兆比特每秒 (2,000,000 bps),传输时间大约为 41.9 秒。请记住,这些简化计算忽略了网络拥塞等现实因素。
10. Compression Ratio | 压缩比
Data compression reduces the number of bits needed to store or transmit information. Lossless compression allows exact reconstruction of the original data, while lossy compression sacrifices some detail for smaller file sizes. The compression ratio compares the original size to the compressed size.
数据压缩减少了存储或传输信息所需的位数。无损压缩允许精确重建原始数据,而有损压缩为了更小的文件体积牺牲了一些细节。压缩比用于比较原始大小和压缩后的大小。
Compression ratio = Original file size / Compressed file size
压缩比 = 原始文件大小 / 压缩后文件大小
ans the compressed file is one fifth of the original. Space saving can be calculated as (1 – 1/ratio) × 100%. For example, a ratio of 4 : 1 gives a space saving of 75% achieve high compression ratios by removing data that human senses are less sensitive to.
5 : 1 的压缩比意味着压缩后的文件是原始文件的五分之一。空间节省率可这样计算:(1 – 1/压缩比) × 100%。例如,4 : 1 的压缩比可节省 75% 的空间。像 JPEG 和 MP3 这样的有损格式通过去除人类感官不那么敏感的数据来获得高压缩比。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

或截图后用「扫一扫 → 相册」选择本图