📚 Year 8 CAIE Computer Science: Formula and Theorem Quick Reference Handbook | 八年级 CAIE 计算机:公式定理速查手册
This guide collects the essential formulas and theorems you will need for Year 8 CAIE Computer Science. Keep it with you when revising and doing practice papers – every equation is explained in English and Chinese, and all examples use the notation you see in your exams. No LaTeX, just clear Unicode symbols.
本手册汇总了八年级 CAIE 计算机课程中的核心公式与定理。复习和刷题时随身带着它——每个公式都有中英文双语解释,所有例子都使用考试中会出现的符号,不用LaTeX,只有清晰的Unicode数学符号。
1. Binary to Decimal Conversion | 二进制转十进制
To convert a binary number to decimal, write the place values as powers of two and sum the bits where the digit is 1.
将二进制数转换为十进制数,需写出每个位值的2的幂,然后将数字为1的位值相加。
Formula: Decimal value = Σ (bit × 2ⁿ), where n starts at 0 from the rightmost digit.
公式:十进制值 = Σ (数位 × 2ⁿ),其中 n 从最右位开始为 0。
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₁₀
- 8-bit range: 00000000₂ (0) to 11111111₂ (255).
- 8位二进制数范围:00000000₂ (0) 到 11111111₂ (255)。
2. Decimal to Binary Conversion | 十进制转二进制
Divide the decimal number repeatedly by 2 and record the remainder at each step. Read the remainders backward to get the binary equivalent.
将十进制数反复除以2,记录每一步的余数。倒序读出余数即为对应的二进制数。
3÷2=21 r1, 21÷2=10 r1, 10÷2=5 r0, 5÷2=2 r1, 2÷2=1 r0, 1÷2=0 r1. Read from bottom: 101011₂.
例子:43 → 43÷2=21 余1, 21÷2=10 余1, 10÷2=5 余0, 5÷2=2 余1, 2÷2=1 余0, 1÷2=0 余1。从下往上读:101011₂。
check: The largest power of two ≤ number helps. For 43, 2⁵=32, 2⁴=16, so bits are needed.
快速检查:先找出不大于该数的最大2次幂。例如43,2⁵=32,2⁴=16,依次确定每个位。
3. Binary Addition | 二进制加法
Add two binary numbers digit by digit, carrying over to the next column when the sum reaches 2 (10₂).
逐位相加两个二进制数,当和达到2(即10₂)时向前进位。
Rules: 0+0=0, 0+1=1, 1+0=1, 1+1=0 (carry 1), 1+1+carry=1 (carry 1).
规则:0+0=0, 0+1=1, 1+0=1, 1+1=0 (进位1), 1+1+进位=1 (进位1)。
Example: 1011₂ + 1101₂ = 11000₂ (carry carefully).
例子:1011₂ + 1101₂ = 11000₂(仔细处理进位)。
- isters: In an 8-bit register, 11111111₂ + 1₂ = 00000000₂ with a carry out (overflow flag).
- 固定宽度寄存器溢出:在8位寄存器中,11111111₂ + 1₂ = 00000000₂ 且进位输出(溢出标志)。
4. Units of Data Storage | 数据存储单位
Data sizes use powers of two. Memorise the exact number of bytes in each unit.
数据大小基于2的幂次。记住每个单位的准确字节数。
| Unit | 单位 | Bytes | 字节数 | Approx. (decimal) | 近似值 |
|---|---|---|
| 1 KB (kilobyte) | 2¹⁰ = 1024 bytes | 10³ |
| 1 MB (megabyte) | 2²⁰ = 1,048,576 bytes | 10⁶ |
| 1 GB (gigabyte) | 2³⁰ ≈ 1.07 × 10⁹ bytes | 10⁹ |
| 1 TB (terabyte) | 2⁴⁰ bytes | 10¹² |
1 byte = 8 bits. A single bit stores 0 or 1.
1 字节 = 8 比特。一个比特存储 0 或 1。
Conversion factor: When moving up, multiply by 1024; moving down, divide by 1024.
转换因子:向上扩展时乘以 1024,向下缩小时除以 1024。
5. Hexadecimal Conversions | 十六进制转换
Hexadecimal (base‑16) uses digits 0‑9 and letters A (10) to F (15). One hex digit represents 4 bits (a nibble).
十六进制(基数为16)使用数字0‑9和字母A(10)到F(15)。一个十六进制位代表4个比特(一个半字节)。
Binary ↔ Hex: Group bits in fours from the right, then convert each group.
二进制 ↔ 十六进制:从右边开始每四位一组,然后转换每组。
Example: 1101 1010₂ = DA₁₆ (1101₂=13=D, 1010₂=10=A).
例子:1101 1010₂ = DA₁₆ (1101₂=13=D, 1010₂=10=A)。
Hex → Decimal: Σ (digit value × 16ⁿ). Example: 2F₁₆ = (2×16¹) + (15×16⁰) = 32+15=47.
十六进制 → 十进制:Σ (数字值 × 16ⁿ)。例子:2F₁₆ = (2×16¹) + (15×16⁰) = 32+15=47。
6. Logic Gates – Truth Tables | 逻辑门真值表
The behaviour of basic logic gates is defined by truth tables. These are theorems of Boolean algebra.
基本逻辑门的行为由真值表定义,这些真值表也是布尔代数的定理。
| Gate | 门 | Symbol | 符号 | Truth Table | 真值表 |
|---|---|---|
| AND | · (dot) | 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 | ¯ (overline) | NOT 0 = 1, NOT 1 = 0 |
| NAND | (AB)' | Inverse of AND |
| NOR | (A+B)' | Inverse of OR |
| XOR | ⊕ | 0⊕0=0, 0⊕1=1, 1⊕0=1, 1⊕1=0 |
You can express any Boolean function using combinations of these gates (NAND alone is universal).
你可以用这些门的组合表示任意布尔函数(单独NAND门即可构成通用门)。
7. Boolean Algebra Laws | 布尔代数定律
These laws simplify logic circuits and expressions. They apply exactly like algebra but with only 0 and 1.
以下定律用于简化逻辑电路与表达式。它们和代数一样使用,只是数字只有0和1。
| Law | 定律 | AND form | AND形式 | OR form | OR形式 |
|---|---|---|
| Identity | 同一律 | A·1 = A | A+0 = A |
| Null | 零律 | A·0 = 0 | A+1 = 1 |
| Idempotent | 幂等律 | A·A = A | A+A = A |
| Complement | 互补律 | A·Ā = 0 | A+Ā = 1 |
| Double Negation | 双重否定 | (Ā)̄ = A | |
| Commutative | 交换律 | A·B = B·A | A+B = B+A |
| Associative | 结合律 | (A·B)·C = A·(B·C) | (A+B)+C = A+(B+C) |
| Distributive | 分配律 | A·(B+C) = A·B + A·C | A+(B·C) = (A+B)·(A+C) |
| De Morgan's | 德摩根定律 | (A·B)̄ = Ā + B̄ | (A+B)̄ = Ā · B̄ |
Use De Morgan's to push inversions through expressions and convert between AND/OR logic.
使用德摩根定律可以将取反符号传入表达式中,并在与/或逻辑之间转换。
8. Image File Size Formula | 图像文件大小公式
The uncompressed size of a bitmap image depends on its resolution and colour depth.
未压缩位图图像的大小取决于分辨率和颜色深度。
File Size (bits) = Width × Height × Colour Depth
文件大小(位)= 宽度 × 高度 × 颜色深度
In bytes: divide the result by 8. Colour depth is the number of bits per pixel (e.g. 24 bits for true colour).
以字节为单位:将结果除以8。颜色深度是每像素的位数(例如真彩色为24位)。
800×600 image at 24-bit colour: 800×600×24 = 11,520,000 bits = 1,440,000 bytes ≈ 1.37 MB.
例子:800×600图像,24位色彩:800×600×24 = 11,520,000 位 = 1,440,000 字节 ≈ 1.37 MB。
9. Sound File Size Formula | 音频文件大小公式
For uncompressed mono or stereo sound, the file size grows linearly with sampling rate, bit depth, channels, and duration.
对于未压缩的单声道或立体声,文件大小与采样率、位深度、声道数和时长成线性关系。
File Size (bits) = Sample Rate × Bit Depth × Seconds × Channels
文件大小(位)= 采样率 × 位深度 × 秒数 × 声道数
In bytes: divide by 8. Common rates: 44.1 kHz (CD quality), bit depth 16 bits, stereo has 2 channels.
以字节为单位:除以8。常见参数:采样率44.1 kHz(CD质量),位深度16位,立体声为2个声道。
of CD-quality stereo: 44,100 × 16 × 30 × 2 = 42,336,000 bits = 5,292,000 bytes ≈ 5.05 MB.
例子:30秒CD质量的立体声:44,100 × 16 × 30 × 2 = 42,336,000 位 = 5,292,000 字节 ≈ 5.05 MB。
10. Data Compression Ratio | 数据压缩比公式
Compression reduces file size. The compression ratio tells you how much smaller the compressed file is compared to the original.
压缩可减小文件体积。压缩比告诉你压缩后文件比原始文件小多少。
Compression Ratio = Uncompressed Size ÷ Compressed Size
压缩比 = 原始大小 ÷ 压缩后大小
Alternatively, space saving percentage: ((Original – Compressed) ÷ Original) × 100%.
也可以用空间节省百分比:((原始大小 – 压缩后大小) ÷ 原始大小) × 100%。
Example: A 10 MB file compressed to 2 MB has a ratio of 5:1 and saves 80% space.
例子:10 MB的文件压缩到2 MB,压缩比为5:1,节省了80%的空间。
- Lossless compression (ZIP, PNG) allows exact reconstruction; lossy (JPEG, MP3) discards some data for higher compression.
- 无损压缩(ZIP, PNG)可完全重建数据;有损压缩(JPEG, MP3)丢弃部分数据以获得更高压缩比。
11. Parity Bit – Simple Error Detection | 奇偶校验位 – 简单检错
A parity bit is added to a binary string to make the total number of 1s either even (even parity) or odd (odd parity).
在二进制字符串中添加一个奇偶校验位,使得1的总数为偶数(偶校验)或奇数(奇校验)。
Even parity: parity bit = XOR of all data bits. Odd parity: parity bit = NOT of XOR.
偶校验:校验位 = 所有数据位的异或。奇校验:校验位 = 异或结果的非。
Example: Data 1010 (two 1s, even). Even parity: add 0 → 01010; odd parity: add 1 → 11010.
例子:数据1010(有两个1,偶数)。偶校验:添加0 → 01010;奇校验:添加1 → 11010。
At the receiver, the parity is recomputed. If it does not match, a single-bit error has occurred.
接收端重新计算校验位。如果不匹配,则发生了单比特错误。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

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