📚 Year 9 WJEC Computer Science: Formula & Theorem Quick Reference Handbook | Year 9 WJEC 计算机:公式定理速查手册
This handbook provides a concise collection of essential formulas and theorems for the Year 9 WJEC Computer Science course. Use it as a quick reference to reinforce your understanding of data representation, Boolean logic, algorithms, and file size calculations.
本手册汇集了 Year 9 WJEC 计算机科学课程的核心公式和定理。你可以将其作为快速参考,巩固对数据表示、布尔逻辑、算法和文件大小计算的理解。
1. Data Units and Conversions | 数据单位与换算
All digital data is measured in bits. A single bit represents one binary digit, either 0 or 1. Larger units are built using powers of 2.
所有数字数据都以比特为度量单位。一个比特代表一个二进制数字,0 或 1。更大的单位使用 2 的幂构建。
1 byte (B) = 8 bits
1 字节 (B) = 8 比特
1 kilobyte (KB) = 2¹⁰ bytes = 1,024 B
1 千字节 (KB) = 2¹⁰ 字节 = 1,024 B
1 megabyte (MB) = 2²⁰ bytes = 1,048,576 B
1 兆字节 (MB) = 2²⁰ 字节 = 1,048,576 B
1 gigabyte (GB) = 2³⁰ bytes
1 吉字节 (GB) = 2³⁰ 字节
1 terabyte (TB) = 2⁴⁰ bytes
1 太字节 (TB) = 2⁴⁰ 字节
Number of patterns = 2ⁿ, where n = number of bits
可表示的模式数 = 2ⁿ,其中 n 为位数
2. Binary to Denary Conversion | 二进制与十进制转换
To convert a binary number to denary, multiply each bit by its place value (power of 2) and sum the results. The least significant bit has place value 2⁰.
将二进制数转换为十进制时,将每一位乘以其位权(2 的幂)并求和。最低有效位的位权为 2⁰。
Denary = bₙ₋₁×2ⁿ⁻¹ + bₙ₋₂×2ⁿ⁻² + … + b₀×2⁰
十进制 = bₙ₋₁×2ⁿ⁻¹ + bₙ₋₂×2ⁿ⁻² + … + b₀×2⁰
Example: 1101₂ = (1×2³) + (1×2²) + (0×2¹) + (1×2⁰) = 8 + 4 + 0 + 1 = 13
示例:1101₂ = (1×2³) + (1×2²) + (0×2¹) + (1×2⁰) = 8 + 4 + 0 + 1 = 13
For fractional binary, use negative exponents: 2⁻¹ = 0.5, 2⁻² = 0.25, etc.
对于二进制小数,使用负指数:2⁻¹ = 0.5,2⁻² = 0.25 等。
3. Hexadecimal and Binary Conversion | 十六进制与二进制转换
Each hexadecimal digit represents exactly 4 bits (a nibble). Convert by grouping bits into sets of four, starting from the right.
每一位十六进制数字恰好代表 4 个比特(一个半字节)。转换时从右侧开始将二进制位每四位一组进行分组。
| Hexadecimal | Binary | Denary |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 2 | 0010 | 2 |
| 3 | 0011 | 3 |
| 4 | 0100 | 4 |
| 5 | 0101 | 5 |
| 6 | 0110 | 6 |
| 7 | 0111 | 7 |
| 8 | 1000 | 8 |
| 9 | 1001 | 9 |
| A | 1010 | 10 |
| B | 1011 | 11 |
| C | 1100 | 12 |
| D | 1101 | 13 |
| E | 1110 | 14 |
| F | 1111 | 15 |
To convert hex to denary, multiply each digit by its place value (power of 16).
将十六进制转换为十进制时,将每一位数字乘以其位权(16 的幂)。
Denary = hₙ₋₁×16ⁿ⁻¹ + … + h₀×16⁰
十进制 = hₙ₋₁×16ⁿ⁻¹ + … + h₀×16⁰
4. Binary Addition and Overflow | 二进制加法与溢出
rry of 1 to the next column. When the result exceeds the maximum value storable in the available bits, an overflow error occurs.
二进制加法遵循以下规则:0+0=0,0+1=1,1+0=1,1+1=0 并向下一位进位 1。当结果超出可用位数所能存储的最大值时,就会发生溢出错误。
For an 8‑bit unsigned integer, the maximum value is 255 (11111111₂). If the addition produces a 9‑bit result, the computer discards the extra carry bit and the result wraps around, causing an overflow.
对于 8 位无符号整数,最大值为 255 (11111111₂)。如果加法产生 9 位结果,计算机会丢弃多余的进位位,结果发生回绕,造成溢出。
Overflow can be detected by checking whether the carry into the most significant bit differs from the carry out.
溢出可以通过检查进入最高位的进位与输出进位是否不同来检测。
5. Boolean Algebra Laws | 布尔代数定律
Boolean algebra deals with binary variables and logical operations. These laws help simplify logic expressions in circuits and programs.
布尔代数处理二进制变量和逻辑运算。以下定律有助于简化电路和程序中的逻辑表达式。
Identity Law: A AND 1 = A ; A OR 0 = A
同一律:A AND 1 = A ; A OR 0 = A
Annulment Law: A AND 0 = 0 ; A OR 1 = 1
零一律:A AND 0 = 0 ; A OR 1 = 1
Idempotent Law: A AND A = A ; A OR A = A
幂等律:A AND A = A ; A OR A = A
Complement Law: A AND ¬A = 0 ; A OR ¬A = 1
互补律:A AND ¬A = 0 ; A OR ¬A = 1
Double Negation: ¬(¬A) = A
双重否定律:¬(¬A) = A
Commutative Law: A AND B = B AND A ; A OR B = B OR A
交换律:A AND B = B AND A ; A OR B = B OR A
Associative Law: (A AND B) AND C = A AND (B AND C)
结合律:(A AND B) AND C = A AND (B AND C)
Distributive Law: A AND (B OR C) = (A AND B) OR (A AND C)
分配律:A AND (B OR C) = (A AND B) OR (A AND C)
Absorption Law: A AND (A OR B) = A ; A OR (A AND B) = A
吸收律:A AND (A OR B) = A ; A OR (A AND B) = A
6. De Morgan's Theorems | 德摩根定理
De Morgan's theorems provide a way to transform AND operations into OR operations with negation, and vice versa. They are essential for simplifying digital circuits.
德摩根定理提供了一种通过取反将 AND 运算转换为 OR 运算的方法,反之亦然。它们对于简化数字电路至关重要。
¬(A ∧ B) = ¬A ∨ ¬B
¬(A ∧ B) = ¬A ∨ ¬B (与门取反等于各自取反后或)
¬(A ∨ B) = ¬A ∧ ¬B
¬(A ∨ B) = ¬A ∧ ¬B (或门取反等于各自取反后与)
In words: the negation of a conjunction is the disjunction of the negations; the negation of a disjunction is the conjunction of the negations.
用文字表述:合取的否定等价于否定的析取;析取的否定等价于否定的合取。
7. Logic Gate Truth Tables | 逻辑门真值表
Logic gates are the building blocks of digital circuits. Each gate implements a Boolean function. The tables below define the output for every possible input combination.
逻辑门是数字电路的基本构件。每种逻辑门实现了一个布尔函数。下表定义了每种可能的输入组合对应的输出。
| Gate | Symbol | Truth Table |
|---|---|---|
| AND | ∧ | 0,0→0; 0,1→0; 1,0→0; 1,1→1 |
| OR | ∨ | 0,0→0; 0,1→1; 1,0→1; 1,1→1 |
| NOT | ¬ | 0→1; 1→0 |
| NAND | ¬(A ∧ B) | 0,0→1; 0,1→1; 1,0→1; 1,1→0 |
| NOR | ¬(A ∨ B) | 0,0→1; 0,1→0; 1,0→0; 1,1→0 |
| XOR | ⊕ | 0,0→0; 0,1→1; 1,0→1; 1,1→0 |
NAND and NOR gates are called universal gates because any other gate can be built using only NANDs or only NORs.
NAND 和 NOR 门被称为通用门,因为任何其他门都可以仅用 NAND 门或仅用 NOR 门来构建。
8. Image and Sound File Size Formulas | 图像与声音文件大小公式
Calculating the storage requirements for multimedia helps choose appropriate compression and storage devices. Use the formulas below to estimate raw file sizes.
计算多媒体文件的存储需求有助于选择合适的压缩方案和存储设备。使用以下公式估算原始文件大小。
Image file size (bits) = Width (px) × Height (px) × Colour Depth (bits per pixel)
图像文件大小(比特) = 宽度(像素) × 高度(像素) × 色深(每像素比特数)
Example: a 1920 × 1080 image with 24‑bit colour needs 1920 × 1080 × 24 = 49,766,400 bits ≈ 6.22 MB.
示例:一张 1920×1080 的 24 位色深图像需要 1920×1080×24 = 49,766,400 比特 ≈ 6.22 MB。
Audio file size (bits) = Sample Rate (Hz) × Bit Depth × Duration (s) × Number of Channels
音频文件大小(比特) = 采样率(Hz) × 位深度 × 时长(秒) × 声道数
dio: 44,100 Hz × 16 bits × 1 second × 2 channels = 1,411,200 bits (≈ 176.4 KB per second).
CD 质量立体声音频:44,100 Hz × 16 位 × 1 秒 × 2 声道 = 1,411,200 比特(约 176.4 KB/秒)。
Always convert the final size to the desired unit (bytes, KB, MB) by dividing by 8 and then by the appropriate power of 1024.
最后记得将结果除以 8,再除以相应的 1024 的幂,转换为所需单位(字节、KB、MB)。
9. Data Transfer Time Calculation | 数据传输时间计算
When files are transmitted over a network, the transfer time depends on the file size and the available bandwidth. Use a single consistent unit for both size and speed.
通过网络传输文件时,传输时间取决于文件大小和可用带宽。文件大小和传输速度需要使用一致的单位。
Transfer Time (s) = File Size (bits) ÷ Bandwidth (bits per second, bps)
传输时间(秒) = 文件大小(比特) ÷ 带宽(比特每秒,bps)
ts: 100 × 8 × 1,048,576 = 838,860,800 bits. Then 838,860,800 ÷ 50,000,000 = 16.78 seconds.
如果通过 50 Mbps 连接下载一个 100 MB 的文件,首先将 100 MB 转换为比特:100×8×1,048,576 = 838,860,800 比特。然后用 838,860,800 ÷ 50,000,000 = 16.78 秒。
Remember that 1 Mbps = 1,000,000 bits per second (not 1,048,576) in networking contexts.
请注意,在网络环境中 1 Mbps = 1,000,000 比特每秒(而非 1,048,576)。
Latency (delay) adds extra time independent of file size and must be considered for interactive applications.
延迟(时延)会额外增加与文件大小无关的时间,在交互式应用中必须加以考虑。
10. Algorithm Complexity and Compression Ratio | 算法效率与压缩比
Algorithm efficiency is often described using Big O notation, which shows how the number of operations grows as the input size (n) increases. Compression ratio indicates how much a file has been reduced in size.
算法效率通常用大 O 记号描述,它表示随着输入规模 (n) 的增加,运算次数的增长情况。压缩比则表示文件大小被缩减了多少。
Linear Search: O(n)
线性搜索:O(n)
Binary Search: O(log₂ n)
二分搜索:O(log₂ n)
Bubble Sort (average/worst): O(n²)
冒泡排序(平均/最差):O(n²)
For compression, the formula is:
对于压缩,公式为:
Compression Ratio = Uncompressed Size ÷ Compressed Size
压缩比 = 原始大小 ÷ 压缩后大小
A ratio of 4:1 means the file is one quarter of its original size. Lossless compression preserves all original data; lossy compression permanently removes some data to achieve higher ratios.
比值为 4:1 意味着文件大小为原始的四分之一。无损压缩保留所有原始数据;有损压缩会永久移除部分数据以获得更高的压缩比。
Always check the unit of file size (bits, bytes) before calculating transfer times or compression ratios to ensure consistency.
在计算传输时间或压缩比之前,请务必确认文件大小单位(比特、字节),以确保一致性。
Published by TutorHao
更多咨询请联系16621398022(同微信)
或截图后用「扫一扫 → 相册」选择本图