📚 IGCSE OCR Computer Science Formula Handbook | IGCSE OCR 计算机科学公式汇总手册
This handbook brings together all the key formulas required for the IGCSE OCR Computer Science specification. It covers calculations for image, sound, and text file sizes, data transfer times, compression ratios, storage unit conversions, Boolean algebra identities, binary arithmetic, error detection, algorithmic efficiency, and number base conversions. Every formula is presented in a clear, exam-ready format with both English and Chinese explanations to support bilingual learners.
本手册汇总了IGCSE OCR计算机科学课程所需的所有关键公式。内容涵盖图像、声音和文本文件大小计算、数据传输时间、压缩比、存储单位换算、布尔代数恒等式、二进制运算、错误检测、算法效率以及数制转换。每个公式均以清晰、适合备考的形式呈现,并提供中英文双语解释,帮助双语学习者掌握要点。
1. Image File Size | 图像文件大小
The size of an uncompressed bitmap image is determined by its resolution (width × height) and colour depth. The file size in bytes can be found by converting the total number of bits into bytes.
未压缩的位图图像大小由其分辨率(宽度 × 高度)和颜色深度决定。通过将总位数转换为字节即可得到以字节为单位的文件大小。
Image file size (bytes) = (Image width × Image height × Colour depth in bits) ÷ 8
图像文件大小(字节) = (图像宽度 × 图像高度 × 颜色深度/位) ÷ 8
Colour depth is typically measured in bits per pixel (bpp). For example, a 24‑bpp image uses 24 bits for each pixel. Always remember to multiply the dimensions first, then divide by 8 to convert bits into bytes.
颜色深度通常以每像素位数(bpp)衡量。例如,24 bpp的图像为每个像素使用24位。务必先将尺寸相乘,再除以8以将位转换为字节。
2. Sound File Size | 声音文件大小
The storage needed for uncompressed digital audio depends on the sample rate, bit depth, number of channels, and duration. Higher sample rates and bit depths give better quality but increase file size.
未压缩数字音频所需的存储空间取决于采样率、位深度、声道数和时长。更高的采样率和位深度可提供更好的音质,但同时也会增大文件大小。
Sound file size (bytes) = (Sample rate × Bit depth × Number of channels × Duration in seconds) ÷ 8
声音文件大小(字节) = (采样率 × 位深度 × 声道数 × 时长/秒) ÷ 8
The sample rate is in hertz, bit depth in bits, and the result is in bytes. CD‑quality audio often uses 44 100 Hz, 16 bits, and two stereo channels.
采样率以赫兹为单位,位深度以位为单位,计算结果为字节。CD质量音频通常使用44 100 Hz、16位和两个立体声声道。
3. Text File Size | 文本文件大小
The size of a plain text file is directly proportional to the number of characters and the encoding system used. ASCII typically uses 7 or 8 bits per character, while Unicode may use 16 or 32 bits.
纯文本文件的大小与字符数和所使用的编码系统成正比。ASCII通常为每字符7或8位,而Unicode可能每字符16或32位。
Text file size (bytes) = (Number of characters × Bits per character) ÷ 8
文本文件大小(字节) = (字符数 × 每字符位数) ÷ 8
When 8‑bit ASCII is used, the formula simplifies to file size in bytes = number of characters, because each character occupies exactly 1 byte.
使用8位ASCII时,公式简化为文件大小(字节)= 字符数,因为每个字符恰好占用1个字节。
4. Data Transfer Time | 数据传输时间
The time required to send a file across a network is calculated by dividing the file size by the data transfer rate. Consistent units are essential: file size is often converted to bits before applying the bit rate.
通过网络发送文件所需的时间等于文件大小除以数据传输速率。单位必须保持一致:文件大小通常需先转换为位,再结合比特率计算。
Transfer time (s) = File size (bits) ÷ Bit rate (bps)
传输时间(秒) = 文件大小(位) ÷ 比特率(bps)
Alternatively, if the file size is given in bytes, multiply by 8 first. Make sure to include any overhead, such as protocol headers, when estimating realistic transfer times.
或者,若文件大小以字节给出,则先乘以8。在估算实际传输时间时,还需考虑协议头部等开销。
5. Compression Ratios | 压缩比
Compression ratio measures how much a file has been reduced in size. It compares the original size to the compressed size. A higher ratio means greater size reduction.
压缩比用于衡量文件大小缩小的程度,即原始大小与压缩后大小的比值。比值越高,表示尺寸缩小越多。
Compression ratio = Original size ÷ Compressed size
压缩比 = 原始大小 ÷ 压缩后大小
Space saving can also be expressed as a percentage: ((Original − Compressed) ÷ Original) × 100. Lossless compression ensures all data can be perfectly recovered, unlike lossy compression.
空间节省也可表示为百分比:((原始 − 压缩后) ÷ 原始)× 100。无损压缩保证所有数据可完全还原,而有损压缩则不然。
6. Storage Unit Conversions | 存储单位换算
Computer storage is based on powers of two. Converting between bits, bytes, kilobytes, megabytes, and gigabytes requires knowing that 1 kilobyte equals 1024 bytes, not 1000 bytes.
计算机存储基于2的幂次。在比特、字节、千字节、兆字节和千兆字节之间转换时,必须知道1千字节等于1024字节,而非1000字节。
1 byte = 8 bits
1 KB = 1024 bytes = 2¹⁰ B
1 MB = 1024 KB = 2²⁰ B
1 GB = 1024 MB = 2³⁰ B
1 TB = 1024 GB = 2⁴⁰ B
1 字节 = 8 位
1 KB = 1024 字节 = 2¹⁰ B
1 MB = 1024 KB = 2²⁰ B
1 GB = 1024 MB = 2³⁰ B
1 TB = 1024 GB = 2⁴⁰ B
These binary definitions are sometimes referred to as kibibyte, mebibyte, etc., but the OCR specification commonly uses the traditional KB, MB symbols with binary values.
这些二进制定义有时称作kibibyte、mebibyte等,但OCR大纲通常沿用传统的KB、MB符号,并赋予二进制数值。
7. Logic Gate Boolean Identities | 逻辑门布尔恒等式
Boolean algebra uses a set of identities to simplify logic circuits. Understanding these laws helps in reducing the number of gates and improving circuit efficiency.
布尔代数利用一组恒等式来化简逻辑电路。理解这些定律有助于减少逻辑门数量,提高电路效率。
Identity: A + 0 = A, A · 1 = A
Null: A + 1 = 1, A · 0 = 0
Idempotent: A + A = A, A · A = A
Inverse: A + A’ = 1, A · A’ = 0
同一律:A + 0 = A, A · 1 = A
零律:A + 1 = 1, A · 0 = 0
幂等律:A + A = A, A · A = A
互补律:A + A’ = 1, A · A’ = 0
Commutative, associative, distributive, and absorption laws are also essential. For instance, absorption states that A + (A · B) = A and A · (A + B) = A.
交换律、结合律、分配律和吸收律同样必不可少。例如,吸收律为 A + (A · B) = A 以及 A · (A + B) = A。
8. De Morgan’s Laws and Simplification | 德摩根定律与化简
De Morgan’s laws provide a systematic way to transform and simplify complex Boolean expressions, especially those involving NAND and NOR gates.
德摩根定律为转换和化简复杂的布尔表达式提供了系统方法,尤其适用于含有NAND和NOR门的表达式。
(A + B)’ = A’ · B’
(A · B)’ = A’ + B’
(A + B)’ = A’ · B’
(A · B)’ = A’ + B’
These transformations show that an OR‑into‑NAND can become an AND of inverted inputs, and an AND‑into‑NOR becomes an OR of inverted inputs, reducing the variety of gates needed.
这些变换表明,或非门可以化为反输入后再与,与非门可以化为反输入后再或,从而减少所需门电路的种类。
9. Binary Arithmetic and Overflow | 二进制运算与溢出
Binary addition follows simple rules, but when the result exceeds the available number of bits, overflow occurs. Overflow detection is crucial for signed arithmetic using two’s complement.
二进制加法遵循简单规则,但当结果超出可用位数时便会产生溢出。在使用补码进行有符号运算时,溢出检测至关重要。
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0, carry 1
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0, 进位 1
Overflow in two’s complement occurs if the carry into the sign bit differs from the carry out of the sign bit. Adding two positive numbers should never yield a negative result.
补码加法中,若进入符号位的进位与离开符号位的进位不同,则发生溢出。两个正数相加绝不应得到负数结果。
10. Error Detection Methods | 错误检测方法
Simple error detection relies on parity bits or checksums. An even parity bit makes the total number of 1s even, while a checksum adds up data bytes modulo a fixed value.
简单的错误检测依赖奇偶校验位或校验和。偶校验位使位值为1的总数为偶数,而校验和则是对数据字节求和后取模一个固定值。
Even parity bit = (Count of 1‑bits) MOD 2
偶校验位 = (位值为1的个数) MOD 2
Checksum = (Sum of data byte values) MOD 256
校验和 = (数据字节值之和) MOD 256
The receiver recalculates the parity or
Published by TutorHao | IGCSE Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导