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

Year 12 WJEC Computer Science: Formula & Theorem Quick Reference Handbook | Year 12 WJEC 计算机:公式定理速查手册

2026-07-22 02:59 · 本文部分内容由AI辅助创作

📚 Year 12 WJEC Computer Science: Formula & Theorem Quick Reference Handbook | Year 12 WJEC 计算机:公式定理速查手册

This handbook collects the essential formulas, laws, and theorems needed for the Year 12 WJEC Computer Science course. It serves as a quick reference for revision, covering Boolean algebra, data representation, computational logic, file size estimation, and assembly-level calculations. Every core concept is presented with clear notation and practical examples to help you master both theoretical and applied topics.

本手册汇集了 Year 12 WJEC 计算机课程的核心公式、定律与定理,可作为考前快速查阅的速查手册。内容涵盖布尔代数、数据表示、逻辑电路、文件大小估算以及汇编级计算,每个要点均配合清晰符号与实际示例,助你高效掌握理论与应用。

1. Boolean Algebra Laws and Theorems | 布尔代数基本定律与定理

Boolean algebra forms the foundation of digital logic design. The fundamental laws include identity, null (annulment), idempotent, complement, commutative, associative, distributive, absorption, and double negation. These laws allow us to simplify logic expressions and minimise gate usage.

布尔代数是数字逻辑设计的基石。其基本定律包括同一律、有界律(零元律)、幂等律、互补律、交换律、结合律、分配律、吸收律和双重否定律。利用这些定律可以化简逻辑表达式,减少门电路使用。

Identity Law: A + 0 = A   A · 1 = A

同一律:A + 0 = A   A · 1 = A

Null Law: A + 1 = 1   A · 0 = 0

有界律:A + 1 = 1   A · 0 = 0

Idempotent Law: A + A = A   A · A = A

幂等律:A + A = A   A · A = A

Complement Law: A + A' = 1   A · A' = 0

互补律:A + A' = 1   A · A' = 0

Commutative Law: A + B = B + A   A · B = B · A

交换律:A + B = B + A   A · B = B · A

Associative Law: A + (B + C) = (A + B) + C   A · (B · C) = (A · B) · C

结合律:A + (B + C) = (A + B) + C   A · (B · C) = (A · B) · C

Distributive Law: A · (B + C) = (A · B) + (A · C)   A + (B · C) = (A + B) · (A + C)

分配律:A · (B + C) = (A · B) + (A · C)   A + (B · C) = (A + B) · (A + C)

Absorption Law: A + (A · B) = A   A · (A + B) = A

吸收律:A + (A · B) = A   A · (A + B) = A

Double Negation: (A')' = A

双重否定律:(A')' = A


2. De Morgan's Theorems | 德摩根定理

De Morgan's theorems are crucial for transforming ANDs into ORs (and vice versa) under complementation. They are used extensively to simplify circuits and to convert between SOP (Sum of Products) and POS (Product of Sums) forms. The theorems state that the complement of a conjunction is the disjunction of complements, and the complement of a disjunction is the conjunction of complements.

德摩根定理在逻辑取反条件下将“与”运算转换为“或”运算(反之亦然),被广泛用于化简电路以及在“积之和”与“和之积”形式间进行转换。定理指出:一个合取的补等于各因子的补之析取;一个析取的补等于各项的补之合取。

(A · B)' = A' + B'

(A + B)' = A' · B'

These generalise to multiple variables: (A · B · C ...)' = A' + B' + C' + ... and (A + B + C ...)' = A' · B' · C' · ...

推广到多个变量:(A · B · C ...)' = A' + B' + C' + ... ;(A + B + C ...)' = A' · B' · C' · ...

When simplifying a NAND-to-NAND or NOR-to-NOR implementation, apply De Morgan’s theorem to eliminate wire inversions and achieve a minimal two-level circuit. In exam questions, you often need to convert a given expression into a form using only NAND or only NOR gates.

在实现全 NAND 或全 NOR 电路时,可应用德摩根定理消除非门连线,得到最简两级电路。考试题常常要求将给定表达式转换为仅用 NAND 门或仅用 NOR 门的形式。

Example: Convert (A' · B)' into a form using only NAND: (A' · B)' = A'' + B' = A + B' n then be built with NAND gates after further correction. Always verify with truth tables.

示例: 将 (A' · B)' 转换为仅用 NAND 的形式:(A' · B)' = A'' + B' = A + B',再进一步调整后用 NAND 门实现。务必用真值表验证。


3. Binary Arithmetic and Overflow Detection | 二进制运算与溢出检测

le rules: 0+0=0, 0+1=1, 1+0=1, 1+1=0 carry 1. Subtraction is typically performed using two' the given number of bits. Overflow detection rules differ between unsigned and signed (two's complement) numbers.

二进制加法遵循简单规则:0+0=0, 0+1=1, 1+0=1, 1+1=0 进位 1。减法通常采用二进制补码运算。当加法或减法结果超出给定位数所能表示的范围时,即发生溢出。无符号数和有符号(补码)数的溢出检测规则不同。

For unsigned numbers, overflow is indicated by a carry out of the most significant bit (MSB). For two's complement signed numbers, overflow is detected by examining the carry into the MSB and the carry out of the MSB: if they are different, an overflow has occurred.

对于无符号数,溢出由最高有效位产生进位表示。对于二进制补码有符号数,溢出检测需考察进入 MSB 的进位和从 MSB 出来的进位:若二者不同,则发生溢出。

Overflow (two's complement) = Carry-in to MSB XOR Carry-out from MSB

溢出(补码)= 进入 MSB 的进位 ⊕ 离开 MSB 的进位

Two' omplement negation formula: -X = invert all bits of X and add 1. The range of an n-bit two's complement integer is -2n-1 to 2n-1 - 1.

二进制补码求负公式:-X = 将 X 所有位取反后加 1。n 位补码整数的表示范围为 -2n-1 至 2n-1 - 1。

Example: For 4-bit two' 111 (7) + 0001 (1) = 1000 (-8). Carry-in to MSB: 1, carry-out: 0 → 1 XOR 0 = 1 → overflow.

示例: 4 位补码下,0111 (7) + 0001 (1) = 1000 (-8)。进入 MSB 进位为 1,离开为 0 → 1 XOR 0 = 1,溢出。


4. Floating Point Representation | 浮点数表示

WJEC typically uses a simplified single-precision floating-point format with a mantissa (including a sign bit) and an exponent, stored in a fixed number of bits. The decimal value is given by: (-1)s × 1.m × 2e - bias, where s is the sign bit, m is the fractional part of the mantissa (the leading 1 is implicit for normalised numbers), e is the stored exponent, and the bias is 2k-1 - 1 for a k-bit exponent.

WJEC 通常使用一种简化的单精度浮点格式,由包含符号位的尾数和指数组成,存储于固定位数中。十进制值计算公式为:(-1)s × 1.m × 2e - 偏移量,其中 s 为符号位,m 为尾数的小数部分(规格化数中隐含前导 1),e 为存储的指数,对于 k 位指数,偏移量为 2k-1 - 1。

Value = (-1)s × 1.m × 2(e - bias)

To normalise a positive binary number, shift the binary point so that exactly one '1' appears before the point, and adjust the exponent accordingly. The mantissa stores the bits after the point. The exponent is stored in excess (biased) form. Denormalised numbers represent values smaller than the smallest normalised value and use an implied leading 0.

规格化一个正二进制数时,移动小数点使得小数点前恰好有一个“1”,并相应调整指数。尾数存储小数点之后的位。指数以移码(带偏移量)形式存储。非规格化数表示比最小规格化数还小的值,此时隐含前导 0。

Example in 8-bit mantissa (1 sign bit + 7 magnitude) and 4-bit exponent (bias 7): 100, exponent = 1010₂ = 10, biased = 10-7=3 → value = 1.1001100 × 2³ = 1100.1100₂ = 12.75.

示例(8 位尾数含 1 符号位 + 7 位数值,4 位指数,偏移量 7): 0 1001100 1010 → 符号 0,尾数 = 1.1001100,指数 = 1010₂ = 10,移码值 = 10-7=3 → 数值 = 1.1001100 × 2³ = 1100.1100₂ = 12.75。


5. File Size Calculation | 文件大小计算

ts × bits per element, then convert to bytes, kilobytes, etc. The exact parameters depend on the media type.

估算图像、声音和文本文件的大小是常见考点。未压缩文件的基本公式为:大小 = 元素数量 × 每元素比特数,再转换为字节、千字节等。具体参数取决于媒体类型。

Image file size: bitmap with 24-bit colour: 1024 × 768 × 24 = 18,874,368 bits = 2,359,296 bytes ≈ 2.25 MB.

图像文件大小: 宽度(像素)× 高度(像素)× 颜色深度(每像素位数)。例如,1024×768 的 24 位位图:1024 × 768 × 24 = 18,874,368 比特 = 2,359,296 字节 ≈ 2.25 MB。

Sound file size: 3-minute recording: 44100 × 16 × 2 × 180 = 253,440,000 bits = 31,680,000 bytes ≈ 30.2 MB.

声音文件大小: 采样率 (Hz) × 采样分辨率 (bit) × 声道数 × 时长 (秒)。立体声 44.1 kHz、16 bit、3 分钟录音:44100 × 16 × 2 × 180 = 253,440,000 比特 = 31,680,000 字节 ≈ 30.2 MB。

Text file size: book with 2000 characters per page in 8-bit ASCII: 500 × 2000 × 8 = 8,000,000 bits = 1 MB.

文本文件大小: 字符数 × 每字符位数(如 ASCII 7/8 bit,Unicode UTF-8 可达 32 bit)。一本 500 页、每页 2000 字符、8 位 ASCII 的书:500 × 2000 × 8 = 8,000,000 比特 = 1 MB。


6. Boolean Expression Simplification Using Laws | 利用定律化简布尔表达式

Simplification is a core skill tested in logic design. By systematically applying Boolean laws, you can reduce a complex expression to its minimal form, which translates to fewer logic gates and lower cost. Typical techniques include factoring, using distributive laws, and applying adjacent cell merging (similar to Karnaugh map reasoning).

化简是逻辑设计中的核心技能。通过系统运用布尔定律,可将复杂表达式化为最简形式,从而减少门电路数量、降低成本。常用技巧包括提取公因子、运用分配律以及利用相邻项合并(类似卡诺图的思想)。

Key strategies:

关键策略:

Example: Simplify Z = ABC + ABC' + AB'C.

示例: 化简 Z = ABC + ABC' + AB'C。

Z = AB(C + C') + AB'C = AB(1) + AB'C = AB + AB'C = A(B + B'C) = A(B + C) = AB + AC.

The simplified expression requires only one AND gate for each product and one OR gate.

最简表达式仅需每个乘积项一个与门和一个或门。


广告 / Sponsored

7. Logic Gate Equivalences: Universal Gates | 逻辑门等价:通用门

NAND and NOR gates are called universal gates because any Boolean function can be implemented using only NAND gates or only NOR gates. This property is important for circuit minimisation and for manufacturing with standardised ICs. The equivalences are derived using De Morgan and double negation.

NAND 门和 NOR 门被称为通用门,因为任何布尔函数都可以仅用 NAND 门或仅用 NOR 门实现。这一特性对于电路最小化和采用标准化集成电路制造至关重要。其等价关系可通过德摩根定理和双重否定律推导。

Basic conversions using NAND:

用 NAND 实现基本门:

Using NOR:

用 NOR 实现:

For a multilevel circuit, convert the whole expression step-by-step by replacing each gate with its NAND/NOR equivalent, ensuring correct wire inversions.

对于多级电路,可逐步将每个门替换为 NAND/NOR 等价电路,并确保反相连接正确。


8. Time Complexity and Big O Notation | 时间复杂度与大 O 符号

Time complexity measures how an algorithm's running time grows with input size n. Big O notation describes the upper bound (worst-case) growth rate, ignoring constants and lower-order terms. Common complexities for Year 12 include linear search (O(n)), binary search (O(log n)), bubble sort (O(n²)), and merge sort (O(n log n)).

时间复杂度衡量算法运行时间随输入规模 n 增长的趋势。大 O 符号描述上界(最坏情况)增长率,忽略常数和低阶项。Year 12 常见复杂度包括线性搜索 O(n)、二分搜索 O(log n)、冒泡排序 O(n²) 和归并排序 O(n log n)。

Binary search: T(n) = O(log₂ n)

Bubble sort (worst/average): T(n) = O(n²)

Merge sort: T(n) = O(n log₂ n), recurrence: T(n) = 2T(n/2) + O(n)

When analysing loops, multiplicative loops yield O(n²) (e.g., nested loops from 0 to n-1), while divide-and-conquer algorithms typically yield O(n log n). Constant time operations (e.g., array index access) are O(1).

分析循环时,相乘嵌套循环导致 O(n²)(如 0 到 n-1 的嵌套循环),而分治算法通常产生 O(n log n)。常数时间操作(如数组索引访问)为 O(1)。

For exam questions, be prepared to compare efficiencies: an O(log n) algorithm scales far better than O(n²) for large n. Space complexity is sometimes examined, using similar notation.

考试中需能比较算法效率:对于大规模 n,O(log n) 算法的扩展性远优于 O(n²)。有时也会考查空间复杂度,符号类似。


9. Addressing Modes and Effective Address Calculation | 寻址模式与有效地址计算

In assembly language, the way an operand is accessed is determined by the addressing mode. The effective address (EA) is the actual memory location referenced. WJEC requires familiarity with immediate, direct, indirect, and indexed addressing, and how the effective address is derived.

在汇编语言中,操作数的访问方式由寻址模式决定。有效地址 (EA) 是实际引用的内存位置。WJEC 要求熟悉立即寻址、直接寻址、间接寻址和变址寻址,并理解有效地址的推导方式。

Common modes:

常见模式:

ressing is particularly useful for accessing array elements. If IX = 3 and the instruction' = 2003. This matches high-level language constructs like for-loop iterations over arrays.

变址寻址特别适合访问数组元素。若 IX = 3,指令基地址为 2000,则 EA = 2003。这对应高级语言中数组循环遍历的构造。


10. Assembly Language Operations | 汇编语言操作

The WJEC syllabus expects understanding of a simplified assembly language, typically including operations like LDA (load), STA (store), ADD, SUB, AND, OR, NOT, JMP, JZ (jump if zero), JNZ, and HLT. The affected flags (Zero, Negative, Carry, Overflow) in the status register are also part of the model.

WJEC 大纲要求理解简化汇编语言,通常包括 LDA(加载)、STA(存储)、ADD(加法)、SUB(减法)、AND(逻辑与)、OR(逻辑或)、NOT(逻辑非)、JMP(无条件跳转)、JZ(为零跳转)、JNZ(非零跳转)和 HLT(停机)。状态寄存器中的标志位(零标志、负标志、进位标志、溢出标志)也是模型的一部分。

Each instruction follows a fetch–decode–execute cycle. The effect on registers and memory can be expressed formulaically:

每条指令遵循取指-译码-执行周期。对寄存器和内存的影响可用公式表示:

Branching instructions check the Zero flag: JZ addr (if Z=1 then PC ← MP unconditionally loads the program counter with the target address. HLT stops the clock.

分支指令检查零标志:JZ addr(若 Z=1 则 PC ← addr)。JMP 无条件将程序计数器加载为目标地址。HLT 停止时钟。

Trace tables are used to track register and memory contents step by step, a key exam skill.

跟踪表用于逐步追踪寄存器和内存内容,是关键的考试技能。


11. Data Units and Transfer Rates | 数据单位与传输速率

en measured in bits per second (bps). Time to transfer = total data size / transfer rate. Be careful to distinguish between binary units (powers of 2) and decimal units: 1 KiB = 2¹⁰ bytes, 1 KB = 10³ bytes.

理解二进制前缀和传输速率计算对网络和存储场景至关重要。传输速度通常以比特每秒 (bps) 衡量。传输时间 = 总数据大小 / 传输速率。注意区分二进制单位(2 的幂)和十进制单位:1 KiB = 2¹⁰ 字节,1 KB = 10³ 字节。

Common conversions:

常用换算:

Example: lways check whether the question expects binary or decimal units to avoid rounding errors.

示例: 通过 100 Mbps 链路传输 20 MiB 文件:20 MiB = 20 × 1024 × 1024 × 8 bit ≈ 167,772,160 bit。时间 = 167,772,160 / 100,000,000 ≈ 1.68 秒。务必检查题目要求二进制还是十进制单位,以避免舍入误差。


12. Error Checking Methods: Parity, Checksum, and Hamming Distance | 错误检测方法:奇偶校验、校验和与汉明距离

Error detection and correction are vital for reliable data transmission and storage. Simple methods include parity bits and checksums; more advanced codes use Hamming distance. The effectiveness is often expressed by the minimum Hamming distance d of a code: it can detect up to d−1 errors and correct up to ⌊(d−1)/2⌋ errors.

错误检测与纠正确保数据传输与存储的可靠性。简单方法包括奇偶校验位和校验和;更高级的编码使用汉明距离。编码效率常以最小汉明距离 d 表示:可检测最多 d−1 个错误,纠正最多 ⌊(d−1)/2⌋ 个错误。

Error detection capability = d − 1; error correction capability = ⌊(d − 1)/2⌋

Parity bit: added to make the total number of 1s even (even parity) or odd (odd parity). Single-bit parity can detect any single-bit error, but cannot detect an even number of bit errors. It adds a single bit of redundancy.

奇偶校验位: 增加一位使 1 的总数为偶数(偶校验)或奇数(奇校验)。一位奇偶校验可检测任何单个位错误,但不能检测偶数个位错误。它增加一位冗余。

Checksum: the data is divided into blocks, and the sum (often one's complement) is appended. The receiver recalculates and compares. Checksums can detect burst errors, but not all patterns.

校验和: 将数据划分为块,计算总和(通常采用反码)并附加。接收方重新计算比较。校验和可检测突发错误,但不能检测所有模式。

Hamming code: ion (SEC). For a code with m parity bits and n data bits, the total word length is m+n ≤ 2m − 1. For example, for 4 data bits we need 3 parity bits (7-bit codeword).

汉明码: 在 2 的幂次位置放置多个奇偶校验位,以实现单错纠正 (SEC)。对于 m 个校验位和 n 个数据位,总码字长度满足 m+n ≤ 2m − 1。例如,4 个数据位需要 3 个校验位(7 位码字)。

Calculating the minimum Hamming distance of a set of codewords can be examined: simply count the number of differing positions between any two valid codewords and take the smallest.

计算一组码字的最小汉明距离也是考点:只需找出任意两个有效码字间不同位的数量,取最小值。

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

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

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

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