📚 A-Level CIE Computer Science Formula Handbook | A-Level CIE 计算机:公式汇总手册
This handbook brings together all the essential formulae, conversions, and equations you will need for CIE A-Level Computer Science (9618). Each section breaks down a key area of the syllabus, presenting the relationships in a clean, exam-friendly way. Use it for quick revision, practice calculations, and to build confidence before your papers.
本手册汇集了 CIE A-Level 计算机科学(9618)所有必备的公式、转换和方程。每一节都分解了考纲中的一个关键领域,以清晰且适合考试的方式呈现各类关系。用它进行快速复习、练习计算,并在考前建立信心。
1. Number Systems & Conversions | 数制与转换
To convert from any base to decimal, multiply each digit by the base raised to the power of its position (starting from 0 on the right). For binary (base 2), the weight of each bit is 2ᴾ, where p is the place value. Hexadecimal digits A–F correspond to 10–15.
将任意进制转换为十进制时,将每位数字乘以基数的位权次方(从右侧开始位置为0)。对于二进制(基数为2),每个位的权重为 2ᴾ,其中 p 是位值。十六进制数字 A–F 对应 10–15。
Decimal = Σ (digit × baseᴾ)
Convert decimal to binary by repeated division by 2, recording remainders from bottom to top. To convert between binary and hexadecimal, group binary digits in fours from the right, then replace each group with the corresponding hex symbol.
将十进制转换为二进制,可反复除以 2,从下到上记录余数。要在二进制与十六进制之间转换,从右侧开始将二进制数字四位一组进行分组,然后将每组替换为相应的十六进制符号。
2. Binary Arithmetic & Two’s Complement | 二进制算术与补码
In two’s complement representation, negative numbers are formed by inverting all bits of the positive magnitude and adding 1. For an n-bit word, the range of representable integers is from –2ⁿ⁻¹ to 2ⁿ⁻¹–1.
在补码表示法中,负数由其正值的所有位取反再加1形成。对于 n 位字长,可表示的整数范围为 –2ⁿ⁻¹ 到 2ⁿ⁻¹–1。
–X = (invert bits of X) + 1
To convert a negative two’s complement number back to decimal, note that the most significant bit has a weight of –2ⁿ⁻¹. Alternatively, apply two’s complement again to find the positive magnitude, then add a minus sign.
要将负数的补码转回十进制,注意最高有效位的权重为 –2ⁿ⁻¹。或者再次求补码得到正值大小,再加上负号。
3. Floating-Point Representation | 浮点数表示
A real number is stored in the form mantissa × 2ᵉˣᵖᵒⁿᵉⁿᵗ. The mantissa is normalised so that the first two bits of the mantissa are different (for positive numbers, the first bit must be 1). The exponent is stored in two’s complement or bias notation.
实数以格式 尾数 × 2指数 存储。尾数经规格化,使得尾数的前两位不同(对于正数,第一位必须为 1)。指数以补码或偏移表示法存储。
Value = mantissa × 2ᵉˣᵖᵒⁿᵉⁿᵗ
Precision is increased by devoting more bits to the mantissa; range is increased by allocating more bits to the exponent. Understand how to convert a binary floating-point number to denary and vice versa.
增加尾数位数可提高精度;增加指数位数可扩大范围。要理解如何将二进制浮点数转换为十进制数,反之亦然。
4. Logic Gates & Boolean Algebra | 逻辑门与布尔代数
The fundamental logic operations are NOT, AND, and OR. The output of an AND gate is A·B (A AND B), the OR gate gives A+B (A OR B), and NOT yields Ā (NOT A). De Morgan’s laws allow conversion between AND and OR forms:
基本逻辑运算有 NOT、AND 和 OR。AND 门输出为 A·B(A AND B),OR 门输出为 A+B(A OR B),NOT 输出为 Ā(NOT A)。德摩根定律可在 AND 与 OR 形式之间转换:
A·B = A + B A+B = A · B
Boolean expressions can be simplified using identities such as A+A = A, A+0 = A, A+1 = 1, A·A = A, A·Ā = 0, and the distributive law A·(B+C) = A·B + A·C. Karnaugh maps are used for up to four variables to minimise logic circuits.
可使用恒等式化简布尔表达式,例如 A+A=A、A+0=A、A+1=1、A·A=A、A·Ā=0 以及分配律 A·(B+C)=A·B+A·C。卡诺图用于最多4个变量的逻辑电路极小化。
5. Storage & File Size Calculations | 存储与文件大小计算
Bit is the smallest unit; 1 byte = 8 bits. File size is measured in kilobytes (kB), megabytes (MB), gigabytes (GB), etc. For CIE, 1 kB = 10³ bytes = 1000 bytes, but in many programming contexts 1 KiB = 2¹⁰ = 1024 bytes. Check the paper’s instruction.
位是最小单位;1 字节 = 8 位。文件大小以千字节(kB)、兆字节(MB)、吉字节(GB)等度量。对于CIE,1 kB = 10³ 字节 = 1000 字节,但在许多编程环境中 1 KiB = 2¹⁰ = 1024 字节。请留意试卷说明。
| Unit | Equal to (IEC) |
|---|---|
| 1 KiB | 2¹⁰ bytes = 1024 bytes |
| 1 MiB | 2²⁰ bytes ≈ 1.05 × 10⁶ bytes |
| 1 GiB | 2³⁰ bytes ≈ 1.07 × 10⁹ bytes |
To calculate the size of a database table, multiply the number of records by the size of each record (sum of field sizes). For a text file, size ≈ number of characters × bits per character (e.g., ASCII uses 7 or 8 bits per character).
要计算数据库表的大小,将记录数乘以每条记录的大小(字段大小之和)。对于文本文件,大小 ≈ 字符数 × 每个字符的位数(例如 ASCII 使用每字符7或8位)。
6. Sound Representation | 声音表示
Sound is digitised by sampling the analogue wave at regular intervals. The sampling rate (Hz) is how many samples are taken per second; the sample resolution (bits) is the number of bits used to store each sample.
声音通过按固定间隔对模拟波形采样实现数字化。采样率(Hz)是每秒采集的样本数;采样分辨率(位)是存储每个样本所用的位数。
File size (bits) = sampling rate (Hz) × sample resolution (bits) × number of channels × duration (seconds)
The bit rate (bps) is the number of bits processed per second: bit rate = sampling rate × sample resolution × channels. To achieve CD-quality audio you need 44.1 kHz sampling rate and 16-bit resolution in stereo (2 channels).
比特率(bps)是每秒处理的位数:比特率 = 采样率 × 采样分辨率 × 声道数。要达到 CD 音质,需要 44.1 kHz 的采样率、16 位分辨率和立体声(2声道)。
7. Image & Video Representation | 图像与视频表示
An image is represented as a grid of pixels. The colour depth (bit depth) is the number of bits used to encode the colour of each pixel. For example, a 24-bit colour depth allows 2²⁴ ≈ 16.7 million colours.
图像用像素网格表示。颜色深度(位深)是用于编码每个像素颜色的位数。例如,24 位颜色深度可表示 2²⁴ ≈ 1670 万种颜色。
Image file size (bits) = width in pixels × height in pixels × colour depth (bits)
Video consists of a sequence of images (frames) per second. Therefore, video file size ≈ frame rate × image size per frame × duration in seconds. Compression is normally used to reduce this massive amount of data.
视频由每秒一系列图像(帧)组成。因此,视频文件大小 ≈ 帧率 × 每帧图像大小 × 时长(秒)。通常使用压缩来减少这庞大的数据量。
8. Data Transmission | 数据传输
Transmission time depends on the file size and the data transfer rate (bit rate). If the file size is given in bytes, convert to bits by multiplying by 8.
传输时间取决于文件大小和数据传输速率(比特率)。如果文件大小以字节给出,需乘以 8 转换为位。
Time (seconds) = File size (bits) ÷ bit rate (bps)
Parity checks add a redundant bit to make the total number of 1s even (even parity) or odd (odd parity). Check digit (e.g., ISBN-13) uses modulo arithmetic: the check digit makes the weighted sum a multiple of 10.
奇偶校验添加一个冗余位,使得 1 的总数为偶数(偶校验)或奇数(奇校验)。校验位(如 ISBN-13)使用模运算:校验位使得加权和成为 10 的倍数。
9. Compression | 压缩
Lossless compression reduces file size without losing any information. Common methods are run-length encoding (RLE) and dictionary-based algorithms. In RLE, a sequence of repeated symbols is replaced by a count and the symbol.
无损压缩在不丢失任何信息的情况下减小文件大小。常用方法有游程编码(RLE)和基于字典的算法。在 RLE 中,重复出现的符号序列被替换为一个计数和该符号。
Compression ratio = uncompressed size ÷ compressed size
Lossy compression (e.g., JPEG for images, MP3 for audio) permanently removes some data based on human perception limits. The acceptable level of loss is a trade-off between quality and file size.
有损压缩(例如图像的 JPEG、音频的 MP3)基于人类感知限制永久性移除部分数据。可接受的损失程度是在质量和文件大小之间权衡。
10. Encryption | 加密
In symmetric encryption, the same key is used for both encryption and decryption. The Caesar cipher shifts each letter by a fixed number of positions modulo 26. Its formula is:
在对称加密中,加密和解密使用相同的密钥。凯撒密码将每个字母按固定位置数循环移位,模26。其公式为:
C = (P + K) mod 26
Asymmetric encryption uses a public key for encryption and a private key for decryption. RSA relies on the product of two large primes. A simple RSA operation: ciphertext C = Mᵉ mod n, where (e, n) is the public key and M is the message converted to a number.
非对称加密使用公钥加密、私钥解密。RSA 依赖于两个大素数的乘积。简化的 RSA 运算:密文 C = Mᵉ mod n,其中 (e, n) 是公钥,M 是转换为数字的消息。
11. Processor Performance | 处理器性能
The performance of a CPU is influenced by clock speed, the number of cores, cache size, and instruction set architecture. Clock speed is measured in hertz (Hz) – a 3 GHz processor ticks 3×10⁹ times per second.
CPU 的性能受时钟速度、核心数量、缓存大小和指令集架构的影响。时钟速度以赫兹 (Hz) 度量 – 3 GHz 处理器每秒滴答 3×10⁹ 次。
CPU time = Instruction count × CPI × Clock cycle time
CPI stands for cycles per instruction. Reducing CPI or cycle time improves performance. Parallel processing across multiple cores can, in ideal cases, divide execution time by the number of cores.
CPI 表示每条指令的周期数。降低 CPI 或周期时间可提高性能。在理想情况下,跨多个核心的并行处理可将执行时间除以核心数量。
12. Addressing Modes & Operand Calculation | 寻址模式与操作数计算
In direct addressing, the instruction contains the memory address of the operand. In immediate addressing, the operand itself is in the instruction. In indexed addressing, an index register (X) is added to a base address to compute the effective address (EA).
在直接寻址中,指令包含操作数的内存地址。在立即寻址中,操作数本身就在指令中。在变址寻址中,索引寄存器 (X) 与基地址相加,得到有效地址 (EA)。
Effective Address = Base Address + Index (X)
Indirect addressing stores the address of the operand’s address; the instruction points to a memory location that holds the final address. In calculating memory required for arrays, use the base address plus (index × element size).
间接寻址存储操作数地址的地址;指令指向一个存放最终地址的内存位置。在计算数组所需的内存时,使用基地址加上 (索引 × 元素大小)。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导