📚 IGCSE WJEC Computer Science: Formula Summary Handbook | IGCSE WJEC 计算机:公式汇总手册
This handbook compiles essential formulas, unit conversions, and calculation methods you need for the WJEC IGCSE Computer Science examination. Each section presents a key concept with paired English and Chinese explanations, followed by the relevant equations. Use this reference to reinforce your understanding of data representation, file size estimation, logic, algorithms, and data transmission.
本手册汇总了WJEC IGCSE 计算机科学考试所必需的核心公式、单位转换及计算方法。每个部分以一个关键概念起头,提供配对的英文与中文解释,随后给出相关方程式。利用这份参考资料,巩固你对数据表示、文件大小估算、逻辑、算法以及数据传输的理解。
1. Data Storage Units | 数据存储单位
Understanding the hierarchy of data storage units is fundamental. In WJEC, memory capacity often uses binary definitions (powers of 2), whereas file sizes and transfer rates typically use decimal definitions (powers of 10). The smallest unit is a bit (b), and eight bits make a byte (B).
理解数据存储单位的层级关系是基础。在WJEC 考试中,内存容量常使用二进制定义(2的幂),而文件大小和传输速率通常使用十进制定义(10的幂)。最小单位是比特(b),8个比特构成一个字节(B)。
1 byte (B) = 8 bits (b)
For memory (binary):
内存容量(二进制):
1 KiB = 1024 B
1 MiB = 1024 KiB
1 GiB = 1024 MiB
1 TiB = 1024 GiB
For file size and transmission (decimal):
文件大小与传输(十进制):
1 kB = 1000 B
1 MB = 1000 kB
1 GB = 1000 MB
1 TB = 1000 GB
Always read the question carefully to determine which definition is being used, and remember to convert all units to the same scale before calculating.
答题时务必仔细审题,判断题目使用的是哪一种定义,并在计算前将所有单位统一到同一量级。
2. Binary and Denary Conversions | 二进制与十进制转换
A denary (decimal) number can be converted to binary by repeatedly dividing by 2 and recording the remainders, or by using the place-value method. Conversely, a binary number is converted to denary by summing the place values of each ‘1’ bit.
十进制数可以通过反复除以2并记录余数来转换为二进制,或者使用位值法。反过来,二进制数转换为十进制则通过将每一个值为“1”的位所对应的位值相加。
Denary to Binary: Read remainders from bottom to top
Example: 13 in denary → 1101₂
例子:十进制 13 → 1101₂
Binary to Denary: Sum of (digit × 2ⁿ) for n = 0,1,2,…
For an 8‑bit binary number b₇b₆b₅b₄b₃b₂b₁b₀, the denary value is:
对于一个8位二进制数 b₇b₆b₅b₄b₃b₂b₁b₀,其十进制值为:
Value = b₇×2⁷ + b₆×2⁶ + … + b₀×2⁰
You must be comfortable with powers of two up to 2⁷ (128) for 8‑bit numbers and up to 2¹⁵ for 16‑bit conversions.
你必须熟悉2的幂次,对于8位数字要掌握到2⁷(128),对于16位转换则需掌握到2¹⁵。
3. Hexadecimal Conversions | 十六进制转换
Hexadecimal (base‑16) uses digits 0–9 and letters A–F to represent values 10–15. It provides a compact way to represent binary groups of four bits. Each hex digit corresponds exactly to a 4‑bit binary nibble.
十六进制(基数为16)使用数字0–9和字母A–F 来表示10–15。它提供了一种紧凑的方式来表示每四个二进制位组成的组。每个十六进制数字正好对应一个4位二进制半字节。
Denary → Hex: Repeated division by 16
Binary → Hex: Group binary digits in fours from right; convert each group
Hex → Denary: Sum of (digit × 16ⁿ)
For example, 1011 1110₂ becomes BE₁₆. The hex digit B represents 11, and E represents 14. Thus the denary value is 11×16 + 14 = 190.
例如,1011 1110₂ 变成 BE₁₆。十六进制数字B代表11,E代表14。因此其十进制值为 11×16 + 14 = 190。
4. Binary Arithmetic & Overflow | 二进制运算与溢出
Binary addition follows the same rules as denary addition, with a carry into the next column when the sum of two bits equals or exceeds 2. When using a fixed number of bits, an overflow occurs if the result requires an extra bit beyond the allocated width.
二进制加法遵循与十进制加法相同的规则,当两个比特之和等于或超过2时会产生进位。当使用固定的位数时,如果结果需要的位数超出分配的宽度,就会发生溢出。
0 + 0 = 0 (carry 0)
0 + 1 = 1 (carry 0)
1 + 0 = 1 (carry 0)
1 + 1 = 0 (carry 1)
1 + 1 + 1 = 1 (carry 1)
Overflow rule for two 8‑bit unsigned numbers:
两个8位无符号数的溢出规则:
Overflow occurs if there is a carry out of the most significant bit (bit 7)
In signed two’s complement arithmetic, overflow is detected when the carry into the sign bit differs from the carry out of the sign bit. A simple check: adding two positive numbers should yield a positive result; if it yields a negative result, an overflow has occurred.
在有符号二进制补码运算中,当进入符号位的进位与离开符号位的进位不同时,就检测到溢出。一个简单的检验:两个正数相加应得到正数;若得到负数,则发生了溢出。
5. Logical Operators & Truth Tables | 逻辑运算符与真值表
Boolean logic is used to design digital circuits and write conditions in programs. The fundamental operators are AND, OR, NOT, and XOR. Their behaviour is completely defined by truth tables.
布尔逻辑用于设计数字电路和编写程序条件。基本运算符有AND、OR、NOT和XOR。它们的行为完全由真值表定义。
AND gate (A ∧ B): output is 1 only if both inputs are 1.
AND门(A ∧ B):仅当两个输入都为1时,输出才为1。
0 AND 0 = 0
0 AND 1 = 0
1 AND 0 = 0
1 AND 1 = 1
OR gate (A ∨ B): output is 1 if at least one input is 1.
OR门(A ∨ B):如果至少有一个输入为1,则输出为1。
0 OR 0 = 0
0 OR 1 = 1
1 OR 0 = 1
1 OR 1 = 1
NOT gate (¬A): inverts the input.
NOT门(¬A):将输入取反。
NOT 0 = 1
NOT 1 = 0
XOR gate (A ⊕ B): output is 1 when inputs differ.
XOR门(A ⊕ B):当输入不同时输出为1。
0 XOR 0 = 0
0 XOR 1 = 1
1 XOR 0 = 1
1 XOR 1 = 0
De Morgan’s laws are useful for simplifying logic expressions:
德摩根定律对化简逻辑表达式很有用:
¬(A ∧ B) = ¬A ∨ ¬B
¬(A ∨ B) = ¬A ∧ ¬B
Apply these when transforming circuits or evaluating compound conditions.
在转换电路或计算复合条件时,可使用这些定律。
6. Image File Size Calculation | 图像文件大小计算
Digital images are made up of pixels. The storage size of an uncompressed bitmap image depends on the image resolution and the colour depth. Colour depth is the number of bits used to represent the colour of each pixel.
数字图像由像素组成。未压缩的位图图像的存储大小取决于图像分辨率和颜色深度。颜色深度是用于表示每个像素颜色的比特数。
Image file size (bits) = Width (pixels) × Height (pixels) × Colour depth (bits per pixel)
To find the file size in bytes, divide by 8:
要得到以字节为单位的大小,除以8:
File size (bytes) = (Width × Height × Colour depth) / 8
Example: a 200×100 pixel image with a 24‑bit colour depth (true colour) requires:
例子:一幅200×100像素、24位颜色深度(真彩色)的图像需要:
200 × 100 × 24 = 480,000 bits = 60,000 bytes ≈ 60 kB
Remember that higher resolution and higher colour depth produce better quality but larger file sizes. Metadata (e.g. width, height, date) also adds a small overhead, but it is often ignored in exam calculations.
请记住,分辨率越高、颜色深度越高,画质越好但文件也越大。元数据(例如宽度、高度、日期)也会增加少量额外开销,但在考试计算中通常忽略不计。
7. Sound File Size Calculation | 声音文件大小计算
Sound is stored digitally by sampling the analogue waveform at regular intervals. The file size of an uncompressed audio clip depends on the sample rate, sample resolution (bit depth), duration, and number of channels.
声音通过以固定间隔对模拟波形进行采样来实现数字化存储。未压缩的音频片段文件大小取决于采样率、采样分辨率(比特深度)、时长和声道数。
Sound file size (bits) = Sample rate (Hz) × Sample resolution (bits) × Duration (s) × Number of channels
For a stereo (2‑channel) track of 10 seconds, sampled at 44.1 kHz with 16‑bit resolution:
对于一条立体声(2声道)、时长10秒、采样率44.1 kHz、16位分辨率的音轨:
File size = 44,100 × 16 × 10 × 2 = 14,112,000 bits = 1,764,000 bytes ≈ 1.76 MB
Note: 1 kHz = 1000 Hz, and always convert the sample rate to hertz before multiplying. Higher sample rate and bit depth yield greater fidelity but larger files.
注意:1 kHz = 1000 Hz,在计算前务必把采样率换算为赫兹。采样率和比特深度越高,保真度越高,但文件也越大。
8. Text File Size & Compression | 文本文件大小与压缩
A plain text file stores each character as a binary code. The number of bits per character depends on the character set: ASCII uses 7 or 8 bits, while Unicode can use 8, 16, or 32 bits per character.
纯文本文件将每个字符存储为二进制编码。每个字符的比特数取决于字符集:ASCII使用7或8位,而Unicode可以使用8、16或32位。
Text file size (bits) = Number of characters × Bits per character
For example, a document containing 5000 characters encoded in 8‑bit extended ASCII has a size of 5000 × 8 = 40,000 bits = 5000 bytes.
例如,一份包含5000个字符、采用8位扩展ASCII编码的文档,其大小为5000 × 8 = 40,000 bits = 5000 bytes。
Data can be compressed to reduce file size. Compression ratio is used to measure how much a file has been reduced:
数据可以被压缩以减小文件体积。压缩比用于衡量文件被缩减的程度:
Compression ratio = Original size / Compressed size
Space saving can be expressed as:
空间节省量可以用百分比表示:
Saving (%) = [(Original size − Compressed size) / Original size] × 100
Both lossless and lossy compression techniques are examined; the formulas apply regardless of the method as long as you know the final sizes.
无论采用无损压缩还是有损压缩,只要你掌握了原始和压缩后的大小,上述公式均适用。
9. Data Transfer Time | 数据传输时间
When files are sent over a network, the time taken depends on the file size and the data transfer rate (bandwidth). Always ensure that file size and transfer rate are expressed in the same unit: either both in bits or both in bytes.
通过网络传输文件时,所需时间取决于文件大小和数据传输速率(带宽)。务必确保文件大小和传输速率的单位一致:要么都使用比特,要么都使用字节。
Time (seconds) = File size / Transfer rate
Common conversions:
常见换算:
1 bps (bit per second)
1 kbps = 1000 bps
1 Mbps = 1000 kbps = 1,000,000 bps
Example: A 10 MB file is to be downloaded over an 8 Mbps connection. Convert file size to bits: 10 × 1000 × 1000 × 8 = 80,000,000 bits. Transfer rate = 8,000,000 bits per second. Time = 80,000,000 / 8,000,000 = 10 seconds.
例子:要通过8 Mbps的连接下载一个10 MB的文件。先将文件大小转换为比特:10 × 1000 × 1000 × 8 = 80,000,000 比特。传输速率 = 8,000,000 比特每秒。时间 = 80,000,000 / 8,000,000 = 10 秒。
If you prefer working in bytes, 10 MB / (8 Mbps / 8) = 10 MB / 1 MBps = 10 seconds. The key is to keep units consistent.
如果你更习惯用字节,10 MB / (8 Mbps / 8) = 10 MB / 1 MBps = 10 秒。关键在于保持单位一致。
10. Error Detection: Parity & Checksum | 错误检测:奇偶校验与校验和
Parity bits and checksums are simple methods to detect errors during data transmission. A parity bit can be set to make the total number of 1‑bits either even (even parity) or odd (odd parity).
奇偶校验位和校验和是在数据传输中检测错误的简单方法。奇偶校验位可被设置为使“1”比特的总数为偶数(偶校验)或奇数(奇校验)。
Even parity: Total count of 1s (including parity bit) must be even.
Odd parity: Total count of 1s (including parity bit) must be odd.
For the byte 1011000₁ (four 1‑bits), an even parity bit would be 0 (count stays 4, even); an odd parity bit would be 1 (count becomes 5, odd).
对于字节 1011000₁(四个1比特),偶校验位应为0(总数保持4,偶数);奇校验位应为1(总数变为5,奇数)。
A checksum is calculated by adding all the data bytes together, discarding any overflow, and attaching the result to the data. The receiver repeats the sum; if the two sums match, the data is assumed correct.
校验和的计算方法是将所有数据字节相加,丢弃任何溢出,并将结果附加到数据中。接收方重复求和;若两个和一致,则认为数据无误。
Checksum = Sum of data bytes (mod 256) for 8‑bit checksum
Though parity and checksums cannot correct errors, they play a vital role in identifying corrupted data so that a retransmission can be requested.
尽管奇偶校验和校验和不能纠正错误,但它们在识别损坏数据以便请求重传方面起着关键作用。
11. Algorithm Efficiency: Search Comparisons | 算法效率:搜索比较次数
When analysing search algorithms, the number of comparisons needed to find a target item determines the efficiency. For a linear search on an unsorted list of n items:
在分析搜索算法时,找到目标项所需的比较次数决定了效率。对于含n个项的未排序列表进行线性搜索:
Maximum comparisons = n (item is last or not found)
Average comparisons ≈ n/2
For a binary search on a sorted list, the number of comparisons grows logarithmically:
对于已排序列表的二分搜索,比较次数呈对数增长:
Maximum comparisons ≈ log₂(n)
Example: Searching for a value among 1000 sorted items using binary search requires at most about log₂(1000) ≈ 10 comparisons. This is the reason binary search is far more efficient for large datasets.
例子:在1000个已排序项中查找一个值,使用二分搜索最多需要约 log₂(1000) ≈ 10 次比较。这就是为什么对于大数据集,二分搜索的效率要高得多。
While WJEC does not require big‑O notation, you must be able to estimate the maximum number of steps for a given list size and describe why one algorithm is preferable in a scenario.
虽然WJEC不要求使用大O符号,但你必须能够估算给定列表规模下的最大步数,并描述在特定场景下为何某种算法更优。
12. Storage Capacity of Devices | 设备存储容量
Calculating how many files a storage device can hold is a straightforward application of unit conversion and division. It often comes up in exam questions about secondary storage devices like hard drives, USB sticks, and optical discs.
计算一个存储设备能容纳多少个文件,是单位转换和除法运算的直接应用。这类问题在关于硬盘、U盘和光盘等辅助存储设备的考试题目中很常见。
Number of files = Total device capacity / Size of one file
Ensure both capacities are in the same unit (bytes or bits) before dividing. For example, a 32 GB USB flash drive (using decimal GB) stores music tracks of 5 MB each:
在相除之前,要确保两个容量单位一致(同为字节或比特)。例如,一个32 GB的U盘(使用十进制GB)用来存放每首5 MB的音乐文件:
Number of tracks = (32 × 1000 MB) / 5 MB = 6400 tracks
If a question mixes binary and decimal units, convert to a consistent standard as instructed. Always show your working and keep whole‑number results when calculating a count of files.
如果题目混合了二进制和十进制单位,按照说明统一为一致的标准。计算文件数量时,务必展示运算过程,并保留整数结果。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply