📚 AS OCR Computer Science: Formula & Theorem Quick Reference | AS OCR 计算机:公式定理速查手册
This quick reference handbook compiles all essential formulas, laws, and theorems you need for the AS OCR Computer Science syllabus. From binary conversions and Boolean algebra to storage calculations and network latency, each section provides clear definitions and worked examples to support your revision.
本速查手册汇编了 AS OCR 计算机科学课程所需的所有基本公式、定律与定理。从进制转换和布尔代数到存储计算与网络延迟,每个部分都提供清晰的定义和示例,帮助你高效复习。
1. Number Systems & Conversion | 数字系统与数制转换
Any number can be expressed in base-B using positional weighting: the value is the sum of each digit multiplied by B raised to the power of its position. For binary (base 2), hex (base 16) and decimal (base 10) the same principle applies.
任何数都可以按位权展开为基数为 B 的多项式之和。对二进制、十六进制和十进制而言,数值就是每一位数字乘以基数的对应幂次再求和。
Decimal = Σ (dₖ × 10ᵏ) Binary = Σ (bₖ × 2ᵏ) Hex = Σ (hₖ × 16ᵏ)
To convert binary to decimal, multiply each bit by 2 to the power of its weight (starting at 0 on the right). Example: 1101₂ = 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 13₁₀.
将二进制转为十进制时,每一位乘以2的位权次幂(最右为0)。例如:1101₂ = 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 13₁₀。
Binary-to-hex conversion groups bits in fours from the right, then substitutes each group with its hex equivalent. Hex-to-binary replaces each hex digit with its 4-bit pattern.
二进制与十六进制互转时,从右开始每4位为一组对应一个十六进制数字;反过来,每个十六进制数字直接用4位二进制替换。
2. Binary Arithmetic & Two’s Complement | 二进制算术与补码
Two’s complement is the standard way to represent signed integers in binary. For an n-bit word, the most significant bit acts as the sign bit, and the range of representable values is:
补码是有符号整数的标准二进制表示法。在 n 位字长中,最高位是符号位,可表示的范围为:
-2ⁿ⁻¹ ≤ value ≤ 2ⁿ⁻¹ – 1
To obtain the two’s complement negation of a number, invert all bits and add 1. Overflow occurs when two numbers with the same sign produce a result with the opposite sign; this cannot be ignored in fixed-width arithmetic.
对一个数求补码相反数的方法是将所有位取反后加1。当两个同符号数相加却产生相反符号的结果时,就发生了溢出;在定宽算术中这不可忽略。
Example: for 8 bits, +3 is 0000 0011, -3 is 1111 1101. Adding 3 + (-3) gives (1)0000 0000, the carry beyond the 8th bit is discarded, correctly yielding 0.
例如在8位下,+3 为 0000 0011,-3 为 1111 1101。两者相加得 (1)0000 0000,第9位进位被丢弃,结果为0。
3. Floating-Point & Normalisation | 浮点数与归一化
A binary floating-point number is stored as a mantissa (the significant digits) and an exponent (the scale). The value is: mantissa × 2exponent. To maximise precision, the mantissa is normalised so that its absolute value lies in the range [0.5, 1) – in binary this means the mantissa always begins with 0.1₂ (for positive numbers) or 1.0₂ (for negative numbers in two’s complement).
二进制浮点数存储为尾数(有效数字)和指数(缩放因子)。其值为尾数 × 2指数。为使精度最大化,尾数需归一化,使其绝对值介于 [0.5, 1),即正尾数的最高两位为 0.1₂,负尾数(补码)则以 1.0₂ 开头。
Normalised positive mantissa: 0.1…₂ Normalised negative mantissa: 1.0…₂
When converting a binary floating-point representation back to denary, align the binary point according to the exponent (move it right if exponent > 0, left if < 0), then convert the resulting fixed-point value using place values.
将浮点数转换回十进制时,先根据指数移动小数点(正指数右移,负指数左移),然后将得到的定点数按位权展开求值。
4. Boolean Algebra Laws & Theorems | 布尔代数定律与定理
Boolean algebra forms the basis of logic circuits and expression simplification. Below is a summary of the principal laws, where A, B, C are Boolean variables, ‘+’ denotes OR, ‘·’ denotes AND, and ‘′’ denotes NOT.
布尔代数是逻辑电路和表达式化简的基础。下表列出了主要定律,其中 A, B, C 为布尔变量,’+’ 表示或,’·’ 表示与,’′’ 表示非。
| Law / 定律 | AND form / 与形式 | OR form / 或形式 |
|---|---|---|
| Identity / 恒等 | A·1 = A | A+0 = A |
| Null / 归零 | A·0 = 0 | A+1 = 1 |
| Idempotent / 幂等 | A·A = A | A+A = A |
| Complement / 互补 | A·A′ = 0 | A+A′ = 1 |
| Involution / 双重否定 | (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) |
| Absorption / 吸收 | A·(A+B) = A | A+(A·B) = A |
| De Morgan / 德摩根 | (A·B)′ = A′+B′ | (A+B)′ = A′·B′ |
The distributive and De Morgan laws are especially important for transforming and simplifying logic expressions. Always remember to use brackets correctly when applying De Morgan’s theorem to compound expressions.
分配律和德摩根定律对表达式变形与化简尤为关键。对复合表达式应用德摩根定律时,务必正确使用括号。
5. Karnaugh Map Simplification | 卡诺图化简
A Karnaugh map (K-map) provides a visual method for minimising Boolean expressions. Variables are arranged so that adjacent cells differ by only one bit. Groups of 1s of sizes 1, 2, 4, 8… are encircled; each group yields a product term where variables that change within the group are eliminated.
卡诺图为化简布尔表达式提供了一种图形化方法。变量排列使得相邻单元格只有一位不同。将大小 1、2、4、8 … 的 1 圈成组;每个组产出一个乘积项,在组内发生变化的变量被消去。
Sum-of-products: each group → AND of literals, all groups → OR of these terms.
与或式:每个组 → 若干文字的与,所有组 → 这些项的或。
For example, a 2-variable map with 1s at positions corresponding to A’B’+A’B simplifies to A’ (since B changes). The goal is to cover all 1s with the fewest and largest possible groups, including ‘don’t care’ conditions if allowed.
例如,在2变量卡诺图中,对应 A’B’ + A’B 的位置均为1,则可化简为 A’(因为 B 变化)。目标是用最少、最大的组覆盖所有1,必要时可以利用无关项。
6. Data Units & Storage Calculations | 数据单位与存储计算
Digital storage and file sizes are measured in bits and bytes. The fundamental relationship and the common binary prefixes are:
数字存储和文件大小以比特和字节为单位。基本关系和常用二进制前缀如下:
1 byte = 8 bits 1 KB = 2¹⁰ bytes = 1024 B 1 MB = 2²⁰ B 1 GB = 2³⁰ B
To estimate the size of a data structure, multiply the number of records by the storage needed per record. For raw texts, size = number
Published by TutorHao | AS Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导