📚 A-Level Edexcel Computer Science: Calculation Practice | A-Level Edexcel 计算机:计算题专项训练
Calculation questions form a substantial part of Edexcel A-Level Computer Science papers, testing your ability to apply fundamental concepts to numerical problems. From binary arithmetic and data representation to network performance and algorithm complexity, these questions demand both conceptual clarity and careful step-by-step working. This article provides a targeted revision guide covering the most common calculation topics, with clear methods, worked examples, and dual-language explanations to strengthen your confidence and accuracy.
计算题在 Edexcel A-Level 计算机科学试卷中占有相当大的比重,考查你将基本概念应用于数值问题的能力。从二进制运算、数据表示到网络性能和算法复杂度,这类题目既需要清晰的概念理解,也需要严谨的分步演算。本文提供一份针对性的复习指南,涵盖最常见的计算专题,辅以明确的方法、配套例题和双语解析,帮助你提升信心与准确性。
1. Binary Arithmetic | 二进制算术运算
Binary addition and subtraction are foundational for understanding how the CPU performs arithmetic. The addition rules are simple: 0+0=0, 0+1=1, 1+0=1, and 1+1=0 with a carry of 1 to the next column. Always align the binary numbers by their least significant bits and work from right to left, just as in decimal addition.
二进制加法和减法是理解 CPU 如何执行算术运算的基础。加法规则很简单:0+0=0, 0+1=1, 1+0=1, 1+1=0 并向高位进 1。始终将二进制数按最低位对齐,像十进制加法一样从右向左逐列运算。
Example: Add 1011₂ (11₁₀) and 0110₂ (6₁₀). Write the numbers stacked: 1011 + 0110. Starting from the rightmost column, 1+0=1; next, 1+1=0 carry 1; third, 0+1+carry=0 carry 1; leftmost, 1+0+carry=0 carry 1. The result is 10001₂. Since we used 4-bit representation, the extra carry indicates an overflow. The correct 5-bit sum is 10001₂, which is 17₁₀.
示例:计算 1011₂(11₁₀)与 0110₂(6₁₀)的和。将两数上下对齐:1011 + 0110。从最右列开始,1+0=1;下一列,1+1=0 进 1;第三列,0+1+进位=0 进 1;最左列,1+0+进位=0 进 1。结果为 10001₂。如果使用 4 位表示,额外的进位表示溢出。正确的 5 位和为 10001₂,即 17₁₀。
Binary subtraction is typically performed using two’s complement addition. Instead of subtracting directly, negate the subtrahend by converting it to its two’s complement and then add. This method simplifies the arithmetic logic unit (ALU) design.
二进制减法通常利用补码加法来实现。无需直接相减,只需将被减数取补码后与被减数相加。该方法简化了算术逻辑单元 (ALU) 的设计。
Example: Compute 7₁₀ – 3₁₀ using 4-bit two’s complement. 7 is 0111₂, 3 is 0011₂. Two’s complement of 3: invert bits to 1100₂, then add 1 → 1101₂. Add 0111₂ + 1101₂ = 10100₂. Discard the overflow carry-out, leaving 0100₂, which is 4₁₀. Thus 7 – 3 = 4.
示例:使用 4 位补码计算 7₁₀ – 3₁₀。7 为 0111₂,3 为 0011₂。3 的补码:按位取反得 1100₂,再加 1 得 1101₂。计算 0111₂ + 1101₂ = 10100₂。舍弃超出位的进位,得到 0100₂,即 4₁₀。因此 7 – 3 = 4。
2. Two’s Complement Representation | 补码表示
Two’s complement is the most common method for representing signed integers in binary. The most significant bit (MSB) acts as the sign bit: 0 for positive, 1 for negative. To obtain the two’s complement of a number, invert all bits and add 1. For a given n-bit representation, the range of values is −2ⁿ⁻¹ to 2ⁿ⁻¹−1.
补码是表示有符号整数最常用的二进制方法。最高有效位 (MSB) 作为符号位:0 表示正数,1 表示负数。求一个数的补码时,将所有位取反后加 1。对于给定的 n 位表示,数值范围为 −2ⁿ⁻¹ 到 2ⁿ⁻¹−1。
Example using 8 bits: find the representation of −25₁₀. Positive 25 is 00011001₂. Invert bits → 11100110₂. Add 1 → 11100111₂. This is the 8-bit two’s complement representation of −25. To convert back, apply two’s complement again: invert to 00011000, add 1 → 00011001₂ = 25, confirming the value.
以 8 位为例:求 −25₁₀ 的表示。正数 25 为 00011001₂。按位取反 → 11100110₂。加 1 → 11100111₂。这就是 −25 的 8 位补码表示。若要转换回去,再次取补码:取反得 00011000,加 1 → 00011001₂ = 25,验证无误。
When adding two’s complement numbers, any carry beyond the MSB is ignored. Overflow occurs only when the sum of two positive numbers yields a negative result or the sum of two negative numbers yields a positive result, which can be detected by examining the carry into and out of the sign bit.
两个补码数相加时,超出 MSB 的进位被忽略。仅当两个正数之和得出负数结果,或两个负数之和得出正数结果时,才发生溢出;溢出可以通过检查进入和离开符号位的进位来判断。
3. Floating Point Binary | 浮点数二进制表示
Floating point representation allows a trade-off between range and precision. In Edexcel A-Level, a common format is a given mantissa and exponent. For example, an 8-bit representation with 1 sign bit, 3-bit exponent (excess-3) and 4-bit mantissa. The value is computed as: (−1)^S × 0.M × 2^(E−3), where M is the mantissa bits and E is the exponent value in denary.
浮点表示允许在范围和精度之间进行权衡。在 Edexcel A-Level 考试中,常见格式是指定尾数和指数。例如,8 位表示包含 1 位符号位、3 位阶码(移码,偏移量为 3)和 4 位尾数。数值计算公式为:(−1)^S × 0.M × 2^(E−3),其中 M 是尾数位,E 是指数位的十进制值。
Example: Interpret the 8-bit floating point number 01011011₂. Split as sign=0, exponent=101₂=5, mantissa=1011. Subtract the excess: exponent = 5 − 3 = 2. The mantissa is normalised as 0.1011₂. Convert to denary: 0.1011₂ = ½ + ⅛ + ¹⁄₁₆ = 0.5 + 0.125 + 0.0625 = 0.6875. Multiply by 2^2 = 4, giving 2.75. The number is positive, so the value is +2.75₁₀.
示例:解释 8 位浮点数 01011011₂。划分:符号位=0,阶码=101₂=5,尾数=1011。减去偏移量:指数 = 5 − 3 = 2。尾数规格化为 0.1011₂。转换为十进制:0.1011₂ = ½ + ⅛ + ¹⁄₁₆ = 0.5 + 0.125 + 0.0625 = 0.6875。乘以 2^2=4,得到 2.75。符号为正,因此数值为 +2.75₁₀。
Conversely, to represent 3.25 in this 8-bit format: 3.25 = 11.01₂. Normalise to 0.1101 × 2^2. Exponent becomes 2 + 3 = 5 = 101₂. The sign is 0, mantissa first four bits 1101. The full word is 0 101 1101 → 01011101₂.
反过来,用上述 8 位格式表示 3.25:3.25 = 11.01₂。规格化得 0.1101 × 2^2。指数为 2 + 3 = 5 = 101₂。符号位 0,尾数取前四位 1101。完整字为 0 101 1101 → 01011101₂。
4. Logic Gates and Boolean Expressions | 逻辑门与布尔表达式
Logic gate calculations require you to derive Boolean expressions from circuit diagrams, complete truth tables, and simplify expressions using Boolean algebra or Karnaugh maps. The basic gates are AND, OR, NOT, NAND, NOR, XOR, and XNOR, each with a defined truth table.
逻辑门计算要求你从电路图推导布尔表达式、填写真值表,并利用布尔代数或卡诺图化简表达式。基本门电路包括与门、或门、非门、与非门、或非门、异或门和同或门,每种都有确定的真值表。
Example: Consider a circuit with inputs A, B, C where the output Q = (A AND B) OR (NOT C). Build the truth table with all 8 combinations. For A=0,B=0,C=0: A AND B=0, NOT C=1, Q=0+1=1. Continue to complete the table. The expression can be simplified by applying Boolean identities if possible; in this case it is already minimal.
示例:某电路输入为 A、B、C,输出 Q = (A AND B) OR (NOT C)。列出 8 种组合的真值表。当 A=0,B=0,C=0 时:A AND B=0,NOT C=1,Q=0+1=1。继续填充表格。该表达式可利用布尔恒等式尝试化简;在此例中已是最简形式。
| A | B | C | A AND B | NOT C | Q |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 |
To simplify using Boolean algebra, you can apply De Morgan’s laws, distribution, and absorption. For instance, the expression (A.B) + C’ could be left as is, but if you need to implement with only NAND gates, you would transform the expression accordingly using double negation and De Morgan.
若要用布尔代数化简,可应用德摩根定律、分配律和吸收律。例如表达式 (A·B)+C’ 已足够简洁,但如果要求仅用与非门实现,则需通过双重否定和德摩根定律进行相应变换。
5. Image File Size Calculation | 图像文件大小计算
Bitmap image file size depends on the resolution (width × height) and colour depth (bits per pixel). The basic formula is: file size (in bits) = width × height × colour depth. Convert to bytes by dividing by 8, and to kilobytes, megabytes as needed. Do not forget to account for metadata, but in exam problems only pixel data is typically required.
位图图像的文件大小取决于分辨率(宽度 × 高度)和位深度(每像素位数)。基本公式为:文件大小(比特)= 宽度 × 高度 × 位深度。除以 8 转换为字节,再根据需要转换为千字节、兆字节。考试题目通常只要求计算像素数据部分,无需考虑元数据。
Example: A 1920×1080 image with 24-bit colour depth. Number of pixels = 1920 × 1080 = 2,073,600 pixels. Total bits = 2,073,600 × 24 = 49,766,400 bits. In bytes: 49,766,400 / 8 = 6,220,800 bytes. In megabytes: 6,220,800 / (1024 × 1024) ≈ 5.93 MB. This is a common full HD uncompressed image size.
示例:一张 1920×1080、24 位真彩色的图像。像素总数 = 1920 × 1080 = 2,073,600 像素。总比特数 = 2,073,600 × 24 = 49,766,400 比特。换算字节:49,766,400 / 8 = 6,220,800 字节。换算为兆字节:6,220,800 / (1024 × 1024) ≈ 5.93 MB。这是常见的全高清未压缩图像大小。
If the image uses a reduced palette, e.g., 256 colours, the colour depth is log₂(256) = 8 bits per pixel. Then the same resolution gives a file size of 2,073,600 × 8 = 16,588,800 bits, i.e., about 1.98 MB. Always check whether the question gives bits or bytes.
如果图像使用缩减调色板,例如 256 色,位深度为 log₂(256) = 8 位每像素。相同分辨率下,文件大小为 2,073,600 × 8 = 16,588,800 比特,约 1.98 MB。务必留意题目给出的单位是比特还是字节。
6. Sound File Size Calculation | 声音文件大小计算
Uncompressed sound file size is calculated from sampling rate, sample resolution (bit depth), number of channels, and duration. The formula: file size (bits) = sample rate × bit depth × channels × time in seconds. Typical CD quality is 44.1 kHz, 16-bit stereo.
未压缩音频文件大小由采样率、采样精度(位深度)、声道数和时长决定。公式为:文件大小(比特)= 采样率 × 位深度 × 声道数 × 时间(秒)。典型的 CD 质量参数为 44.1 kHz、16 位立体声。
Example: Calculate the size of 3 minutes of stereo audio at 44.1 kHz, 16-bit. Duration = 3 × 60 = 180 s. Bits = 44,100 × 16 × 2 × 180 = 44,100 × 16 × 360 = 44,100 × 5760 = 254,016,000 bits. In megabytes: 254,016,000 / (8 × 1024 × 1024) ≈ 30.28 MB. This explains why a 3-minute uncompressed WAV file is around 30 MB.
示例:计算 3 分钟立体声、44.1 kHz、16 位的音频文件大小。时长 = 3 × 60 = 180 秒。比特数 = 44,100 × 16 × 2 × 180 = 44,100 × 16 × 360 = 44,100 × 5760 = 254,016,000 比特。换算兆字节:254,016,000 / (8 × 1024 × 1024) ≈ 30.28 MB。这说明一首 3 分钟未压缩 WAV 文件大小约为 30 MB。
If the question asks for file size in kilobits per second (kbps), you can compute the bit rate directly: 44,100 × 16 × 2 = 1,411,200 bps ≈ 1411 kbps. This bit rate is the standard for CD audio.
若题目要求以每秒千比特 (kbps) 表示,可直接计算比特率:44,100 × 16 × 2 = 1,411,200 bps ≈ 1411 kbps。该比特率即 CD 音质的标准值。
7. Data Transfer Time | 数据传输时间
Transfer time calculations involve file size and network bandwidth or storage transfer rates. The fundamental relationship is: time (s) = data size (bits) / transfer rate (bps). Ensure consistent units: convert all sizes to bits and rates to bits per second. Pay attention to whether the rate is given in Mbps (megabits per second) or MBps (megabytes per second).
传输时间计算涉及文件大小和网络带宽或存储传输速率。基本关系为:时间(秒)= 数据量(比特)/ 传输速率(bps)。注意单位一致:将文件大小统一为比特,速率统一为比特每秒。留意题目给出的速率是 Mbps(兆比特每秒)还是 MBps(兆字节每秒)。
Example: A 100 MB file is to be downloaded over a 50 Mbps connection. First, convert file size to bits: 100 MB = 100 × 1024 × 1024 × 8 bits = 838,860,800 bits. Bandwidth in bps: 50 Mbps = 50 × 1,000,000 bps = 50,000,000 bps. Time = 838,860,800 / 50,000,000 ≈ 16.78 seconds. In practice, protocol overheads increase the time, but the theoretical minimum is about 16.8 s.
示例:通过 50 Mbps 连接下载一个 100 MB 文件。先将文件大小转换为比特:100 MB = 100 × 1024 × 1024 × 8 = 838,860,800 比特。带宽转换为 bps:50 Mbps = 50 × 1,000,000 = 50,000,000 bps。时间 = 838,860,800 / 50,000,000 ≈ 16.78 秒。实际中协议开销会增加时间,但理论最短时间约为 16.8 秒。
Alternatively, if the connection is 12.5 MBps (megabytes per second), time = 100 MB / 12.5 MBps = 8 seconds. Always double-check whether the ‘M’ follows binary (1024²) or decimal (1000²) convention as specified in the exam question.
另外,若连接速率为 12.5 MBps(兆字节每秒),时间 = 100 MB / 12.5 MBps = 8 秒。务必根据题目要求确认“M”采用二进制(1024²)还是十进制(1000²)换算约定。
8. Compression Ratio | 压缩比
Compression ratio expresses how much a file size has been reduced by a compression algorithm. It is defined as: compression ratio = original size / compressed size. A ratio of 4:1 means the compressed file is one quarter of the original. You may also encounter space saving percentage = (1 – 1/ratio) × 100%.
压缩比表示文件经压缩算法后体积缩减的程度,定义为:压缩比 = 原始大小 / 压缩后大小。比值为 4:1 表示压缩后文件仅为原始大小的四分之一。有时也会遇到空间节省百分比 = (1 – 1/压缩比) × 100% 的表述。
Example: An uncompressed image is 31,457,280 bytes. After lossless compression, the file becomes 7,864,320 bytes. The compression ratio = 31,457,280 / 7,864,320 = 4:1. Space saving = (1 – 1/4) × 100% = 75%. This is a typical performance for formats like PNG on simple graphics.
示例:一张
Published by TutorHao | A-Level Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导