← 返回资讯屏轩教育 · 行业资讯

OCR Year 12 Computer Science Formula & Theorem Quick Reference | OCR 12年级计算机科学公式定理速查手册

2026-07-21 16:10 · 本文部分内容由AI辅助创作

📚 OCR Year 12 Computer Science Formula & Theorem Quick Reference | OCR 12年级计算机科学公式定理速查手册

This handbook collects all essential formulas, laws, and theorems you need for the OCR Year 12 Computer Science course. Each entry is presented with clear notation and a short worked example where helpful, so you can revise efficiently and avoid mixing up units. Keep it handy while tackling past papers or writing pseudocode.

本手册汇集了 OCR 12年级计算机科学课程中所有核心的公式、定律和定理。每个条目均配有清晰的符号表示,并在适当处给出简短演算示例,帮助高效复习、避免单位混淆。做历年真题或编写伪代码时请随时查阅。

1. Image File Size Calculation | 图像文件大小计算

Image file size in bits is the product of width, height, and bit depth. Always check whether the bit depth is given per pixel or per colour channel; if it is per channel, multiply by the number of channels first.

图像文件大小(以位为单位)是宽度、高度与色深的乘积。务必确认色深是按每像素还是按每通道给出;若是每通道,需先乘以通道数。

File Size (bits) = W (pixels) × H (pixels) × Bit Depth (bpp)

80 image with 24 bpp requires 1920×1080×24 = 49,766,400 bits = 6,220,800 bytes ≈ 5.93 MiB.

位转字节需除以8。要得到千字节,除以 (8×1024)。一张 1920×1080、24 bpp 的图像所需大小为 1920×1080×24 = 49,766,400 位 = 6,220,800 字节 ≈ 5.93 MiB。


2. Sound File Size Calculation | 声音文件大小计算

Uncompressed sound file size depends on sample rate, sample resolution, number of channels, and duration. This formula gives the size in bits; divide by 8 for bytes.

未压缩的音频文件大小取决于采样率、采样精度、声道数和时长。该公式给出的是位大小;除以8可得字节数。

Sound Size (bits) = Sample Rate (Hz) × Bit Depth × Channels × Time (s)

For example, a 10‑second stereo recording at 44.1 kHz with 16‑bit resolution uses 44,100 × 16 × 2 × 10 = 14,112,000 bits = 1,764,000 bytes ≈ 1.68 MiB.

示例:一段10秒立体声录音,采样率44.1 kHz,精度16位,大小为 44,100×16×2×10 = 14,112,000 位 = 1,764,000 字节 ≈ 1.68 MiB。


3. Text File Size and Number Base Conversions | 文本文件大小与数制转换

Plain text file size is simply the number of characters multiplied by the bits per character used by the encoding scheme. Extended ASCII uses 8 bits, while UTF‑32 uses 32 bits.

纯文本文件大小就是字符数乘以编码方案中每个字符占用的位数。扩展 ASCII 每字符8位,UTF‑32 每字符32位。

Text Size (bits) = Number of Characters × Bits per Character

For number conversion, a binary integer can be converted to denary by summing each bit multiplied by 2position he right). Hexadecimal uses groups of four bits. 1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 11₁₀.

数制转换方面,二进制整数转十进制为每位乘以2的位权次幂再求和(位权从右起从0开始)。十六进制每四位一组。1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 11₁₀。


4. Boolean Algebra Laws | 布尔代数定律

Boolean algebra provides a set of rules to manipulate logic expressions. These laws are vital for simplifying circuits and de‑coding truth tables. The table below summarises the key identities. In the expressions, A and B are Boolean variables; '+' denotes OR, '·' denotes AND, and '′' denotes NOT.

布尔代数提供一组操作逻辑表达式的规则,对简化电路和解读真值表至关重要。下表总结了主要恒等式。表达式中,A 和 B 为布尔变量,“+”表示或,“·”表示与,“′”表示非。

Law AND form OR form
IdentityA · 1 = AA + 0 = A
AnnihilatorA · 0 = 0A + 1 = 1
IdempotentA · A = AA + A = A
ComplementA · A′ = 0A + A′ = 1
Double Negation(A′)′ = A
CommutativeA · B = B · AA + B = B + A
AssociativeA · (B · C) = (A · B) · CA + (B + C) = (A + B) + C
DistributiveA · (B + C) = (A · B) + (A · C)A + (B · C) = (A + B) · (A + C)
AbsorptionA · (A + B) = AA + (A · B) = A
De Morgan's Theorem(A · B)′ = A′ + B′(A + B)′ = A′ · B′

Use De Morgan's laws to move negation from the output of a gate to its inputs. For example, (A·B′)′ becomes A′ + B after applying the law and double negation.

应用德摩根定律可将负号从门的输出移至输入。例如 (A·B′)′ 经该定律和双重否定律化简为 A′ + B。


5. Logic Gates and Truth Tables | 逻辑门与真值表

You must be able to draw, recognise, and combine the standard logic gates. The table shows the gate symbol, Boolean expression, and a condensed truth table.

你必须能够绘制、识别并组和标准逻辑门。下表展示了门的符号、布尔表达式和简化的真值表。

Gate Expression Truth Table (A,B → Output)
ANDQ = A · B00→0, 01→0, 10→0, 11→1
ORQ = A + B00→0, 01→1, 10→1, 11→1
NOTQ = A′0→1, 1→0
NANDQ = (A · B)′00→1, 01→1, 10→1, 11→0
NORQ = (A + B)′00→1, 01→0, 10→0, 11→0
XORQ = A ⊕ B00→0, 01→1, 10→1, 11→0
XNORQ = (A ⊕ B)′00→1, 01→0, 10→0, 11→1

When building truth tables for combined circuits, evaluate each intermediate gate first. Label every wire with its logic state to avoid mistakes.

为组合电路画真值表时,先求每个中间门的输出。标注每一条导线上的逻辑状态,避免出错。


广告 / Sponsored

6. CPU Performance Formulas | CPU 性能公式

CPU execution time for a program can be modelled with three fundamental metrics: instruction count (IC), cycles per instruction (CPI), and clock cycle time.

CPU 执行某程序的时间可通过三个基本指标建模:指令数 (IC)、每指令周期数 (CPI) 和时钟周期。

Execution Time = IC × CPI × Clock Cycle Time

tructions, average CPI = 1.5, execution time = 2×10⁶ × 1.5 × 0.333×10⁻⁹ = 1×10⁻³ s = 1 ms.

时钟周期是时钟频率的倒数。3 GHz 处理器的周期为 1/(3×10⁹) ≈ 0.333 ns。若程序含 2×10⁶ 条指令,平均 CPI = 1.5,执行时间 = 2×10⁶ × 1.5 × 0.333×10⁻⁹ = 1×10⁻³ 秒 = 1 毫秒。

her MIPS does not automatically mean a faster processor because different instruction sets require different IC.

比较性能时可用 MIPS = (时钟频率) / (CPI × 10⁶)。更高的 MIPS 并不自动意味着处理器更快,因为不同指令集需要不同的指令条数。


7. Network Transmission Calculations | 网络传输计算

The basic transmission time for a file over a point‑to‑point link is data size divided by bit rate. Always convert all size values to bits before dividing.

通过点对点链路传输文件的基本时间等于数据大小除以比特率。务必先将所有大小值转换为位后再相除。

Transmission Time (s) = Data Size (bits) / Bandwidth (bps)

s. In practice, propagation delay and protocol overhead increase the total transfer time.

一个 50 MiB 文件经 100 Mbps 链路发送:50×1024×1024×8 位 ≈ 419,430,400 位;时间 = 419,430,400 / 100,000,000 ≈ 4.19 秒。实际中传播延迟和协议开销会增加总传输时间。

10⁸ m/s in copper). Total latency ≈ Transmission Time + Propagation Delay + Queuing Delay.

传播延迟 = 距离 / 传播速度(铜线中常取 2×10⁸ 米/秒)。总延迟 ≈ 传输时间 + 传播延迟 + 排队延迟。


8. Data Compression Ratio | 数据压缩率

lways a value ≥ 1. Complementary metric space saving tells how much storage was reclaimed.

压缩率是比较压缩后大小与原大小的比值,总是 ≥ 1。互补指标空间节省量表明回收了多少存储空间。

Compression Ratio = Uncompressed Size / Compressed Size

Space Saving (%) = (1 - Compressed / Uncompressed) × 100

If a 200 KiB file compresses to 50 KiB, the compression ratio is 4:1 and space saving is 75%. Lossy compression often achieves higher ratios than lossless but sacrifices some information.

若 200 KiB 文件压缩至 50 KiB,压缩比为 4:1,空间节省 75%。有损压缩通常比无损压缩获得更高压缩比,但会损失部分信息。


9. Memory Addressing | 内存寻址

The number of addressable locations depends on the width of the address bus. An n‑bit address bus can directly address 2ⁿ distinct memory locations.

可寻址单元数取决于地址总线宽度。n 位地址总线可直接寻址 2ⁿ 个不同的内存单元。

Addressable Locations = 2ⁿ

bus width is m bits, total memory capacity = 2ⁿ × m bits. For example, a system with a 16‑bit address bus and 8‑it data bus can address 2¹⁶ = 65,536 locations, giving 65,536 × 8 = 524,288 bits = 64 KiB.

若数据总线宽度为 m 位,总内存容量 = 2ⁿ × m 位。例如,16位地址总线、8位数据总线的系统可寻址 2¹⁶ = 65,536 个单元,容量为 65,536 × 8 = 524,288 位 = 64 KiB。

Modern machines often have byte‑addressable memory, so each location holds one byte regardless of the physical data bus width.

现代机器大多采用字节寻址,每个位置存放一个字节,而与物理数据总线宽度无关。


10. Algorithm Complexity – Big O Notation | 算法复杂度——大 O 表示法

Big O notation describes how the execution time or space usage of an algorithm grows as the input size n increases. It concentrates on the dominant term and ignores constants.

大 O 表示法描述随输入规模 n 的增长,算法执行时间或空间使用的增长趋势,它关注主导项并忽略常数。

Complexity Class Example Algorithms Growth Curve
O(1)Array index access, hash table lookup (average)Constant
O(log n)Binary search, balanced BST operationsLogarithmic
O(n)Linear search, traversing an arrayLinear
O(n log n)Merge sort, quick sort (average)Linearithmic
O(n²)Bubble sort, insertion sort (worst case)Quadratic
O(2ⁿ)Recursive Fibonacci, travelling salesman (brute force)Exponential

When answering exam questions, always justify the complexity by referring to the number of loops, recursion tree depth, or data structure properties.

答题时务必通过循环层数、递归树深度或数据结构特性来论证复杂度。


11. Floating Point Representation | 浮点数表示

Real numbers in OCR are represented using mantissa and exponent in two's complement form. A binary floating point number takes the form:

OCR 课程中使用二进制补码形式尾数和阶码表示实数。二进制浮点数形式为:

Value = Mantissa × 2Exponent

The mantissa is a fixed‑point fraction, and the exponent is a two‑ n by adjusting the mantissa so its most significant bit differs from the sign bit. For a 4‑bit mantissa 10.10 and exponent 0010 (in two's complement), first convert mantissa to decimal: 10.10₂ = ‑(1.5) in two's complement? Always use place values: sign bit ‑ alised form ensures the first two bits of the mantissa are 01 (positive) or 10 (negative).

尾数是定点小数,阶码是二进制补码整数。规范化通过调整尾数使其最高有效位与符号位不同,来最大化精度。给定4位尾数10.10和阶码0010(二进制补码),先将尾数转为十进制:10.10₂ 在补码中为 ‑2 + 0.5 = ‑1.5。规范化形式确保尾数前两位为 01(正)或 10(负)。


12. Error Detection – Check Digits | 错误检测——校验位

Check digits help detect transcription or transmission errors. A common scheme in OCR is the modulo‑11 check digit for an ISBN‑10. The digits are weighted by their position, summed, and divided by the modulus; the remainder determines the check digit.

校验位用于检测录入或传输错误。OCR 中常见的方案是 ISBN‑10 的模11校验位。各位数字按位置加权、求和,再除以模数;余数决定校验位。

Weighted Sum = Σ (digitᵢ × weightᵢ), Check Digit = Modulus – (Sum mod Modulus)

In an even‑parity single‑bit check, an extra bit is added to a binary sequence so that the total number of 1s is even. If a single bit flips, the parity check fails.

在偶校验单比特检测中,在二进制序列后附加一位,使整个序列中 1 的个数为偶数。若单比特翻转,奇偶校验就会失败。


Published by TutorHao | Computer Science Revision Series | aleveler.com

广告 / Sponsored
Linux高级程序设计(高等院校计算机技术十二五规划教材)/刘加海/季江民/浙江大学出版社
计算机 备考教辅 · 正版现货 · 与本文内容相关
查看详情 / View on Taobao参考价 ¥55.6

更多咨询请联系16621398022(同微信)

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao