📚 Year 9 OCR Computer Science: Formula & Theorem Cheat Sheet | Year 9 OCR 计算机:公式定理速查手册
This quick reference handbook brings together the key formulas, theorems and conversion techniques required for Year 9 OCR Computer Science. Whether you are calculating file sizes, simplifying Boolean expressions or working with binary shifts, having these relationships at your fingertips will strengthen both your written answers and practical problem-solving.
这本速查手册汇集了 Year 9 OCR 计算机科学所需的核心公式、定理和转换方法。无论是计算文件大小、化简布尔表达式还是进行二进制移位操作,熟练掌握这些关系都能帮助你从容应对笔试和应用题。
1. Data Units and File Size Calculations | 数据单位与文件大小计算
In computer science, data is measured in bits and bytes. A bit (b) is the smallest unit of data, representing a single binary digit 0 or 1. A byte (B) consists of 8 bits. Larger quantities follow either decimal (powers of 10) or binary (powers of 2) conventions; in the OCR syllabus the decimal interpretation is often used for storage media, while the binary interpretation appears in memory addressing.
在计算机科学中,数据以位(bit)和字节(byte)度量。一个位是数据的最小单位,表示一个二进制数字 0 或 1。一个字节由 8 个位组成。更大的单位遵循十进制(10 的幂)或二进制(2 的幂)约定;OCR 课程中存储介质通常使用十进制解释,而内存寻址时常涉及二进制解释。
| Unit (Symbol) | Decimal value (common for storage) | Binary value (traditional) |
|---|---|---|
| 1 kilobyte (KB) | 10³ bytes = 1000 B | 2¹⁰ bytes = 1024 B |
| 1 megabyte (MB) | 10⁶ bytes = 1,000,000 B | 2²⁰ bytes = 1,048,576 B |
| 1 gigabyte (GB) | 10⁹ bytes | 2³⁰ bytes |
| 1 terabyte (TB) | 10¹² bytes | 2⁴⁰ bytes |
unit = original size / unit multiplier. For example, a 500 MB file equals 500 × 10⁶ bytes.
单位换算公式:总位数 = 字节数 × 8。目标单位的文件大小 = 原始大小 ÷ 对应单位倍数。例如 500 MB 文件等于 500 × 10⁶ 字节。
2. Binary Shifts and Arithmetic | 二进制移位与算术运算
A left shift of n places multiplies a binary number by 2ⁿ. Each left shift moves every bit one position to the left, filling the rightmost bit with 0. A right shift of n places performs integer division by 2ⁿ, discarding any remainder.
左移 n 位相当于将二进制数乘以 2ⁿ。每次左移将所有位向左移动一位,最右位补 0。右移 n 位相当于对 2ⁿ 进行整除,丢弃余数。
Left shift example: 0000 1010 (10) left shift 1 → 0001 0100 (20)
左移示例:0000 1010 (10) 左移 1 位 → 0001 0100 (20)
Right shift example: 0001 0100 (20) right shift 1 → 0000 1010 (10)
右移示例:0001 0100 (20) 右移 1 位 → 0000 1010 (10)
When shifting negative numbers in two's complement, an arithmetic right shift preserves the sign bit (most significant bit) by replicating it; a logical right shift always fills with 0.
对二进制补码表示的负数进行移位时,算术右移通过复制最高有效位来保留符号位;逻辑右移则总是补 0。
3. Sound File Size Formula | 声音文件大小公式
The size of an uncompressed sound file is determined by four factors: sample rate, bit depth, number of channels and duration. The formula gives the size in bits.
未压缩音频文件的大小由四个因素决定:采样率、位深度、声道数和时长。该公式以位为单位计算文件大小。
Sound size (bits) = Sample rate (Hz) × Bit depth × Channels × Duration (s)
声音大小(位)= 采样率(Hz)× 位深度 × 声道数 × 时长(秒)
ording of 10 seconds uses 44,100 × 16 × 2 × 10 = 14,112,000 bits, or about 1.76 MB (dividing by 8 then by 1,000,000).
要得到以字节为单位的大小,需除以 8;再除以 1000(或视情况除以 1024)可得到千字节数。示例:采样率 44.1 kHz、位深度 16 位、立体声、时长 10 秒的录音占用 44,100 × 16 × 2 × 10 = 14,112,000 位,约合 1.76 MB(依次除以 8 和 1,000,000)。
4. Image File Size Formula | 图像文件大小公式
Uncompressed image size depends on the number of pixels and the colour depth. Each pixel requires a certain number of bits to represent its colour.
未压缩图像的大小取决于像素数量和色彩深度。每个像素需要一定数量的位来表示其颜色。
Image size (bits) = Width (px) × Height (px) × Colour depth (bpp)
图像大小(位)= 宽度(像素)× 高度(像素)× 色彩深度(位/像素)
0 × 24 = 11,520,000 bits, or 1.44 MB. If a palette is used, colour depth equals the number of bits needed to address the palette.
常见色彩深度:1 位(单色)、8 位(256 色)、24 位(真彩色,每 RGB 通道 8 位)。一幅 800×600、24 bpp 的图像需要 800×600×24 = 11,520,000 位,即 1.44 MB。如果使用调色板,色彩深度等于寻址调色板所需的位数。
5. Hexadecimal and Decimal Conversions | 十六进制与十进制转换
Hexadecimal (base 16) uses sixteen symbols: 0–9 and A– exactly 4 binary digits (a nibble), making hex a compact way to represent long binary sequences.
十六进制(基数为 16)使用十六个符号:0–9 和 A–F,其中 A=10, B=11, C=12, D=13, E=14, F=15。每位十六进制恰好对应 4 个二进制位(一个半字节),因此十六进制是表示长二进制序列的紧凑方式。
To convert hex to decimal: multiply the value of each digit by 16ⁿ, where n is the position counted from the right starting at 0, then sum the results. For example, 2F → (2 × 16¹) + (15 × 16⁰) = 32 + 15 = 47.
十六进制转十进制的方法:每位数字的值乘以 16ⁿ(n 为从右起、从 0 开始的位置序号),再求和。例如 2F → (2 × 16¹) + (15 × 16⁰) = 32 + 15 = 47。
r 15 (F), so 47 in hex is 2F. Binary to hex: group bits into nibbles from the right, then convert each group.
十进制转十六进制:反复除以 16,将余数从下往上排列,大于 9 的余数转为字母。47 ÷ 16 = 2 余 15(F),故十六进制为 2F。二进制转十六进制:从右起每四位一组,然后按组转换。
6. Boolean Algebra Theorems | 布尔代数定理
Boolean algebra underpins digital logic. The following theorems help simplify circuits and expressions. In the table, · represents AND, + represents OR, and an overline (Ā) represents NOT.
布尔代数是数字逻辑的基础。以下定理用于化简电路和逻辑表达式。表中 · 表示与运算,+ 表示或运算,上划线 (Ā) 表示非运算。
| Theorem (English) | Expression | 中文定理 |
|---|---|---|
| Identity | A · 1 = A ; A + 0 = A | 恒等律 |
| Annihilator / 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) | 分配律 |
| Absorption | A·(A+B) = A ; A+(A·B) = A | 吸收律 |
| De Morgan's Theorem | (A·B) = Ā + B̅ ; (A+B) = Ā · B̅ | 德·摩根定理 |
These theorems are essential for transforming logic expressions into simpler forms, often leading to circuits that use fewer gates.
这些定理对于将逻辑表达式化简为更简单的形式至关重要,通常能减少实现电路时所需的逻辑门数量。
7. Logic Gate Simplification | 逻辑门化简
ance, simplifying A·(A+B) yields A by absorption. Another common simplification: A·B + A·B̅ = A·(B+B̅) = A·1 = A.
使用上述定理可以逐步化简复杂的布尔表达式。例如,A·(A+B) 利用吸收律直接化简为 A。另一个常见化简:A·B + A·B̅ = A·(B+B̅) = A·1 = A。
When designing circuits, always aim for the smallest number of gates to reduce cost and power consumption. Truth tables often reveal opportunities to apply complement and identity laws.
在设计电路时,应尽量减少逻辑门数量以降低成本和功耗。真值表往往能揭示应用互补律和恒等律的机会。
8. Caesar Cipher and Basic Encryption | 凯撒密码与基础加密
ncryption and decryption formulas work on an alphabet of 26 letters (A=0, B=1, ..., Z=25).
凯撒密码是一种替换密码,它将字母表中的每个字母移动固定数量的位置。加解密公式基于含 26 个字母的字母表(A=0, B=1, ..., Z=25)。
Encryption: E(x) = (x + n) mod 26
Decryption: D(x) = (x - n) mod 26
Here x is the numeric value of the plaintext letter, n is the shift key, and mod 26 wraps the result around the alphabet. Example with shift 3: 'A' (0) becomes 'D' (3); 'Z' (25) becomes 'C' (2).
其中 x 是明文字母的数值,n 是移位密钥,mod 26 保证结果在字母表内循环。以偏移量 3 为例:'A' (0) 加密为 'D' (3);'Z' (25) 加密为 'C' (2)。
The Caesar cipher is weak and easily broken by brute force; stronger ciphers often involve binary operations such as XOR, which flips bits according to a key.
凯撒密码安全性弱,容易通过穷举破解;更强的密码通常涉及异或(XOR)等二进制操作,根据密钥翻转位值。
9. Network Data Transfer Time | 网络数据传输时间
The time required to transfer a file over a network depends on the file size and the available bandwidth (transfer rate). The formula assumes all units are consistent.
通过网络传输文件所需的时间取决于文件大小和可用带宽(传输速率)。公式要求单位统一。
Transfer time (seconds) = File size (bits) / Transfer rate (bps)
传输时间(秒)= 文件大小(位) ÷ 传输速率(bps)
its before dividing. Example: a 100 MB file (100 × 8 × 10⁶ bits = 800 million bits) over a 10 Mbps link (10 × 10⁶ bps) takes 800,000,000 / 10,000,000 = 80 seconds.
常用速率单位:bps(位/秒),Kbps(千位/秒,10³ bps),Mbps(10⁶ bps),Gbps(10⁹ bps)。计算前务必将文件大小转为位。示例:100 MB 文件(100 × 8 × 10⁶ 位 = 8 亿位)通过 10 Mbps 链路(10 × 10⁶ bps)传输需 800,000,000 ÷ 10,000,000 = 80 秒。
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 needed to find an item (or confirm it is absent) is proportional to the logarithm of the list size.
二分查找针对已排序列表,通过反复将查找区间对半分割实现。查找一个元素(或确认其不存在)所需的最大比较次数与列表大小的对数成正比。
Maximum comparisons = ⌈log₂ n⌉
最大比较次数 = ⌈log₂ n⌉
Here n is the number of items in the list, and ⌈ ⌉ eger). For a list of 1000 items, log₂ 1000 ≈ 9.97, so at most 10 comparisons are required.
其中 n 是列表中的元素个数,⌈ ⌉ 表示天花板函数(向上取整)。对于包含 1000 个元素的列表,log₂ 1000 ≈ 9.97,因此最多需要 10 次比较。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

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