A-Level OCR Computer Science: Formula Handbook | A-Level OCR 计算机:公式汇总手册

📚 A-Level OCR Computer Science: Formula Handbook | A-Level OCR 计算机:公式汇总手册

Welcome to the complete formula guide for OCR A-Level Computer Science. Whether you are revising for Component 1 or Component 2, this handbook brings together every equation, relationship, and conversion you need to know, from image file size and processor performance to Boolean algebra and error detection. Use it alongside past-paper questions to strengthen your numerical and logical reasoning.

欢迎使用 OCR A-Level 计算机科学公式完全指南。无论你正在复习 Component 1 还是 Component 2,本手册汇集了你需要掌握的每一个公式、关系和转换计算,涵盖图像文件大小、处理器性能、布尔代数以及错误检测等。配合历年真题使用,可有效提升你的计算与逻辑推理能力。

1. Data and Storage Units | 数据与存储单位

Understanding data size prefixes is essential for any calculation. A bit (b) is the smallest unit; one byte (B) equals 8 bits. Larger prefixes are based on powers of 10 (decimal) or powers of 2 (binary), but OCR focuses on the decimal system: kilobyte = 10³ bytes, megabyte = 10⁶ bytes, gigabyte = 10⁹ bytes, terabyte = 10¹² bytes. The relationship between units helps convert storage quantities.

理解数据大小前缀是所有计算的基础。位 (b) 是最小单位;一个字节 (B) 等于 8 位。更大的前缀以 10 的幂(十进制)或 2 的幂(二进制)为基础,但 OCR 考试以十进制为准:千字节 = 10³ 字节,兆字节 = 10⁶ 字节,吉字节 = 10⁹ 字节,太字节 = 10¹² 字节。各单位之间的关系帮助我们转换存储容量。

1 kB = 1000 B
1 MB = 1000 kB = 1 000 000 B
1 GB = 1000 MB = 1 000 000 000 B
1 TB = 1000 GB = 1 000 000 000 000 B

Note: for calculations involving data transfer, always ensure units are consistent – often convert to bits (if bandwidth is in bps) or bytes.

注意:在涉及数据传输的计算中,始终保证单位一致 – 通常转换为位(如果带宽以 bps 为单位)或字节。


2. Image File Size | 图像文件大小

An uncompressed bitmap image file size depends on three factors: the number of pixels (image resolution), the colour depth (bits per pixel), and the number of colour channels if relevant (but OCR usually uses total pixels × bits per pixel). The formula is:

未压缩的位图图像文件大小取决于三个因素:像素数量(图像分辨率)、颜色深度(每像素位数),以及如有多个颜色通道时的通道数(但 OCR 通常使用总像素 × 每像素位数)。计算公式为:

File size (bits) = image width in pixels × image height in pixels × colour depth (bits per pixel)

File size (bytes) = (width × height × colour depth) ÷ 8

If a colour image uses, for example, 24 bits per pixel (8 bits for each of red, green and blue), the colour depth is 24. Remember to convert bits to bytes by dividing by 8 before moving to kB or MB.

如果一幅彩色图像采用例如 24 位/像素(红、绿、蓝各 8 位),则颜色深度为 24。在转换为 kB 或 MB 之前,记得将位除以 8 得到字节数。

Example: An image of 1920×1080 pixels with 24-bit colour. File size = 1920 × 1080 × 24 = 49 766 400 bits = 6 220 800 B ≈ 6.22 MB.

示例: 一幅 1920×1080 像素、24 位色彩的图像。文件大小 = 1920 × 1080 × 24 = 49 766 400 位 = 6 220 800 B ≈ 6.22 MB。


3. Sound File Size | 声音文件大小

Uncompressed digital audio file size is calculated from the sample rate, the bit depth (sample resolution), the duration of the audio, and the number of channels (mono = 1, stereo = 2). The formula is:

未压缩的数字音频文件大小由采样率、位深度(采样分辨率)、音频时长以及声道数(单声道 = 1,立体声 = 2)计算得出。公式为:

File size (bits) = sample rate (Hz) × bit depth × duration (seconds) × number of channels

File size (bytes) = (sample rate × bit depth × duration × channels) ÷ 8

Sampling rate is measured in hertz (Hz), bit depth in bits. For example, CD-quality audio uses 44 100 Hz, 16 bits, stereo. A one-minute CD track: 44 100 × 16 × 60 × 2 = 84 672 000 bits ≈ 10.58 MB.

采样率以赫兹 (Hz) 为单位,位深度以位为单位。例如,CD 音质的音频采用 44 100 Hz、16 位、立体声。一分钟的 CD 音轨:44 100 × 16 × 60 × 2 = 84 672 000 位 ≈ 10.58 MB。


4. Text Storage Requirements | 文本存储要求

Plain text file size depends on the character set used and the number of characters. For ASCII, each character is encoded using 7 or 8 bits (OCR typically assumes 8 bits = 1 byte per character). For Unicode (UTF-16 or UTF-32), the size per character grows to 2 or 4 bytes. The formula is:

纯文本文件的大小取决于所使用的字符集以及字符数量。对于 ASCII,每个字符用 7 或 8 位编码(OCR 通常假设 8 位 = 每字符 1 字节)。对于 Unicode(UTF-16 或 UTF-32),每个字符的大小增大至 2 或 4 字节。公式为:

Text file size (bytes) = number of characters × bytes per character

Be aware that control characters (like newline) and spaces also count as characters. If an exam gives a text with N characters and states the encoding, multiply accordingly.

注意,控制字符(如换行)和空格也计为字符。如果考试给出一个包含 N 个字符的文本并说明编码方式,则相应相乘。

Example: 3000 characters stored in extended ASCII (1 byte each) → 3000 B ≈ 3 kB.

示例: 用扩展 ASCII(每字符 1 字节)存储 3000 个字符 → 3000 B ≈ 3 kB。


5. Network Transmission Time | 网络传输时间

When data is sent over a network, the time taken depends on the size of the data and the bandwidth (transmission rate) of the link. Bandwidth is usually given in bits per second (bps) or multiples (kbps, Mbps, Gbps). The core formula is:

当数据通过网络发送时,所需时间取决于数据大小和链路的带宽(传输速率)。带宽通常以位/秒 (bps) 或其倍数(kbps、Mbps、Gbps)给出。核心公式为:

Transmission time (seconds) = file size (bits) ÷ bandwidth (bps)

You may also need to account for propagation delay (distance divided by propagation speed) or packet switching overheads, but the basic bandwidth formula is the most frequently examined.

你有时也需要考虑传播延迟(距离除以传播速度)或数据包交换开销,但基本的带宽公式是考试中最常见的。

Example: A 50 MB file over a 100 Mbps connection. Convert 50 MB to bits: 50 × 8 × 10⁶ = 400 Mbits. Time = 400 Mbits ÷ 100 Mbps = 4 seconds.

示例: 一个 50 MB 文件通过 100 Mbps 连接传输。将 50 MB 转换为位:50 × 8 × 10⁶ = 400 Mbits。时间 = 400 Mbits ÷ 100 Mbps = 4 秒。


6. Processor Performance | 处理器性能

CPU execution time for a program can be modelled using the relationship between clock frequency, instructions, and cycles. The fundamental performance equation is:

CPU 执行一个程序的时间可以通过时钟频率、指令数与周期数的关系来建模。基本性能方程为:

Execution time (seconds) = (number of instructions × CPI) ÷ clock frequency (Hz)

where CPI is the average number of clock cycles per instruction. Alternatively, using clock cycle time T (period):

其中 CPI 为每条指令平均时钟周期数。或者,使用时钟周期时间 T(周期):

Execution time = number of instructions × CPI × T
(where T = 1 / clock frequency)

Increasing clock frequency or reducing CPI / instruction count will improve performance. These relationships are used to compare processors and evaluate pipelining or multi-core benefits qualitatively.

提高时钟频率或降低 CPI / 指令数可以提升性能。这些关系用于比较处理器,并定性地评估流水线或多核带来的好处。


7. Logic Gate Combinations – Number of Rows | 逻辑门组合 – 真值表行数

When constructing a truth table for a combinational logic circuit, the number of rows is determined by the number of inputs. With N independent logic inputs, the truth table requires 2ᴺ rows (not including the heading). For example, 3 inputs → 2³ = 8 rows. This exponential growth also explains the complexity of large digital systems.

在为组合逻辑电路构建真值表时,行数由输入变量的数量决定。对于 N 个独立的逻辑输入,真值表需要 2ᴺ 行(不含表头)。例如,3 个输入 → 2³ = 8 行。这种指数增长也解释了大量数字系统的复杂性。

Number of rows = 2ᴺ

This relationship underpins the analysis of adders, multiplexers, and any combinational circuit you design or evaluate.

这一关系是分析加法器、多路选择器以及你设计或评估的任何组合电路的基础。


8. Boolean Algebra Laws | 布尔代数定律

Boolean algebra provides a set of identities used to simplify logic expressions. The key laws for OCR include:

布尔代数提供了一组用于化简逻辑表达式的恒等式。OCR 需要掌握的关键定律包括:

Commutative: A + B = B + A, A · B = B · A
Associative: A + (B + C) = (A + B) + C, A · (B · C) = (A · B) · C
Distributive: A · (B + C) = A · B + A · C, A + (B · C) = (A + B) · (A + C)
Identity: A + 0 = A, A · 1 = A
Complement: A + A’ = 1, A · A’ = 0
De Morgan’s: (A + B)’ = A’ · B’, (A · B)’ = A’ + B’
Absorption: A + (A · B) = A, A · (A + B) = A
Involution: (A’)’ = A

These laws allow you to minimise circuits, reduce gate counts, and solve problems on logic diagrams and Karnaugh maps.

这些定律允许你最小化电路、减少门数量,并解决逻辑图和卡诺图中的问题。


9. Number System Conversions – Key Patterns | 数制转换 – 常用模式

Although conversions between binary, decimal, and hexadecimal involve methods rather than formulas, a few numeric shortcuts act like formulas. One hex digit corresponds exactly to a nibble (4 bits). To convert hex to binary, replace each hex digit with its 4-bit binary equivalent (and vice versa). The value of a binary integer can be expanded using weighted sums:

尽管二进制、十进制与十六进制之间的转换属于方法而非公式,但有几个捷径可以像公式一样使用。一个十六进制位恰好对应 4 个二进制位(半个字节)。要将十六进制转换为二进制,只需将每个十六进制位替换为其等值的 4 位二进制(反之亦然)。二进制整数的值可以用加权和展开:

Decimal value = Σ (dₙ × 2ⁿ) for n from 0 (LSB) upwards

For fractional binary numbers, the weights are 2⁻¹, 2⁻² etc. Remembering that 2¹⁰ = 1024 (approx 10³) often helps estimate large binary values.

对于二进制小数,权重为 2⁻¹、2⁻² 等。记住 2¹⁰ = 1024(约 10³)常常有助于估算较大的二进制数值。


10. Data Transfer Rate for Buses | 总线数据传输率

Inside a computer, the data transfer rate of a bus can be calculated from its width and operating frequency. The formula is:

在计算机内部,总线的数据传输速率可以通过其宽度和工作频率计算。公式为:

Transfer rate (bytes/s) = (bus width in bits ÷ 8) × frequency (Hz)

This applies to memory buses, front-side buses, and peripheral connections. If a bus is 64 bits wide and runs at 800 MHz, the maximum transfer rate is (64 ÷ 8) × 800 × 10⁶ = 6400 MB/s.

这适用于内存总线、前端总线和外设连接。如果一条总线宽 64 位、频率为 800 MHz,则最大传输速率为 (64 ÷ 8) × 800 × 10⁶ = 6400 MB/s。


11. Error Detection – Parity Bits and Checksums | 错误检测 – 奇偶校验位与校验和

Parity adds a single bit to a data word to give an even or odd number of 1s. For even parity, the parity bit is calculated as:

奇偶校验为数据字添加一个位,使得 1 的个数为偶数或奇数。对于偶校验,奇偶位的计算方法为:

Parity bit (even) = XOR of all data bits (0 if count of 1s is even, 1 if odd)

For odd parity, the bit is the inverse. Checksums involve adding all data values (often in 8-bit or 16‑bit chunks) and sending the sum or its complement, allowing the receiver to detect errors.

对于奇校验,该位与之相反。校验和则涉及将所有数据值(通常以 8 位或 16 位块)相加,并发送和或其补码,使接收方能够检测错误。

These are not purely arithmetic formulas but logical relationships you must be able to apply in data transmission scenarios.

这些并不完全是算术公式,但却是你在数据传输场景中必须能够应用的逻辑关系。


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

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

Exit mobile version