📚 GCSE WJEC Computer Science: Formula Summary Handbook | GCSE WJEC 计算机:公式汇总手册
This handbook brings together all the essential formulas and calculations you need for the WJEC GCSE Computer Science exam. From file sizes and data transfer times to compression ratios and Boolean logic, each formula is explained clearly with worked examples to help you master the numeracy side of the subject.
本手册汇总了 WJEC GCSE 计算机科学考试中所有必备公式与计算。从文件大小、数据传输时间到压缩比和布尔逻辑,每个公式都配有清晰的解释和计算示例,帮助你掌握学科中的数学部分。
1. Storage Unit Conversion | 存储单位换算
The basic unit of digital data is the bit (b), which is a single binary digit (0 or 1). A byte (B) is 8 bits. Larger units are derived using powers of 2.
数字数据的基本单位是位 (bit, b),就是一个二进制数字 (0 或 1)。一个字节 (byte, B) 等于 8 位。更大的单位按 2 的幂次换算。
| Unit | Abbreviation | Equivalent in bytes |
|---|---|---|
| Kilobyte | KB | 1 KB = 2¹⁰ B = 1024 B |
| Megabyte | MB | 1 MB = 2²⁰ B = 1,048,576 B |
| Gigabyte | GB | 1 GB = 2³⁰ B ≈ 1.07 × 10⁹ B |
| Terabyte | TB | 1 TB = 2⁴⁰ B |
To convert from a larger unit to bytes, multiply by the corresponding power-of-two factor.
将较大单位转换为字节时,乘以相应的 2 的幂次因子即可。
2. Text File Size | 文本文件大小
The size of a text file depends on the number of characters and the encoding used. The formula is:
文本文件的大小取决于字符数量和所用编码方式。计算公式如下:
File size (bits) = Number of characters × Bits per character
For standard ASCII, each character is stored using 7 bits, but often an 8th bit is added for parity or extended characters, making it effectively 8 bits (1 byte) per character.
标准 ASCII 编码每个字符用 7 位 存储,但通常会加上第 8 位用作奇偶校验或扩展字符,因此实际上每个字符占 8 位 (1 字节)。
Example: A plain text file containing 2000 characters in ASCII uses approximately 2000 bytes (2000 × 8 = 16,000 bits).
示例:一个包含 2000 个 ASCII 字符的纯文本文件大约占用 2000 字节 (2000 × 8 = 16,000 位)。
3. Image File Size | 图像文件大小
Bitmap image size is determined by the image dimensions and colour depth (number of bits per pixel). The basic formula is:
位图图像的大小由图像尺寸和颜色深度 (每像素位数) 决定。基本公式为:
File size (bits) = Width (pixels) × Height (pixels) × Colour depth (bpp)
To get the size in bytes, divide the result by 8. Remember to multiply by the number of layers or frames if applicable.
要得到字节大小,将结果除以 8。如果有多个图层或帧,记得乘以相应的数量。
Example: A 1024 × 768 image with 24-bit colour depth requires 1024 × 768 × 24 = 18,874,368 bits ≈ 2.25 MB.
示例:一幅 1024 × 768 像素、24 位色深的图像需要 1024 × 768 × 24 = 18,874,368 位 ≈ 2.25 MB。
4. Sound File Size | 声音文件大小
The size of an uncompressed audio file depends on sample rate, bit depth, number of channels, and duration. The formula is:
未压缩音频文件的大小取决于采样率、位深度、声道数和时长。公式如下:
File size (bits) = Sample rate (Hz) × Bit depth × Channels × Duration (seconds)
Sample rate is the number of samples taken per second (e.g., 44,100 Hz for CD quality). Bit depth is the number of bits used to store each sample (e.g., 16 bits). Stereo has 2 channels, mono has 1.
采样率是每秒采集的样本数 (例如 CD 音质为 44,100 Hz)。位深度是每个样本存储所用的位数 (例如 16 位)。立体声有 2 个声道,单声道为 1 个。
Example: 30 seconds of CD-quality stereo audio: 44,100 × 16 × 2 × 30 = 42,336,000 bits ≈ 5.05 MB.
示例:30 秒 CD 音质的立体声:44,100 × 16 × 2 × 30 = 42,336,000 位 ≈ 5.05 MB。
5. Video File Size | 视频文件大小
Uncompressed video size can be approximated by multiplying image size per frame by the frame rate and duration. For a single-layer bitmap video without audio:
未压缩视频大小可通过每帧图像大小乘以帧率和时长来估算。对于不含音频的单层位图视频:
File size (bits) = Width × Height × Colour depth × Frame rate (fps) × Duration (s)
Example: A 640 × 480, 24-bit colour video at 30 fps lasting 10 seconds: 640 × 480 × 24 × 30 × 10 = 2,211,840,000 bits ≈ 263.7 MB.
示例:一段 640 × 480、24 位色深、30 fps、时长 10 秒的视频:640 × 480 × 24 × 30 × 10 = 2,211,840,000 位 ≈ 263.7 MB。
In practice, audio and compression drastically reduce the final file size.
实际中,音频和压缩会大幅减少最终文件大小。
6. Data Transfer Time | 数据传输时间
Transfer time is calculated by dividing the total amount of data by the transfer rate. Ensure both are in the same units (bits or bytes).
传输时间等于数据总量除以传输速率。确保两者单位一致 (均为位或均为字节)。
Time (seconds) = File size (bits) / Transfer rate (bps)
Bandwidth is often given in Mbps (megabits per second). Convert file size to megabits: 1 MB = 8 megabits.
带宽通常以 Mbps (兆位/秒) 给出。将文件大小转换为兆位:1 MB = 8 兆位。
Example: Downloading a 50 MB file over a 10 Mbps connection: 50 × 8 = 400 megabits; 400 / 10 = 40 seconds (theoretical).
示例:通过 10 Mbps 连接下载 50 MB 文件:50 × 8 = 400 兆位;400 / 10 = 40 秒 (理论值)。
7. Compression Ratio | 数据压缩比
The compression ratio expresses how much a file has been reduced in size. It is defined as:
压缩比表示文件缩小了多少。其定义为:
Compression ratio = Original size / Compressed size
For example, if a file is compressed from 1000 KB to 250 KB, the compression ratio is 1000 : 250 = 4 : 1.
例如,若文件从 1000 KB 压缩至 250 KB,压缩比为 1000 : 250 = 4 : 1。
You may also see it expressed as a percentage saving: (1 − compressed/original) × 100%.
也可以表示为节省百分比:(1 − 压缩后/原始) × 100%。
Example: 75% saving means the compressed file is 25% of the original size.
示例:节省 75% 意味着压缩后文件是原始文件的 25%。
8. Run-Length Encoding (RLE) Compression Size | 游程编码压缩大小
RLE is a lossless compression method that replaces repeated data with a count and the value. The compressed size depends on the pattern; you can calculate the expected output for a given sequence.
游程编码 (RLE) 是一种无损压缩方法,用计数和值替换重复的数据。压缩后的大小取决于模式;你可以计算给定序列的预期输出。
The encoded data consists of pairs (count, value). The number of bits needed for the compressed version is approximately:
编码后的数据由 (计数,值) 对组成。压缩版本所需的位数大约为:
Compressed size (bits) = Number of runs × (Bits for count + Bits for value)
Example: A bitmap row with pixel colours ‘RRRRGGGBBB’ has 3 runs. If count is stored in 2 bits and colour in 2 bits, the original 10×2=20 bits become 3×(2+2)=12 bits.
示例:像素颜色为 ‘RRRRGGGBBB’ 的位图行有 3 个游程。若计数用 2 位、颜色用 2 位存储,则原始 10×2=20 位变为 3×(2+2)=12 位。
9. Boolean Algebra and Logic | 布尔代数与逻辑运算
Boolean algebra uses operators AND (∧), OR (∨), NOT (¬). De Morgan’s laws help simplify expressions:
布尔代数使用 AND (∧)、OR (∨)、NOT (¬) 运算符。德摩根定律有助于化简表达式:
¬(A ∧ B) = ¬A ∨ ¬B
¬(A ∨ B) = ¬A ∧ ¬B
Truth tables summarise the output for all input combinations. For example, the NAND gate is the negation of AND.
真值表汇总了所有输入组合下的输出。例如,与非门 (NAND) 是与门的否定。
| A | B | A AND B | A NAND B |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
These rules are essential for logic circuit design and microprocessor operations.
这些规则对于逻辑电路设计和微处理器操作至关重要。
10. Binary and Hexadecimal Conversion | 二、十六进制转换公式
To convert a binary number to decimal, sum the powers of 2 where a 1 appears. For an n-bit binary number bₙ₋₁…b₁b₀:
将二进制数转换为十进制数,将每个为 1 的位对应的 2 的幂次相加。对于 n 位二进制数 bₙ₋₁…b₁b₀:
Decimal = Σ (bᵢ × 2ⁱ) for i = 0 to n-1
Example: 1101₂ = (1×2³)+(1×2²)+(0×2¹)+(1×2⁰) = 8+4+0+1 = 13₁₀.
示例:1101₂ = (1×2³)+(1×2²)+(0×2¹)+(1×2⁰) = 8+4+0+1 = 13₁₀。
Hexadecimal to binary: each hex digit maps directly to a 4-bit nibble (0→0000, 1→0001, …, F→1111). Combine nibbles.
十六进制转二进制:每个十六进制数字直接映射到一个 4 位半字节 (0→0000, 1→0001, …, F→1111)。将半字节组合即可。
Example: A5₁₆ → 1010 0101₂.
示例:A5₁₆ → 1010 0101₂。
11. Checksum Calculation | 校验和计算
Checksum is a simple error-detection method. Data is divided into equal-sized blocks (often bytes). The checksum is calculated by summing all block values and taking the least significant byte (or one’s complement).
校验和是一种简单的错误检测方法。数据被分成等长的块 (通常字节)。将所有块的值求和,取最低有效字节 (或反码) 作为校验和。
Checksum = (Sum of data blocks) mod 256 (or 2⁸)
The receiver performs the same sum including the checksum; if the result is not the expected value (often 0 in one’s complement), an error has occurred.
接收方将包括校验和在内的所有块求和;如果结果不是预期值 (反码校验和通常预期为 0),则表示发生了错误。
Example: data bytes 45, 67, 89; sum = 201; checksum = 201 mod 256 = 201 (or use one’s complement depending on protocol).
示例:数据字节 45, 67, 89;和 = 201;校验和 = 201 mod 256 = 201 (或根据协议使用反码)。
12. Parity Bit Calculation | 奇偶校验位计算
Parity adds an extra bit to make the total number of 1s either even (even parity) or odd (odd parity). For even parity, the parity bit P is set so that the count of 1s in the data + P is even.
奇偶校验添加一个额外位,使 1 的总数为偶数 (偶校验) 或奇数 (奇校验)。对于偶校验,设置校验位 P,使数据中的 1 的个数加上 P 为偶数。
Even parity: P = (total 1s in data) mod 2 (0 means already even, add 0; 1 means odd, add 1)
For odd parity, P is chosen to make the total number of 1s odd. If data already has an odd number of 1s, P=0; otherwise P=1.
对于奇校验,选择 P 使 1 的总数为奇数。如果数据已有奇数个 1,则 P=0;否则 P=1。
Example: For data byte 1011001 (5 ones), even parity requires P=1 (to make total 6 ones, even). Odd parity requires P=0 (total stays 5, odd).
示例:数据字节 1011001 (5 个 1),偶校验需要 P=1 (使 1 的总数为 6,偶数)。奇校验需要 P=0 (总数保持 5,奇数)。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导