📚 Year 8 CAIE Computer Science: Formula & Theorem Quick Reference Guide | Year 8 CAIE 计算机:公式定理速查手册
This quick reference handbook collects the most important formulas, theorems and conversion rules you will meet in the Year 8 CAIE Computer Science course. Use it to revise binary arithmetic, logic gates, data units, algorithm patterns and more. Every rule is stated first in English and then restated in Chinese to help you master the bilingual terminology required by the Cambridge curriculum.
本速查手册汇集了 Year 8 CAIE 计算机科学课程中最重要的公式、定理和转换规则,涵盖二进制运算、逻辑门、数据单位、算法模式等内容。每条规则先以英文陈述,再用中文复述,帮助您掌握剑桥课程所要求的双语术语。
1. Decimal to Binary Conversion | 十进制转二进制
To convert a decimal number to binary, repeatedly divide the decimal number by 2 and record the remainder. Read the remainders from bottom to top to obtain the binary equivalent.
要将十进制数转换为二进制,需反复将十进制数除以 2 并记录余数。从下往上读取余数即可得到对应的二进制数。
Decimal D → Binary: D ÷ 2, collect remainders (LSB to MSB) | 十进制 D → 二进制:D ÷ 2,收集余数(最低位至最高位)
Example: Convert 19 to binary. 19 ÷ 2 = 9 r 1; 9 ÷ 2 = 4 r 1; 4 ÷ 2 = 2 r 0; 2 ÷ 2 = 1 r 0; 1 ÷ 2 = 0 r 1. Remainders bottom-up: 10011₂. | 示例:19 转二进制。余数从下往上:10011₂。
2. Binary to Decimal Conversion | 二进制转十进制
Multiply each binary digit by 2 raised to the power of its position (starting from 0 on the right). Sum all results to get the decimal value.
将每个二进制位乘以其所在位置(从右起 0 开始)的 2 的幂,再将所有结果相加,得到十进制值。
1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11₁₀
Position values: 2⁰=1, 2¹=2, 2²=4, 2³=8, 2⁴=16, … | 位值:2⁰=1,2¹=2,2²=4,2³=8,2⁴=16,……
3. Binary Addition Rules | 二进制加法规则
Binary addition follows four simple rules. When the sum exceeds 1, a carry is generated to the next column.
二进制加法遵循四条简单规则。当结果超过 1 时,向下一位进位。
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (0 with carry 1)
For multi-bit addition, align columns and apply these rules from right to left. | 多位加法时,按列对齐,从右向左应用上述规则。
4. Binary to Hexadecimal | 二进制转十六进制
Group binary digits into sets of four from the right. Convert each nibble (4 bits) into its hexadecimal equivalent using the table below.
从右开始将二进制位每四位分成一组。利用下表将每个半字节(4 位)转换为相应的十六进制数。
| Binary 4-bit | Hexadecimal | Decimal |
|---|---|---|
| 0000 | 0 | 0 |
| 0001 | 1 | 1 |
| 0010 | 2 | 2 |
| 0011 | 3 | 3 |
| 0100 | 4 | 4 |
| 0101 | 5 | 5 |
| 0110 | 6 | 6 |
| 0111 | 7 | 7 |
| 1000 | 8 | 8 |
| 1001 | 9 | 9 |
| 1010 | A | 10 |
| 1011 | B | 11 |
| 1100 | C | 12 |
| 1101 | D | 13 |
| 1110 | E | 14 |
| 1111 | F | 15 |
Example: 1101 0111₂ → D7₁₆. | 示例:1101 0111₂ → D7₁₆。
5. Data Storage Units | 数据存储单位
Computer storage is measured in bytes and larger units based on powers of 2. The fundamental formula is: 1 byte = 8 bits.
计算机存储以字节和基于 2 的幂的更大单位来衡量。基本公式:1 字节 = 8 位。
1 kilobyte (KB) = 2¹⁰ bytes = 1024 bytes
1 megabyte (MB) = 2²⁰ bytes = 1024 KB
1 gigabyte (GB) = 2³⁰ bytes = 1024 MB
1 terabyte (TB) = 2⁴⁰ bytes = 1024 GB
For file size calculations, remember: Size (bits) = width × height × colour depth for a bitmap image. | 计算文件大小时,记住位图图像的公式:大小(位)= 宽 × 高 × 颜色深度。
6. Logic Gates – AND, OR, NOT | 逻辑门 – 与门、或门、非门
A logic gate performs a Boolean operation on one or more inputs and produces a single output. The truth table defines the output for every possible input combination.
逻辑门对一个或多个输入执行布尔运算,并产生单一输出。真值表定义了每种可能输入组合下的输出。
AND gate (A · B): Output is 1 only if all inputs are 1. | 与门 (A · B): 仅当所有输入均为 1 时输出为 1。
| A | B | A AND B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR gate (A + B): Output is 1 if at least one input is 1. | 或门 (A + B): 如果至少一个输入为 1,则输出为 1。
| A | B | A OR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NOT gate (Ā): Inverts the input; output is the opposite. | 非门 (Ā): 反转输入,输出为相反值。
| A | NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
7. Boolean Algebra Simplification | 布尔代数化简
Boolean expressions can be simplified using identities. Two very useful identities for Year 8 are the ‘identity law’ and the ‘complement law’.
布尔表达式可利用恒等式进行化简。Year 8 阶段两个非常有用的恒等式是“同一律”和“互补律”。
A + 0 = A A · 1 = A
A + 1 = 1 A · 0 = 0
A + A = A A · A = A
A + Ā = 1 A · Ā = 0
These rules help reduce complex logic circuits into simpler equivalent forms. | 这些规则有助于将复杂的逻辑电路简化为更简单的等效形式。
8. Sorting Algorithms – Bubble Sort Passes | 排序算法 – 冒泡排序的趟数
For a list of n items, bubble sort requires a maximum of (n−1) passes to guarantee the list is fully sorted. In each pass, adjacent items are compared and swapped if they are in the wrong order.
对于包含 n 个项目的列表,冒泡排序最多需要 (n−1) 趟才能确保列表完全有序。每一趟中,相邻项被比较,若顺序错误则进行交换。
Number of comparisons in a pass for pass k: (n − k). | 第 k 趟的比较次数: (n − k)。
Total comparisons worst case = n(n−1)/2
Example: for n=5, total comparisons ≤ 5×4/2 = 10. | 示例:n=5,总比较次数 ≤ 10。
9. Linear Search Maximum Comparisons | 线性搜索的最大比较次数
Linear search scans a list sequentially. In the worst case, it looks at every element. For a list of n items, the maximum number of comparisons is n.
线性搜索按顺序扫描列表。最坏情况下会检查每一个元素。对于 n 个项目的列表,最大比较次数为 n。
Worst-case comparisons = n
If the item is found earlier, the search stops. On average, it checks about n/2 items. | 如果较早找到目标,则搜索停止。平均检查约 n/2 个项目。
10. Binary Search Maximum Comparisons | 二分搜索的最大比较次数
Binary search works on a sorted list by repeatedly dividing the search interval in half. The maximum number of comparisons is roughly log₂ n (rounded up).
二分搜索通过反复将搜索区间减半,在有序列表上工作。最大比较次数约为 log₂ n(向上取整)。
Worst-case comparisons ≈ ⌈log₂ n⌉
For n=1000, binary search needs at most 10 comparisons, whereas linear search may need up to 1000. | 当 n=1000 时,二分搜索最多需要 10 次比较,而线性搜索可能需要多达 1000 次。
11. Sound Sampling – File Size Theorem | 声音采样 – 文件大小定理
The file size of a sampled sound is determined by the sampling rate, sample resolution (bit depth), number of channels and duration. The formula is:
采样声音的文件大小由采样率、采样分辨率(位深)、声道数和时长决定。公式如下:
File size (bits) = sampling rate (Hz) × bit depth × number of channels × time (seconds)
Convert to bytes by dividing by 8. This theorem is essential for estimating storage needs for audio. | 除以 8 转换为字节。此定理对于估计音频的存储需求至关重要。
12. Programming Arithmetic Operators | 编程算术运算符
In most programming languages, arithmetic follows the standard order of operations. Integer division and modulus are particularly important in problem-solving.
在大多数编程语言中,算术运算遵循标准运算顺序。整数除法和取模(余数)运算在解题中尤为重要。
Operators: + (addition), − (subtraction), * (multiplication), / (division), MOD (remainder)
When dividing integers, 17 DIV 5 = 3 (quotient) and 17 MOD 5 = 2 (remainder). These operators follow the rule: dividend = divisor × quotient + remainder. | 整数除法时,17 DIV 5 = 3(商),17 MOD 5 = 2(余数)。它们遵循:被除数 = 除数 × 商 + 余数。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply