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

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

This quick reference guide collates the essential formulas, theorems, and conversion rules needed for the Year 11 WJEC Computer Science specification. Each entry is presented with its mathematical expression or definition, followed by worked examples where appropriate. Use this handbook to reinforce your understanding of data representation, Boolean logic, algorithm efficiency, and more.

本速查手册汇集了 Year 11 WJEC 计算机科学课程所需的基本公式、定理和转换规则。每个条目都给出了数学表达式或定义,并尽可能配有示例。利用这本手册可以巩固你对数据表示、布尔逻辑、算法效率等方面知识的理解。


1. Data Units & Storage Calculations | 数据单位与存储计算

A bit is the smallest unit of data, representing a binary 0 or 1. Eight bits form one byte.

位(bit)是最小的数据单位,表示二进制 0 或 1。8 个位组成 1 个字节(byte)。

When calculating file sizes or memory requirements, the following unit multipliers are used. In WJEC assessments, 1 kilobyte (KB) is treated as 1024 bytes, 1 megabyte (MB) as 1024 KB, and so on, following binary prefixes (kibibyte, mebibyte). However, some contexts may use SI units (1000); always check the question.

计算文件大小或内存需求时,会用到以下单位倍数。在 WJEC 考试中,通常 1 千字节 (KB) 按 1024 字节计算,1 兆字节 (MB) 按 1024 KB 计算,依此类推,遵循二进制前缀。但有时会用到 SI 单位(1000),请务必看清题目要求。

  • 1 byte = 8 bits
  • 1 KB = 1024 bytes
  • 1 MB = 1024 KB
  • 1 GB = 1024 MB

To convert a size given in one unit to bits, multiply step by step. For example, 5 MB in bits: 5 × 1024 × 1024 × 8 = 41,943,040 bits.

将一种单位的大小转换为位时,需要逐步相乘。例如,5 MB 换算为位:5 × 1024 × 1024 × 8 = 41 943 040 位。

The generic formula for the number of values representable with n bits is:

用 n 个位可表示的数值个数通用公式为:

Number of values = 2ⁿ

Thus, 3 bits can represent 2³ = 8 distinct values, ranging from 0 to 7 in unsigned binary.

因此,3 个位可以表示 2³ = 8 个不同的值,无符号二进制下范围是 0 到 7。


2. Image & Sound File Size Formulas | 图像与声音文件大小公式

The file size of a bitmap image depends on its resolution and colour depth. The formula in bits is:

位图图像的文件大小取决于分辨率和颜色深度。以位为单位的公式为:

Image file size (bits) = width in pixels × height in pixels × colour depth (bits per pixel)

To express the result in bytes, divide by 8. For a 1024×768 image with 24-bit colour depth, the raw size is 1024 × 768 × 24 = 18,874,368 bits = 2,359,296 bytes ≈ 2.25 MB.

若要转换为字节,再除以 8。例如,一张 1024×768 像素、24 位色彩深度的图像,原始大小为 1024 × 768 × 24 = 18 874 368 位 = 2 359 296 字节 ≈ 2.25 MB。

For sound files, the size depends on the sample rate, bit depth, number of channels, and duration. The formula in bits is:

对于声音文件,大小取决于采样率、采样位深、声道数和时长。以位为单位的公式为:

Sound file size (bits) = sample rate (Hz) × bit depth × number of channels × duration in seconds

As with images, divide by 8 to obtain bytes. A 44.1 kHz stereo (2 channels) recording with 16 bits per sample lasting 30 seconds uses: 44,100 × 16 × 2 × 30 = 42,336,000 bits = 5,292,000 bytes ≈ 5.05 MB.

和图像类似,再除以 8 得到字节数。一段 44.1 kHz、立体声(2 声道)、16 位采样、时长 30 秒的录音所需大小为:44 100 × 16 × 2 × 30 = 42 336 000 位 = 5 292 000 字节 ≈ 5.05 MB。

Always ensure measurements are in the correct units before substituting into the formula.

在代入公式之前,务必确保各数据使用正确的单位。


3. Compression Ratio | 压缩比

Compression ratio measures how much a file has been reduced in size. It is usually expressed as a ratio or a simple number.

压缩比用于衡量文件大小被缩减的程度,通常以比值或简单的数字表示。

Compression ratio = size of uncompressed file ÷ size of compressed file

For example, if an original 8 MB image is compressed to 2 MB, the compression ratio is 8 ÷ 2 = 4. This is often written as 4:1, meaning the uncompressed version is four times larger.

例如,一张原始 8 MB 的图像被压缩至 2 MB,压缩比为 8 ÷ 2 = 4,常写成 4:1,表示未压缩版本是压缩后的四倍大。

Lossless compression achieves modest ratios, while lossy compression can reach much higher ratios by discarding some data.

无损压缩的压缩比较小,而有损压缩通过舍弃部分数据可以达到高得多的压缩比。

The space saved can be calculated as a percentage: ((original – compressed) / original) × 100%. In the example above, space saved = ((8 – 2) / 8) × 100% = 75%.

节省的空间可以用百分比计算:((原始大小 – 压缩后) / 原始大小) × 100%。上例中节省的空间 = ((8 – 2) / 8) × 100% = 75%。


4. Transmission Time & Data Transfer | 传输时间与数据传输

When sending a file over a network, the time taken depends on the file size and the transfer rate. The basic relationship is:

通过网络传输文件时,所需时间取决于文件大小和传输速率。基本关系为:

Time (seconds) = file size (bits) ÷ transfer rate (bits per second, bps)

Care must be taken to match units: if the file size is given in MB and the speed in Mbps, convert both to bits. For instance, a 100 MB file transferred at 50 Mbps: first convert file size to bits (100 × 1024 × 1024 × 8 = 838,860,800 bits); rate is 50 × 10⁶ bps (if using SI units). Time = 838,860,800 ÷ 50,000,000 ≈ 16.78 seconds.

必须注意单位的统一:如果文件大小以 MB 给出,速度以 Mbps 给出,则两者都要转换成位。例如,以 50 Mbps 传输 100 MB 文件:先将文件大小转换为位 (100 × 1024 × 1024 × 8 = 838 860 800 位);速率若为 SI 单位则 50 × 10⁶ bps。时间 = 838 860 800 ÷ 50 000 000 ≈ 16.78 秒。

Additionally, network overheads such as packet headers and protocols can slightly increase the actual transfer time, but the formula gives a baseline theoretical calculation.

另外,数据包头部和协议等网络开销会略微增加实际传输时间,但此公式给出的是理论上的基本计算。


5. Binary & Hexadecimal Conversions | 二进制与十六进制转换

Computers store data in binary, but hexadecimal (base‑16) is used as a more human‑readable shorthand. To convert binary to hexadecimal, group the binary digits into nibbles (4 bits) from right to left, then replace each group with the corresponding hex symbol.

计算机使用二进制存储数据,但十六进制(基数为 16)被用作更易读的简写形式。将二进制转换为十六进制时,从右到左将二进制数字每 4 位分为一组(nibble),然后将每组替换为对应的十六进制符号。

The hexadecimal digits are 0–9 and A–F, where A = 10, B = 11, up to F = 15. For example, the binary number 11010111 is grouped as 1101 0111, which becomes D7 in hexadecimal.

十六进制数字为 0–9 和 A–F,其中 A = 10, B = 11,直到 F = 15。例如,二进制数 11010111 分组为 1101 0111,转换为十六进制即为 D7。

To convert hexadecimal to binary, reverse the process: write each hex digit as a 4‑bit binary equivalent. Thus, A2F becomes 1010 0010 1111.

将十六进制转换为二进制则相反:将每个十六进制数字写成对应的 4 位二进制形式。因此 A2F 变为 1010 0010 1111。

Between hexadecimal and decimal, you can either use repeated division by 16 or go via binary. This is particularly helpful when dealing with colour codes (e.g., #FF00CC) or memory addresses.

在十六进制和十进制之间转换,可以使用反复除以 16 的方法,或借助二进制过渡。在处理颜色代码(如 #FF00CC)或内存地址时,这尤其有用。


6. Two’s Complement & Overflow | 二进制补码与溢出

To represent negative integers, WJEC uses two’s complement notation for a fixed number of bits. The most significant bit (MSB) acts as the sign bit: 0 for positive, 1 for negative.

WJEC 使用二进制补码表示法在固定位数下表示负整数。最高有效位 (MSB) 作为符号位:0 表示正数,1 表示负数。

To find the two’s complement of a negative number, invert all bits of the positive magnitude and add 1. For example, in 8 bits, −7 is found by taking +7 (0000 0111), inverting to 1111 1000, and adding 1 to give 1111 1001.

求一个负数的补码表示时,先写出其绝对值的二进制形式,将所有位取反,然后加 1。例如,用 8 位表示 −7:先写出 +7 (0000 0111),取反得 1111 1000,加 1 后为 1111 1001。

Overflow occurs when the result of an addition is too large to be represented within the allocated number of bits, causing the sign to change incorrectly. In an 8‑bit system, adding 0111 0000 (+112) and 0110 0000 (+96) gives 1101 0000, which is a negative value in two’s complement — this is overflow.

当加法结果超出分配的位数所能表示的范围,导致符号位出现错误时,即为溢出。在 8 位系统中,将 0111 0000 (+112) 与 0110 0000 (+96) 相加得到 1101 0000,在补码表示下这是一个负数——这就是溢出。

The range of 8‑bit two’s complement numbers is −128 to +127; more generally, for n bits the range is −2ⁿ⁻¹ to 2ⁿ⁻¹−1.

8 位补码表示的范围是 −128 到 +127;一般地,对于 n 位,范围是 −2ⁿ⁻¹ 至 2ⁿ⁻¹−1。


7. Boolean Algebra Laws & Simplification | 布尔代数定律与化简

Boolean algebra is used to simplify logic circuits and conditions. The following theorems are fundamental. Notation: A · B means A AND B, A + B means A OR B, and A’ denotes NOT A.

布尔代数用于简化逻辑电路和条件判断。以下定理是基础。符号说明:A · B 表示 A 与 B,A + B 表示 A 或 B,A’ 表示非 A。

Commutative: A · B = B · A ; A + B = B + A

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

Associative: (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: 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)

The identity and annulment laws: A + 0 = A, A · 1 = A, A + 1 = 1, A · 0 = 0. The complement law: A + A’ = 1, A · A’ = 0.

同一律与零律:A + 0 = A,A · 1 = A,A + 1 = 1,A · 0 = 0。互补律:A + A’ = 1,A · A’ = 0。

De Morgan’s Theorems are critical for converting between AND and OR gates:

德摩根定理对于转换与门和或门至关重要:

De Morgan: (A · B)’ = A’ + B’ ; (A + B)’ = A’ · B’

德摩根定理:(A · B)’ = A’ + B’ ; (A + B)’ = A’ · B’

Additionally, the absorption law helps simplify expressions: A + A · B = A, and A · (A + B) = A.

此外,吸收律有助于化简表达式:A + A · B = A,以及 A · (A + B) = A。


8. Logic Gate Symbols & Truth Tables | 逻辑门符号与真值表

WJEC expects you to recognise standard ANSI/IEEE logic gate symbols and be able to complete truth tables. The basic gates and their truth tables are summarised below using A and B as inputs and Q as output.

WJEC 要求能识别标准的 ANSI/IEEE 逻辑门符号,并能填写真值表。下面以 A 和 B 为输入、Q 为输出,总结基本门电路及其真值表。

Gate Boolean Expression Truth Table (A,B → Q)
AND Q = A · B 00→0, 01→0, 10→0, 11→1
OR Q = A + B 00→0, 01→1, 10→1, 11→1
NOT Q = A’ 0→1, 1→0 (single input)
NAND Q = (A · B)’ 00→1, 01→1, 10→1, 11→0
NOR Q = (A + B)’ 00→1, 01→0, 10→0, 11→0
XOR Q = A ⊕ B 00→0, 01→1, 10→1, 11→0

You should also be able to combine gates and derive a complete truth table for a given logic circuit, as well as write the corresponding Boolean expression.

你还应能组合门电路,为给定的逻辑电路推导完整真值表,并写出对应的布尔表达式。


9. Algorithm Complexity & Performance Formulas | 算法复杂度与性能公式

Understanding how the performance of an algorithm scales with input size n is essential. The big O notation provides a mathematical measure of the worst‑case number of steps.

理解算法性能如何随输入规模 n 变化至关重要。大 O 符号从数学上衡量最坏情况下的步骤数。

Linear search: O(n) — worst case checks every element.

线性搜索:O(n) —— 最坏情况会检查每个元素。

Binary search: O(log₂ n) — halves the search space each step (requires sorted data).

二分搜索:O(log₂ n) —— 每一步将搜索空间减半(要求数据已排序)。

Bubble sort (worst/average): O(n²) — nested loops compare adjacent pairs.

冒泡排序(最坏/平均):O(n²) —— 嵌套循环比较相邻元素。

Merge sort: O(n log n) — divides list and merges sorted halves.

归并排序:O(n log n) —— 分割列表并合并已排序的子列表。

For a practical estimate, if n = 1,000, a binary search takes about log₂(1000) ≈ 10 steps in the worst case, whereas a linear search could take up to 1000 steps.

在实际估算中,若 n = 1000,二分搜索最坏需要约 log₂(1000) ≈ 10 步,而线性搜索可能需要高达 1000 步。

Time complexity is not the only metric: auxiliary space (memory) usage may also be tested; for instance, merge sort requires O(n) extra space, whereas bubble sort uses O(1).

时间复杂度并非唯一指标:辅助空间(内存)使用也可能考查;例如,归并排序需要 O(n) 额外空间,而冒泡排序仅需 O(1)。


10. Error Detection: Parity & Checksums | 错误检测:奇偶校验与校验和

Parity checking is a simple method for detecting single‑bit errors during data transmission. In even parity, the number of 1s in a binary unit (including the parity bit) is made even.

奇偶校验是一种简单的检测数据传输中单比特错误的方法。采用偶校验时,会让一个二进制单元(含校验位)中 1 的个数为偶数。

If the data byte 1011010 has five 1s, an even parity bit would be set to 1, making the total count six (even). The receiver can detect an error if the count is odd, but cannot locate or correct it.

如果数据字节 1011010 中有五个 1,偶校验位就会被设为 1,使总数为六(偶数)。接收端若发现 1 的个数为奇数,则可检测到错误,但无法定位或纠正错误。

A checksum is a numerical value calculated from a block of data. The sender computes the sum of data values (often modulo 256) and appends it. The receiver performs the same calculation and compares the checksum.

校验和是根据数据块计算出的数值。发送方计算数据值的和(通常模 256)并附加在后面;接收方执行同样的计算并比对校验和。

For example, if the data bytes are 45, 23, 7D (in hexadecimal), their sum is 45 + 23 + 7D = E5. If the lower byte is used, checksum = E5. When the receiver calculates E5 and it matches, the data is assumed valid.

例如,数据字节为 16 进制的 45、23、7D,和为 45 + 23 + 7D = E5。如果取低字节,校验和即为 E5。接收方计算出 E5 且匹配,则认为数据有效。

Parity and checksums cannot guarantee error‑free communication, but they are lightweight and useful in many storage and transmission protocols.

奇偶校验和校验和不能保证无差错通信,但它们开销小,在众多存储和传输协议中十分有用。


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

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

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version