GCSE Computer Science: Formula Cheat Sheet | GCSE计算机科学:公式汇总手册

📚 GCSE Computer Science: Formula Cheat Sheet | GCSE计算机科学:公式汇总手册

This comprehensive formula cheat sheet covers the key calculations required for GCSE Computer Science, from file sizes and compression ratios to data transfer times and number conversions. Work through each section, practise the examples, and you will be fully prepared for any quantitative problem on your exam papers.

这份全面的公式汇总手册涵盖了GCSE计算机科学所需的核心计算,包括文件大小、压缩比、数据传输时间以及数制转换等。逐一掌握每个模块的公式,并通过例题练熟,你就能从容应对试卷中任何定量分析题目。


1. Data Storage Unit Conversions | 数据存储单位转换

All file size calculations depend on a solid understanding of storage units. The base unit is the bit (b), followed by the byte (B), where 1 B = 8 b. Multiples of bytes use binary prefixes: 1 kibibyte (KiB) = 210 bytes = 1024 bytes, 1 mebibyte (MiB) = 220 bytes, and so on. In GCSE contexts, KB, MB, GB usually refer to these binary multiples (powers of 1024).

所有文件大小的计算都离不开对存储单位的扎实理解。最基本的单位是位(bit),然后为字节(Byte),1 B = 8 b。字节的倍数使用二进制前缀:1 KiB = 210 字节 = 1024 字节,1 MiB = 220 字节,依次类推。在GCSE考试中,KB、MB、GB 通常指的是这些以1024为基数的二进制倍数。

Unit Equivalent As a power of 2
1 Byte (B) 8 bits 23 bits
1 Kibibyte (KiB / KB) 1024 bytes 210 B
1 Mebibyte (MiB / MB) 1024 KiB 220 B
1 Gibibyte (GiB / GB) 1024 MiB 230 B
1 Tebibyte (TiB / TB) 1024 GiB 240 B

To convert between units, multiply by 1024 when going from a larger unit to a smaller one, and divide by 1024 when going from a smaller unit to a larger one. Always keep the bit-to-byte ratio (÷8 or ×8) in mind when switching between b and B.

在不同单位之间转换时,从大单位转换为小单位要乘以1024,从小单位转换为大单位则除以1024。在比特和字节之间切换时,务必记住除以8或乘以8的换算关系。


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

A bitmap image file consists of a grid of pixels, each storing colour information. The number of bits required per pixel is given by the colour depth (bit depth). The total number of pixels is the image width multiplied by its height. Therefore, the file size in bits is calculated as:

位图图像文件由一个个像素网格组成,每个像素存储颜色信息。每个像素所需的位数由色彩深度(位深度)决定。像素总数是图像的宽乘以高。因此,以位为单位的文件大小按以下公式计算:

File Size (bits) = Width (pixels) × Height (pixels) × Colour Depth (bits per pixel)

To express the answer in bytes, divide the result by 8. For larger units, further divide by 1024n as appropriate.

若要以字节表示结果,将结果除以8。如需转换为更大单位,再按需要除以对应的1024n

Example: A 1920×1080 image with a colour depth of 24 bits per pixel. File size in bits = 1920 × 1080 × 24 = 49,766,400 bits. In bytes = 49,766,400 / 8 = 6,220,800 B ≈ 5.93 MiB.

示例:一幅1920×1080的图像,色彩深度为每像素24位。文件大小(位) = 1920 × 1080 × 24 = 49,766,400 位。换算为字节 = 49,766,400 / 8 = 6,220,800 字节 ≈ 5.93 MiB。


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

Sound is digitised by measuring the amplitude of the sound wave at regular intervals (sampling) and storing each measurement using a fixed number of bits (bit depth). The file size depends on four factors:

声音通过定期测量声波幅度(采样)并用固定位数存储每次测量值(位深度)来实现数字化。文件大小取决于四个因素:

  • Sample rate (Hz) – number of samples per second
  • Bit depth (bits) – bits used per sample
  • Duration (seconds) – length of the audio
  • Number of channels (1 for mono, 2 for stereo)

采样率(赫兹) — 每秒样本数
位深度(位) — 每个样本所用的位数
时长(秒) — 音频长度
声道数量(1表示单声道,2表示立体声)

File Size (bits) = Sample Rate (Hz) × Bit Depth × Duration (s) × Number of Channels

Again, convert to bytes by dividing by 8, and then to KiB, MiB, etc. as needed.

同样,转换为字节时除以8,再按需转换为KiB、MiB等。

Example: 3 minutes of CD-quality audio: 44,100 Hz sample rate, 16-bit depth, stereo. Duration = 3 × 60 = 180 s. File size = 44,100 × 16 × 180 × 2 = 254,016,000 bits = 30.3 MiB approximately.

示例:录制3分钟CD品质音频:采样率44,100 Hz,位深度16位,立体声。时长 = 3 × 60 = 180秒。文件大小 = 44,100 × 16 × 180 × 2 = 254,016,000 位 ≈ 30.3 MiB。


4. Text File Size Calculation | 文本文件大小计算

Plain text files store each character as a binary code. The number of bits per character depends on the character set used. For standard ASCII, it is 7 or 8 bits per character (usually stored as 1 byte). For Unicode (e.g., UTF-16), it is typically 16 bits (2 bytes) per character.

纯文本文件将每个字符存储为一个二进制编码。每个字符的位数取决于所使用的字符集。标准ASCII通常为每字符7或8位(常按1字节存储)。对于Unicode(如UTF-16),通常为每字符16位(2字节)。

File Size (bytes) = Number of Characters × Bytes per Character

If the bits per character is given, first find the total bits and then divide by 8. Most GCSE questions will specify either ‘use 1 byte per character’ or ‘use 2 bytes per character’.

若已知每字符的位数,则先求出总位数,再除以8。大多数GCSE题目会明确要求“每字符使用1字节”或“每字符使用2字节”。

Example: A text containing 1500 characters encoded in ASCII (1 byte per character). File size = 1500 × 1 = 1500 bytes. If encoded in 16-bit Unicode, size = 1500 × 2 = 3000 bytes.

示例:某包含1500个字符的文本,采用ASCII编码(每字符1字节)。文件大小 = 1500 × 1 = 1500 字节。若采用16位Unicode编码,大小 = 1500 × 2 = 3000 字节。


5. Data Transfer Time | 数据传输时间

The time required to send a file over a network can be calculated when you know the file size and the transfer rate (bandwidth). Make sure both quantities are expressed in the same unit (bits or bytes) before carrying out the division.

若已知文件大小和传输速率(带宽),即可计算通过网络发送文件所需的时间。进行除法运算前,务必确保两者采用相同的单位(同为位或同为字节)。

Transfer Time (s) = File Size (bits) / Transfer Rate (bits per second)

If the file size is given in bytes and the rate in bits per second, convert one of them. A common mistake is to divide bytes directly by bits per second without multiplying by 8 first.

如果文件大小以字节为单位,而速率以位每秒为单位,则需要转换其中一个单位。常见错误是直接将字节数除以bps,而忘了先乘以8。

Example: Downloading a 200 MiB file with a connection speed of 50 Mbps (megabits per second). File size in bits = 200 × 1024 × 1024 × 8 = 1,677,721,600 bits. Rate = 50 × 1,000,000 = 50,000,000 bps (note: network speeds often use decimal millions, but check your specification; if binary prefixes are used, 50 Mbps would be 50 × 1024 × 1024 bps). Here we use 50 × 106. Time = 1,677,721,600 / 50,000,000 ≈ 33.6 seconds.

示例:以50 Mbps网速下载一个200 MiB的文件。文件大小(位) = 200 × 1024 × 1024 × 8 = 1,677,721,600 位。速率 = 50 × 1,000,000 = 50,000,000 bps(注意:网络速度常采用十进制的百万,请参照考试规范;若使用二进制前缀,50 Mbps指50 × 1024 × 1024 bps)。此处采用十进制。时间 ≈ 33.6 秒。


6. Compression Ratio | 压缩比

Compression reduces file size by removing redundancy. The compression ratio describes how much smaller the compressed file is compared to the original. It can be expressed as a ratio or as a percentage saving.

压缩通过消除冗余来减小文件体积。压缩比描述的是压缩后的文件相对于原始文件缩小的程度,可以用比值或节省百分比表示。

Compression Ratio = Uncompressed Size / Compressed Size

A ratio of 4:1 means the original file is four times larger than the compressed file. Another useful measure is the space saving percentage:

压缩比为4:1表示原始文件是压缩后文件的四倍大。另一个有用指标是空间节省百分比:

Saving (%) = ((Uncompressed Size – Compressed Size) / Uncompressed Size) × 100%

Example: Original size = 500 KB, compressed size = 125 KB. Ratio = 500 / 125 = 4:1. Saving = ((500 – 125) / 500) × 100 = 75%.

示例:原始大小 = 500 KB,压缩后大小 = 125 KB。压缩比 = 4:1。节省百分比 = 75%。

Lossless compression retains all original data; lossy compression permanently discards some information to achieve higher ratios.

无损压缩保留全部原始数据;有损压缩则永久丢弃部分信息以获得更高的压缩比。


7. Colour Depth and Number of Colours | 色彩深度与颜色数量

Colour depth (bit depth) determines how many distinct colours each pixel can represent. The relationship is exponential:

色彩深度(位深度)决定了每个像素可以表示多少种不同的颜色。两者呈指数关系:

Number of Colours = 2Colour Depth

Conversely, the number of bits required to represent N colours is the smallest integer b such that 2b ≥ N.

反之,要表示N种颜色,所需的最小位数b必须满足2b ≥ N。

Colour Depth (bits) Number of Colours Common Name
1 2 Monochrome
8 256 8-bit palette
16 65,536 High colour
24 16,777,216 True colour

This formula is also used when calculating file sizes for images: the colour depth appears as the multiplier for the total number of pixels.

该公式同样用于计算图像文件大小:色彩深度作为总像素数的乘数因子出现。


8. Number System Conversion Formulas | 数制转换公式

GCSE Computer Science requires you to convert between binary (base-2), denary (base-10), and hexadecimal (base-16). The general formula for converting any base-b number to denary is:

GCSE计算机科学要求掌握二进制(基2)、十进制(基10)和十六进制(基16)之间的转换。将任意基数为b的数转换为十进制的一般公式是:

Denary Value = Σ (digit × bposition)

where positions are numbered from 0 at the rightmost digit, increasing leftwards. For binary, b = 2; for hexadecimal, b = 16.

其中,位置编号从最右边的0开始,向左依次递增。对于二进制,b = 2;对于十六进制,b = 16。

Example: Binary 1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11₁₀.
Hex 2F₁₆ = 2×16¹ + 15×16⁰ = 32 + 15 = 47₁₀. (F = 15)

示例:二进制1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11₁₀。
十六进制2F₁₆ = 2×16¹ + 15×16⁰ = 32 + 15 = 47₁₀。(F = 15)

To convert denary into another base, repeatedly divide by the target base and collect the remainders in reverse order. Binary to hex conversion relies on grouping binary digits in nibbles (4 bits).

将十进制转换为其他进制时,需反复除以目标基数,并将余数逆序排列。二进制与十六进制之间的转换则依赖将二进制位每4位一组进行划分。


9. Sampling Rate, Bit Depth, and Bit Rate | 采样率、位深度与比特率

While the sound file size formula uses all components directly, some questions focus on the bit rate – the number of bits processed per second of audio. Bit rate is a product of sample rate, bit depth, and the number of channels.

尽管声音文件大小公式直接涵盖了所有组成部分,但有些题目会专门考查比特率——即每秒音频处理的位数。比特率是采样率、位深度和声道数量的乘积。

Bit Rate (bps) = Sample Rate (Hz) × Bit Depth × Number of Channels

Once you have the bit rate, the file size for a given duration is simply:

有了比特率后,指定时长的文件大小就等于:

File Size (bits) = Bit Rate (bps) × Duration (s)

This is often a more efficient approach if multiple audio clips with the same quality settings are being compared.

如果需要比较多个质量参数相同的音频片段,这种方法往往更加高效。


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

Boolean logic simplification can be performed using algebraic laws, which are particularly useful for reducing logic circuits. Two essential identities are De Morgan’s laws:

布尔逻辑简化可以利用代数定律来完成,这在精简逻辑电路时尤为有用。其中最重要的两个恒等式是德·摩根定律:

¬(A ∧ B) = ¬A ∨ ¬B
¬(A ∨ B) = ¬A ∧ ¬B

In exam notation, you may see overbars (e.g., A̅ for NOT A) or other symbols. These laws allow converting ANDs to ORs and vice versa when moving a NOT gate past a gate output.

在考试记法中,你可能会看到上划线(如A̅表示非A)或其他符号。利用这些定律,在把非门移到门电路的输出端时,可以实现与门和或门之间的相互转换。

Other useful laws include the distributive law: A ∧ (B ∨ C) = (A ∧ B) ∨ (A ∧ C), and the absorption law: A ∨ (A ∧ B) = A. Using these identities, complex expressions can be simplified, leading to fewer gates and reduced cost.

其他有用定律包括分配律:A ∧ (B ∨ C) = (A ∧ B) ∨ (A ∧ C),以及吸收律:A ∨ (A ∧ B) = A。运用这些恒等式可以化简复杂表达式,从而减少逻辑门数量、降低成本。


11. Parity Bit Calculation | 奇偶校验位计算

A parity bit is an extra bit added to a binary string to make the total number of 1s either even (even parity) or odd (odd parity). The value of the parity bit is determined by counting the 1s in the data bits.

奇偶校验位是一个附加在二进制串上的额外位,用以使所有位中1的总数为偶数(偶校验)或奇数(奇校验)。校验位的值由数据位中1的个数决定。

Even Parity Bit = (number of 1s in data) mod 2

If the count is already even, the even parity bit becomes 0; if odd, it becomes 1. For odd parity, invert the result:

若1的个数已经是偶数,则偶校验位为0;若为奇数,则校验位为1。对于奇校验,只需将结果取反:

Odd Parity Bit = NOT ((number of 1s) mod 2)

Example: Data = 1101 0110 (four 1s, even). Even parity bit = 0; the transmitted byte becomes 1101 0110 0. If the data were 1101 0111 (five 1s, odd), the even parity bit would be 1, giving 1101 0111 1.

示例:数据 = 1101 0110(4个1,偶数)。偶校验位 = 0;传输字节变为 1101 0110 0。若数据为1101 0111(5个1,奇数),偶校验位则为1,传输字节为1101 0111 1。

While parity bits detect single-bit errors, they cannot correct them and may fail if an even number of bits flip. More robust codes (e.g., Hamming codes) are used in higher-level studies.

奇偶校验位能检测出单比特错误,但无法纠正,且当偶数个比特发生翻转时可能失效。在更高阶的学习中会使用更可靠的编码(如汉明码)。

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

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