📚 Year 8 WJEC Computer Science Formula & Theorem Quick Reference Handbook | Year 8 WJEC 计算机:公式定理速查手册
This handbook provides a rapid reference to the key formulas, theorems, and conversion rules you need for Year 8 WJEC Computer Science. Each section is presented in clear English and Chinese, covering data representation, logic, algorithms, and file calculations.
本手册为 Year 8 WJEC 计算机科学提供关键公式、定理和转换规则的快速参考。每个部分均以清晰的中英双语呈现,涵盖数据表示、逻辑、算法和文件计算等内容。
1. Binary to Decimal Conversion | 二进制转十进制
To convert a binary number to decimal, multiply each bit by 2 raised to the power of its position. The rightmost bit is position 0, the next is position 1, and so on. Sum all the products to get the decimal value.
将二进制数转换为十进制:每一位乘以 2 的位次幂,最右边位是位置 0,依次向左递增。将所有乘积相加得到十进制值。
Decimal = b₇×2⁷ + b₆×2⁶ + b₅×2⁵ + b₄×2⁴ + b₃×2³ + b₂×2² + b₁×2¹ + b₀×2⁰
Example: Convert 1011₂ to decimal.
示例:将 1011₂ 转换为十进制。
1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11.
1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11。
2. Decimal to Binary Conversion | 十进制转二进制
Divide the decimal number by 2 repeatedly, keeping track of the remainders. The binary number is formed by reading the remainders from the last remainder obtained (most significant bit) to the first (least significant bit).
将十进制数反复除以 2,记录每次的余数。从最后得到的余数(最高位)开始,到第一个余数(最低位)为止,依次读出即得二进制数。
Example: Convert 13 to binary. 13 ÷ 2 = 6 remainder 1; 6 ÷ 2 = 3 remainder 0; 3 ÷ 2 = 1 remainder 1; 1 ÷ 2 = 0 remainder 1. Reading upwards: 1101₂.
示例:13 转二进制。13 ÷ 2 = 6 余 1;6 ÷ 2 = 3 余 0;3 ÷ 2 = 1 余 1;1 ÷ 2 = 0 余 1。从下往上读:1101₂。
3. Binary Addition Rules | 二进制加法规则
Binary addition follows these rules: 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, 1 + 1 = 0 with a carry of 1 to the next column, and 1 + 1 + 1 = 1 with a carry of 1.
二进制加法规则:0+0=0, 0+1=1, 1+0=1, 1+1=0 并向高位进 1, 1+1+1=1 并向高位进 1。
Overflow occurs when the result of an addition exceeds the maximum value that can be stored in the available number of bits.
当加法结果超出可用位数能表示的最大值时,会产生溢出。
4. Hexadecimal Basics | 十六进制基础
Hexadecimal (base‑16) uses digits 0‑9 and letters A‑F, where A=10, B=11, C=12, D=13, E=14, F=15. Each hex digit represents exactly 4 bits (a nibble), making it a compact way to write binary.
十六进制采用基数为 16,使用数字 0‑9 和字母 A‑F,其中 A=10, B=11, C=12, D=13, E=14, F=15。每个十六进制位恰好代表 4 个二进制位(半字节),因此是二进制的一种简洁书写方式。
To convert binary to hex, group bits into sets of four from the right, then convert each group. Example: 1101 0011₂ → D3₁₆ (13 3).
将二进制转十六进制,从右往左每 4 位分组,再逐组转换。示例:1101 0011₂ → D3₁₆ (13 3)。
5. Logic Gate Truth Tables | 逻辑门真值表
Logic gates are the building blocks of digital circuits. The primary gates are NOT, AND, and OR.
逻辑门是数字电路的构建块,基本门包括非门(NOT)、与门(AND)和或门(OR)。
| Gate | Symbol | Truth Table |
|---|---|---|
| NOT | A’ or ¬A | Input A=0 → Output 1; A=1 → Output 0 |
| AND | A · B | 0·0=0, 0·1=0, 1·0=0, 1·1=1 |
| OR | A + B | 0+0=0, 0+1=1, 1+0=1, 1+1=1 |
Composite gates like NAND, NOR, and XOR can be built from these basic gates. XOR outputs 1 only when inputs differ.
基本门可组合出复合门,如与非(NAND)、或非(NOR)和异或(XOR)。XOR 仅在输入不同时输出 1。
6. Boolean Algebra Laws | 布尔代数定律
Boolean algebra governs the manipulation of logical expressions. The following laws help simplify circuits and conditions.
布尔代数支配逻辑表达式的运算。下列定律有助于简化电路和条件判断。
Identity: A + 0 = A, A · 1 = A
Annihilation: A + 1 = 1, A · 0 = 0
Idempotent: A + A = A, A · A = A
Complement: A + A’ = 1, A · A’ = 0
Involution: (A’)’ = A
恒等律:A + 0 = A, A · 1 = A
湮灭律:A + 1 = 1, A · 0 = 0
幂等律:A + A = A, A · A = A
互补律:A + A’ = 1, A · A’ = 0
对合律:(A’)’ = 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)
交换律:A + B = B + A, A · B = B · A
结合律:A + (B + C) = (A + B) + C, A · (B · C) = (A · B) · C
分配律: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 Theorems: (A · B)’ = A’ + B’, (A + B)’ = A’ · B’
吸收律:A + A·B = A, A · (A + B) = A
德摩根定理:(A · B)’ = A’ + B’, (A + B)’ = A’ · B’
7. Data Unit Conversion | 数据单位换算
All digital data is measured in bits. Standard unit relationships are based on powers of 2. The common hierarchy is:
所有数字数据以位(bit)为单位。标准单位间的关系基于 2 的幂。常见层级如下:
1 byte = 8 bits
1 KB (kilobyte) = 1024 bytes
1 MB (megabyte) = 1024 KB
1 GB (gigabyte) = 1024 MB
1 TB (terabyte) = 1024 GB
To convert a larger unit to a smaller unit, multiply; to convert smaller to larger, divide by 1024 at each step.
大单位换算成小单位用乘法;小单位换算成大单位,每级除以 1024。
8. Image File Size Calculation | 图像文件大小计算
The file size of a bitmap image depends on its resolution (width × height in pixels) and colour depth (bits per pixel). The formula in bits is:
位图图像的文件大小取决于分辨率(宽度×高度,以像素计)和色深(每像素位数)。以位为单位的公式为:
File size (bits) = width × height × colour depth
To express the size in bytes, divide by 8.
要转换成以字节为单位,除以 8。
Example: A 200×100 image with a colour depth of 24 bits: 200 × 100 × 24 = 480,000 bits = 60,000 bytes ≈ 58.6 KB.
示例:一幅 200×100 像素、24 位色深的图像:200 × 100 × 24 = 480,000 位 = 60,000 字节 ≈ 58.6 KB。
9. Sound File Size Calculation | 声音文件大小计算
Digital sound quality is determined by sample rate, bit depth, and number of channels. The file size for uncompressed audio is calculated as:
数字音频的质量由采样率、位深度和声道数决定。未压缩音频的文件大小计算公式为:
File size (bits) = sample rate (Hz) × bit depth × channels × duration (seconds)
Convert to bytes by dividing by 8.
转换为字节再除以 8。
Example: CD-quality stereo (44,100 Hz, 16-bit, 2 channels) for 10 seconds: 44,100 × 16 × 2 × 10 = 14,112,000 bits = 1,764,000 bytes ≈ 1.68 MB.
示例:CD 品质立体声(44,100 Hz、16 位、双声道)录制 10 秒:44,100 × 16 × 2 × 10 = 14,112,000 位 = 1,764,000 字节 ≈ 1.68 MB。
10. Compression Ratio | 压缩比
Compression reduces file size. The compression ratio indicates how much smaller the compressed file is compared to the original.
压缩可减小文件体积。压缩比表示压缩后文件相较于原始文件缩小的程度。
Compression Ratio = Original file size / Compressed file size
A higher ratio means greater compression. For example, a ratio of 4:1 means the original is four times larger.
比值越高表示压缩程度越大。例如,压缩比为 4:1 意味着原文件大小是压缩后的四倍。
11. Algorithm Complexity Overview | 算法复杂度概览
Algorithm efficiency is often measured by the number of comparisons or swaps required as the input size (n) grows. Here are key formulas for common algorithms.
算法效率常以输入规模 (n) 增长时所需的比较或交换次数来衡量。以下为常见算法的核心公式。
Linear Search: worst case = n comparisons; average ≈ n/2.
线性搜索:最坏情况 n 次比较;平均约 n/2 次。
Binary Search: worst case ≈ log₂(n) comparisons (requires sorted data).
二分搜索:最坏情况约 log₂(n) 次比较(需要数据有序)。
Bubble Sort:worst case = n(n‑1)/2 comparisons and swaps.
冒泡排序:最坏情况需 n(n‑1)/2 次比较和交换。
Insertion Sort: worst case = n(n‑1)/2 comparisons; best case (already sorted) ≈ n‑1.
插入排序:最坏情况 n(n‑1)/2 次比较;最好情况(已有序)约 n‑1 次。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导