Year 8 CCEA Computer Science: Quick Reference Handbook of Formulas and Theorems | Year 8 CCEA 计算机:公式定理速查手册

📚 Year 8 CCEA Computer Science: Quick Reference Handbook of Formulas and Theorems | Year 8 CCEA 计算机:公式定理速查手册

This handbook is your essential companion for Year 8 CCEA Computer Science. It distils the key formulas, conversion rules, and logical theorems you need for quick revision. Use it to sharpen your problem-solving skills, prepare for assessments, and build a solid foundation in computing concepts.

这本手册是你学习 Year 8 CCEA 计算机课程的重要助手。它提炼了你需要快速复习的关键公式、转换规则和逻辑定理。用它来提升你的问题解决能力,为评估做好准备,并在计算概念方面打下坚实的基础。


1. Storage Unit Conversion Formulas | 存储单位换算公式

A bit is the smallest unit of data, storing a single 0 or 1. A byte consists of 8 bits. Larger units are based on powers of 2, because computers use binary. The most common conversions are: 1 kilobyte (KB) = 2¹⁰ bytes = 1024 bytes; 1 megabyte (MB) = 2²⁰ bytes = 1,048,576 bytes; 1 gigabyte (GB) = 2³⁰ bytes; 1 terabyte (TB) = 2⁴⁰ bytes. For quick estimation, you can also use the rule: to convert from a larger unit to a smaller unit, multiply by 1024; to convert from smaller to larger, divide by 1024.

比特(位)是最小的数据单位,存储一个 0 或 1。一个字节由 8 个比特组成。更大的单位基于 2 的幂,因为计算机使用二进制。最常见的换算是:1 千字节 (KB) = 2¹⁰ 字节 = 1024 字节;1 兆字节 (MB) = 2²⁰ 字节 = 1,048,576 字节;1 吉字节 (GB) = 2³⁰ 字节;1 太字节 (TB) = 2⁴⁰ 字节。为了快速估算,你也可以使用规则:从较大单位转换到较小单位,乘以 1024;从较小单位转换到较大单位,除以 1024。

Example: To convert 5 MB to KB, multiply 5 × 1024 = 5120 KB. To convert 2048 MB to GB, divide 2048 ÷ 1024 = 2 GB.

示例:将 5 MB 转换为 KB,5 × 1024 = 5120 KB。将 2048 MB 转换为 GB,2048 ÷ 1024 = 2 GB。


2. Binary to Denary Conversion | 二进制转十进制

In a binary number, each digit (bit) has a place value that is a power of 2, starting from 2⁰ on the right. To convert a binary number to denary, write out the place values above each bit, then add the values where the bit is 1. For an 8-bit binary number, the place values are: 128, 64, 32, 16, 8, 4, 2, 1.

在二进制数中,每一位(比特)都有一个以 2 为底的位值,从最右边的 2⁰ 开始。要将二进制数转换为十进制,在每一位上方写出位值,然后将比特为 1 的对应位值相加。对于 8 位二进制数,位值依次为:128, 64, 32, 16, 8, 4, 2, 1。

Formula: Denary value = ∑ (bit × 2^position), where position 0 is the rightmost bit.

公式:十进制值 = ∑ (比特 × 2^位置),其中位置 0 为最右侧比特。

Example: Binary 01001101 = 0×128 + 1×64 + 0×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1 = 64 + 8 + 4 + 1 = 77.

示例:二进制 01001101 = 0×128 + 1×64 + 0×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1 = 64 + 8 + 4 + 1 = 77。


3. Denary to Binary Conversion | 十进制转二进制

The standard method is successive division by 2. Divide the denary number by 2; record the remainder (0 or 1) as the least significant bit. Continue dividing the quotient by 2 until the quotient is 0, recording each remainder. The binary number is the remainders read from bottom to top.

标准方法是连续除以 2。将十进制数除以 2;记录余数(0 或 1)作为最低有效位。继续将商除以 2,直到商为 0,记录每一个余数。从下往上读取余数,就是二进制数。

Algorithm: While n > 0: remainder = n mod 2; record remainder; n = n div 2 (integer division).

算法:当 n > 0 时:余数 = n 除以 2 的余数;记录余数;n = n 整除 2。

Example: Convert 77 to binary. 77 ÷ 2 = 38 remainder 1; 38 ÷ 2 = 19 remainder 0; 19 ÷ 2 = 9 remainder 1; 9 ÷ 2 = 4 remainder 1; 4 ÷ 2 = 2 remainder 0; 2 ÷ 2 = 1 remainder 0; 1 ÷ 2 = 0 remainder 1. Reading remainders upwards gives 1001101, which is 01001101 in 8-bit form.

示例:将 77 转换为二进制。77 ÷ 2 = 38 余 1;38 ÷ 2 = 19 余 0;19 ÷ 2 = 9 余 1;9 ÷ 2 = 4 余 1;4 ÷ 2 = 2 余 0;2 ÷ 2 = 1 余 0;1 ÷ 2 = 0 余 1。从下往上读余数得到 1001101,即 8 位形式 01001101。


4. Binary Addition Rules | 二进制加法规则

Binary addition works just like denary addition, but with only two digits. The four basic rules are: 0 + 0 = 0; 0 + 1 = 1; 1 + 0 = 1; 1 + 1 = 0, carry 1 to the next left column. If there is a carry from the previous column, you must add it as well. When 1 + 1 + 1 occurs, the sum is 1 with a carry of 1.

二进制加法与十进制加法类似,但只有两个数字。四条基本规则是:0 + 0 = 0;0 + 1 = 1;1 + 0 = 1;1 + 1 = 0,并向左边一列进 1。如果前一列有进位,也必须加上。当出现 1 + 1 + 1 时,和为 1 且进位为 1。

Example: Add 0110 (6) and 0101 (5). Column by column from right: 0+1=1; 1+0=1; 1+1=0 carry 1; carry 1 + 0 + 0 = 1. Result: 1011 (11). Always check that the result does not exceed the bit width; an overflow occurs if the answer needs an extra bit.

示例:将 0110 (6) 和 0101 (5) 相加。从右向左逐列:0+1=1;1+0=1;1+1=0 进 1;进位 1 + 0 + 0 = 1。结果:1011 (11)。始终检查结果是否超出位宽;如果答案需要额外的比特,则发生溢出。


5. Boolean Logic: AND, OR, NOT | 布尔逻辑:与、或、非

Boolean logic uses TRUE (1) and FALSE (0). The three fundamental operations are AND, OR, and NOT. The AND gate gives output 1 only when all inputs are 1. The OR gate gives output 1 when at least one input is 1. The NOT gate is a unary operator that flips the input: NOT 1 = 0, NOT 0 = 1.

布尔逻辑使用真 (1) 和假 (0)。三种基本运算是与 (AND)、或 (OR) 和非 (NOT)。与门仅在所有输入都为 1 时输出 1。或门在至少一个输入为 1 时输出 1。非门是一元运算符,反转输入:非 1 = 0,非 0 = 1。

Equivalently, Boolean expressions can be written using symbols: A AND B = A · B; A OR B = A + B; NOT A = Ā or A’.

等效地,布尔表达式可以用符号表示:A AND B = A · B;A OR B = A + B;NOT A = Ā 或 A’。


6. Truth Table Patterns | 真值表模式

A truth table lists all possible input combinations and the resulting output for a logic circuit. For two inputs A and B, there are 2² = 4 rows. The AND truth table is: 0·0=0, 0·1=0, 1·0=0, 1·1=1. The OR truth table is: 0+0=0, 0+1=1, 1+0=1, 1+1=1. The NOT gate simply inverts the single input.

真值表列出所有可能的输入组合以及逻辑电路的输出。对于两个输入 A 和 B,共有 2² = 4 行。与门真值表为:0·0=0, 0·1=0, 1·0=0, 1·1=1。或门真值表为:0+0=0, 0+1=1, 1+0=1, 1+1=1。非门则直接将单个输入取反。

A B A AND B A OR B
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 1

A useful memory aid: AND is like multiplication (1 only if all inputs are 1); OR is like addition (0 only if all inputs are 0).

一个有用的助记法:与门类似乘法(仅在所有输入为 1 时输出 1);或门类似加法(仅在所有输入为 0 时输出 0)。


7. Data Size Calculations: Text, Image, Sound | 数据大小计算:文本、图像、声音

Understanding how to estimate file sizes is essential. For plain text, each character is usually stored using 1 byte in ASCII or extended ASCII. So, text file size in bytes ≈ number of characters. For Unicode encodings like UTF-8, characters may take 1 to 4 bytes, but for basic Latin text it remains 1 byte per character.

懂得如何估算文件大小至关重要。对于纯文本,每个字符通常使用 ASCII 或扩展 ASCII 中的 1 个字节存储。因此,文本文件大小(字节)≈ 字符数。对于像 UTF-8 这样的 Unicode 编码,字符可能占用 1 到 4 个字节,但对于基本拉丁文本,仍然是每个字符 1 字节。

For bitmap images, file size = width in pixels × height in pixels × colour depth in bits. Colour depth is the number of bits used per pixel. For example, a 1024×768 image with 24-bit colour uses 1024 × 768 × 24 = 18,874,368 bits. Divide by 8 to get bytes: 2,359,296 bytes ≈ 2.25 MB.

对于位图图像,文件大小 = 像素宽度 × 像素高度 × 颜色深度(比特)。颜色深度是每个像素使用的比特数。例如,一张 1024×768、24 位色彩的图像使用 1024 × 768 × 24 = 18,874,368 比特。除以 8 得到字节数:2,359,296 字节 ≈ 2.25 MB。

For uncompressed sound, file size = sample rate (Hz) × bit depth × number of channels × duration in seconds. For instance, CD-quality audio: 44,100 samples per second × 16 bits × 2 channels × 1 second = 1,411,200 bits = 176,400 bytes ≈ 0.168 MB per second.

对于未压缩的声音,文件大小 = 采样率 (Hz) × 位深度 × 声道数 × 时长(秒)。例如,CD 品质音频:每秒 44,100 次采样 × 16 位 × 2 声道 × 1 秒 = 1,411,200 比特 = 176,400 字节 ≈ 每秒 0.168 MB。


8. Compression Ratio | 压缩比

Compression reduces file size for storage or transmission. The compression ratio is defined as: Compression Ratio = Size of original file ÷ Size of compressed file. A higher ratio indicates greater compression. For example, if a 500 KB file is compressed to 100 KB, the ratio is 5:1. Sometimes it is expressed as a percentage saving: Saving % = [(original – compressed) / original] × 100%.

压缩可以减小文件体积,便于存储或传输。压缩比定义为:压缩比 = 原始文件大小 ÷ 压缩后文件大小。比值越高表示压缩程度越大。例如,若 500 KB 的文件被压缩到 100 KB,则压缩比为 5:1。有时也以节省百分比表示:节省百分比 = [(原始 – 压缩) / 原始] × 100%。

Lossless compression preserves all original data (e.g., ZIP, PNG); lossy compression discards some data permanently to achieve higher ratios (e.g., JPEG, MP3). The formulas remain the same, but you must consider the quality trade-off.

无损压缩保留所有原始数据(如 ZIP、PNG);有损压缩会永久丢弃部分数据以获得更高的压缩比(如 JPEG、MP3)。公式相同,但你必须考虑质量的权衡。


9. Sampling and Bit Depth (Sound) | 采样与位深度(声音)

Sound is analogue, so to store it digitally we take samples at regular intervals. The sample rate is the number of samples taken per second, measured in hertz (Hz). Common rates: 8,000 Hz (telephone), 44,100 Hz (CD), 48,000 Hz (DVD). Bit depth is the number of bits used to represent each sample. A higher bit depth gives a more accurate representation of the amplitude, reducing quantisation error.

声音是模拟的,因此要以数字方式存储,我们需要按固定间隔采样。采样率是每秒采集的样本数,单位为赫兹 (Hz)。常见速率:8,000 Hz(电话)、44,100 Hz(CD)、48,000 Hz(DVD)。位深度是用于表示每个样本的比特数。位深度越高,振幅表示越精确,量化误差越小。

Formula for number of possible amplitude levels: 2^(bit depth). For 16-bit audio, there are 2¹⁶ = 65,536 distinct levels. The file size formula, as seen earlier, combines these factors.

可能振幅等级数的公式:2^(位深度)。对于 16 位音频,共有 2¹⁶ = 65,536 个不同等级。如前所述,文件大小公式结合了这些因素。


10. Image Resolution and Colour Depth | 图像分辨率与颜色深度

Image resolution is the number of pixels in the image, often given as width × height (e.g., 1920 × 1080). The total number of pixels is the product of width and height. Colour depth, also called bit depth, determines how many colours each pixel can display. The number of colours = 2^(colour depth). For a 1-bit image, there are 2¹ = 2 colours (black and white); for 8-bit, 2⁸ = 256 colours; for 24-bit, 2²⁴ ≈ 16.7 million colours.

图像分辨率是图像中的像素数量,通常表示为 宽度 × 高度(例如 1920 × 1080)。像素总数是宽与高的乘积。颜色深度,也称为位深度,决定每个像素可以显示多少种颜色。颜色数 = 2^(颜色深度)。对于 1 位图像,有 2¹ = 2 种颜色(黑白);8 位则是 2⁸ = 256 种颜色;24 位则是 2²⁴ ≈ 1670 万种颜色。

To calculate total bits needed for the image data: Total bits = width (pixels) × height (pixels) × colour depth (bits). This does not include metadata or compression.

要计算图像数据所需的总比特数:总比特数 = 宽度 (像素) × 高度 (像素) × 颜色深度 (比特)。这不包括元数据或压缩。


11. Algorithm Efficiency: Linear vs Binary Search | 算法效率:线性搜索与二分搜索

A linear search checks each item in a list one by one until it finds the target or reaches the end. In the worst case, it examines all n items. The maximum number of comparisons is n. The average is about n/2. It works on any list, sorted or unsorted.

线性搜索逐个检查列表中的每一项,直到找到目标或到达末尾。在最坏情况下,它会检查所有 n 个项。最大比较次数为 n。平均次数约为 n/2。它适用于任何列表,无论是否排序。

A binary search works on a sorted list. It repeatedly divides the search interval in half. The maximum number of comparisons is approximately log₂ n. For example, for a list of 1,000 items, binary search needs at most about 10 comparisons (because 2¹⁰ = 1024), while linear search could need up to 1,000.

二分搜索用于有序列表。它反复将搜索区间一分为二。最大比较次数约为 log₂ n。例如,对于一个包含 1,000 个项的列表,二分搜索最多需要约 10 次比较(因为 2¹⁰ = 1024),而线性搜索可能需要多达 1,000 次。

General formula: Maximum comparisons ≈ ⌈log₂(n+1)⌉. This demonstrates why binary search is much faster on large sorted datasets.

一般公式:最大比较次数 ≈ ⌈log₂(n+1)⌉。这说明了为什么在大型有序数据集上二分搜索要快得多。


12. Flowchart Symbols | 流程图符号

Flowcharts use standard symbols to represent algorithms visually. The main symbols you need to know are: a rounded rectangle or oval for Start/Stop; a rectangle for a process or operation; a diamond for a decision (yes/no or true/false); a parallelogram for input/output. Arrows show the direction of flow. A circle or small connector can be used to join parts of a flowchart across pages.

流程图使用标准符号来直观地表示算法。你需要知道的主要符号有:圆角矩形或椭圆表示开始/结束;矩形表示一个处理或操作;菱形表示判断(是/否或真/假);平行四边形表示输入/输出。箭头指示流程的方向。小圆圈或连接符可用于跨页连接流程图的不同部分。

When counting the number of steps or evaluating an algorithm, each symbol normally counts as one instruction. Nested decisions can model complex conditions, but remember that a Boolean expression always evaluates to TRUE or FALSE.

在计算步骤数或评估算法时,每个符号通常算作一条指令。嵌套的判断可以模拟复杂条件,但要记住布尔表达式的结果始终为真 (TRUE) 或假 (FALSE)。


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课程辅导,国外大学本科硕士研究生博士课程论文辅导

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