📚 A-Level CIE Computer Science: Calculation Practice | A-Level CIE 计算机:计算题专项训练
Mastering calculation-based questions is essential for success in CIE A-Level Computer Science. This guide covers the most common types of numerical problems, from number bases to processor performance, with step-by-step examples designed to build both speed and accuracy. Each section presents a key topic with English explanations immediately followed by Chinese equivalents, ensuring dual-language learners can confidently tackle exam questions.
掌握计算类题目是攻克 CIE A-Level 计算机科学的关键。本专项训练覆盖了从数制转换到处理器性能的最常见计算题型,配合分步范例,旨在同时提升解题速度和准确性。每个小节以英文讲解开头、中文解释紧随其后,确保双语学习者都能自信应对考试中的计算题。
1. Number Systems & Conversions | 数制与转换
Number systems form the foundation of all computer arithmetic. You must be able to convert seamlessly between binary (base 2), decimal (base 10), and hexadecimal (base 16). The method for binary-to-decimal uses positional weights: each binary digit (bit) is multiplied by 2 raised to the power of its position, starting from 0 on the right. For example, 1101.01₂ = 1×2³ + 1×2² + 0×2¹ + 1×2⁰ + 0×2⁻¹ + 1×2⁻² = 8+4+0+1+0+0.25 = 13.25₁₀. Decimal-to-binary requires repeated division by 2 for the integer part and repeated multiplication by 2 for the fractional part, collecting remainders and whole number parts respectively. Hexadecimal conversions group bits in fours, since each hex digit represents exactly 4 bits. 11011110₂ becomes 1101 1110 → D E₁₆.
数制是所有计算机算术的基础。你必须能够在二进制(基2)、十进制(基10)和十六进制(基16)之间无缝转换。二进制转十进制使用位权法:每个二进制位乘以 2 的位幂,从右起幂次为 0。例如 1101.01₂ = 1×2³ + 1×2² + 0×2¹ + 1×2⁰ + 0×2⁻¹ + 1×2⁻² = 8+4+0+1+0+0.25 = 13.25₁₀。十进制转二进制则需要对整数部分反复除以 2 取余数,对小数部分反复乘 2 取整。十六进制转换则每 4 个二进制位为一组,因为每个十六进制数码恰好代表 4 位。11011110₂ 分组为 1101 1110 → D E₁₆。
2. Binary Arithmetic & Overflow | 二进制算术与溢出
Binary addition follows simple rules: 0+0=0, 0+1=1, 1+0=1, 1+1=0 with a carry of 1 to the next column. Subtraction is typically performed using two’s complement. To subtract B from A, find the two’s complement of B (invert bits and add 1) and then add it to A. For an 8-bit system, 5 − 3 becomes 00000101 + (11111101) = 00000010, which is 2. Overflow occurs when the result of an operation exceeds the representable range for a given number of bits. In signed two’s complement, overflow can be detected when the carry into the sign bit differs from the carry out of the sign bit. For example, 01111111 (127) + 00000001 (1) in 8-bit produces 10000000, which is −128, an overflow since two positive numbers gave a negative result.
二进制加法遵循简单规则:0+0=0、0+1=1、1+0=1、1+1=0 并向高位进 1。减法通常用补码实现。要从 A 减去 B,先求 B 的补码(按位取反再加 1),然后与 A 相加。在 8 位系统中,5 − 3 表达为 00000101 + (11111101) = 00000010,即 2。当运算结果超出指定位数可表示的范围时发生溢出。在有符号补码中,当进入符号位的进位与离开符号位的进位不同时可检测到溢出。例如,8 位下 01111111 (127) + 00000001 (1) 得出 10000000,即 −128,由于两个正数相加得到负数,因此发生溢出。
3. Floating-point Representation | 浮点数表示
CIE requires understanding of binary floating-point representation, often in a simplified single-precision format: sign bit (1 bit), exponent (e.g., 8 bits) in excess-127 notation, and mantissa (23 bits) with the leading 1 implicit. To convert a decimal like 13.25, first write it in binary: 1101.01. Normalise to 1.10101 × 2³. The sign bit is 0. The exponent is 3 + 127 = 130 → 10000010. The mantissa is the fractional part after the 1: 10101000… padded with zeros to 23 bits. The complete 32-bit pattern is 0 10000010 10101000000000000000000. Conversely, given a bit pattern, extract sign, exponent and mantissa, subtract the bias, and reconstruct the value.
CIE 要求理解二进制浮点表示,常采用简化单精度格式:符号位(1 位)、指数位(例如 8 位)采用移 127 码,尾数(23 位)隐含前导 1。要将十进制数 13.25 转换,先写为二进制 1101.01,规格化为 1.10101 × 2³。符号位为 0。指数为 3 + 127 = 130 → 10000010。尾数取小数点后的部分 10101000… 用零补足 23 位。完整的 32 位模式为 0 10000010 10101000000000000000000。反向转换时,提取符号、指数和尾数,减去偏置量,再重构数值。
4. Logic Gates & Truth Tables | 逻辑门与真值表
Calculation problems often require completing a truth table and deriving a Boolean expression from a given logic circuit. Fundamental gates are AND (A∧B), OR (A∨B), NOT (¬A), NAND, NOR, XOR (A⊕B). When multiple gates are combined, label intermediate outputs and evaluate each column. For example, if X = ¬A, Y = B∧C, output Z = X∨Y, build a truth table with columns A,B,C,X,Y,Z. From the truth table, you can then write the sum-of-products expression by summing the minterms where Z=1. Circuit simplification using Boolean algebra or Karnaugh maps is a further step.
计算题常要求补全真值表并根据给定逻辑电路推导布尔表达式。基本门有与门 (A∧B)、或门 (A∨B)、非门 (¬A)、与非、或非、异或 (A⊕B)。多个门组合时,标记中间输出并逐列求值。例如,若 X = ¬A,Y = B∧C,输出 Z = X∨Y,则构建包含 A,B,C,X,Y,Z 的真值表。从真值表可以写出积之和表达式,即将 Z=1 的最小项相加。之后再利用布尔代数或卡诺图进行化简。
5. Karnaugh Maps & Simplification | 卡诺图与化简
A Karnaugh map (K-map) provides a visual method to minimise Boolean expressions for 2, 3, or 4 variables. Arrange cells so that adjacent cells differ by only one variable (Gray code order). Populate the map with 1s from the truth table. Group adjacent 1s in rectangles of sizes that are powers of two (1,2,4,8). Each group must be as large as possible and groups can wrap around edges. Each group yields a product term where variables that change within the group are eliminated. For a 3-variable map with minterms at positions 1,3,4,7 (A,B,C order), groups can be formed: one covering 1 and 3 (A’C) and another covering 4 and 7 or 3 and 7 depending on arrangement. The minimised expression is the sum of the essential prime implicants.
卡诺图为 2、3、4 变量的布尔表达式提供了直观的化简方法。单元排列使得相邻单元只有一个变量不同(格雷码顺序)。将真值表中的 1 填入图中。用大小为 2 的幂次(1、2、4、8)的矩形圈出相邻的 1。每个圈必须尽可能大,且可跨边环绕。每个圈生成一个乘积项,圈内发生变化的变量被消去。对于位置在 1、3、4、7(A,B,C 顺序)的 3 变量卡诺图,可以圈出 (1,3) 得 A’C,以及另一组覆盖 …,最终化简表达式为各必要质蕴含项之和。
6. Processor Performance | 处理器性能
Performance calculations involve clock frequency (f), clock cycle time (T), Cycles Per Instruction (CPI), instruction count (IC), and execution time. The fundamental equation is Execution Time = IC × CPI × T. Since T = 1/f, it can also be written as Execution Time = (IC × CPI) / f. For example, a program with 2 million instructions, average CPI of 1.5, running on a 3 GHz processor takes (2×10⁶ × 1.5) / (3×10⁹) = 0.001 seconds = 1 ms. Questions may ask you to compare two processors or calculate the required clock rate to meet a deadline, requiring careful unit conversion (Hz, KHz, MHz, GHz).
处理器性能计算涉及时钟频率 (f)、时钟周期时间 (T)、每条指令周期数 (CPI)、指令数 (IC) 和执行时间。基本公式为 执行时间 = IC × CPI × T。由于 T = 1/f,也可写作 执行时间 = (IC × CPI) / f。例如,一个包含 200 万条指令、平均 CPI 为 1.5 的程序在 3 GHz 处理器上运行,耗时 (2×10⁶ × 1.5) / (3×10⁹) = 0.001 秒 = 1 毫秒。题目可能要求比较两个处理器或计算满足截止时间所需的时钟速率,此时须注意单位换算(Hz、KHz、MHz、GHz)。
7. Memory & Storage Calculations | 内存与存储计算
Address bus width determines the number of addressable memory locations. With n address lines, the CPU can uniquely address 2ⁿ locations. If the data bus is m bits wide, the total memory size is 2ⁿ × m bits, often expressed in bytes (divide by 8). A 16-bit address bus and 8-bit data bus gives 2¹⁶ = 65536 locations of 1 byte each, i.e., 64 KiB. Modern systems use word–addressable memory or byte–addressable memory; read the question carefully. Storage calculations often involve file size: image size (pixels) × colour depth (bits), uncompressed audio: sample rate × bit depth × channels × duration. Always express final answers in appropriate units (KB, MB, KiB, MiB) as specified by CIE mark schemes.
地址总线宽度决定了可寻址的存储单元数量。n 条地址线可唯一寻址 2ⁿ 个单元。若数据总线宽 m 位,总存储容量为 2ⁿ × m 位,常以字节表示(除以 8)。16 位地址总线和 8 位数据总线可产生 2¹⁶ = 65536 个 1 字节单元,即 64 KiB。现代系统可能采用字编址或字节编址;审题时须仔细。存储计算常涉及文件大小:图像尺寸(像素)× 颜色深度(位),无压缩音频:采样率 × 位深度 × 声道数 × 时长。最终答案务必按 CIE 评分标准转换为适当单位(KB、MB、KiB、MiB)。
8. Data Transmission & Timings | 数据传输与定时
Transmission time can be calculated using: Time = Amount of data / Bandwidth. Make sure the units match (bits, bytes, bps, Bps). Serial transmission sends one bit at a time; parallel sends multiple bits simultaneously. A 10 MiB file transferred over a 100 Mbps serial link takes: (10 × 1024 × 1024 × 8 bits) / (100 × 10⁶ bps) ≈ 0.839 seconds. Overhead such as start/stop bits and parity bits in asynchronous serial communication must be added. For instance, sending 1000 ASCII characters with 1 start bit, 8 data bits, 1 parity bit, and 2 stop bits requires 12 bits per character, so total bits = 12000. At 9600 bps, time = 12000/9600 = 1.25 seconds.
传输时间可由公式 时间 = 数据量 / 带宽 计算。务必使单位一致(位、字节、bps、Bps)。串行传输逐位发送;并行传输同时发送多位。一个 10 MiB 的文件通过 100 Mbps 串行链路传输耗时:(10 × 1024 × 1024 × 8 位) / (100 × 10⁶ bps) ≈ 0.839 秒。异步串行通信中的额外开销(起始位、停止位、校验位)需计入。例如,发送 1000 个 ASCII 字符,每个字符需要 1 起始位、8 数据位、1 校验位和 2 停止位,共每字符 12 位,总位数 12000。在 9600 bps 下,耗时 12000/9600 = 1.25 秒。
9. Error Detection | 差错检测
Common calculation-based error detection includes parity checks, checksums, and cyclic redundancy checks (CRC). For even parity, count the number of 1s; if odd, set parity bit to 1 to make the total even. For a byte 1011001, there are four 1s, so even parity bit is 0. Checksums add up data units (often bytes) in a modulo-256 or modulo-65536 sum, then send the sum or its complement. CRC uses binary polynomial division. Given a generator polynomial like x³+x+1 (bits 1011), you append n zeros (where n is degree of polynomial) to data, divide modulo-2, and append the remainder. The receiver divides by the same generator; a non-zero remainder indicates an error.
常见计算类差错检测包括奇偶校验、校验和与循环冗余校验 (CRC)。偶校验时,统计 1 的个数;若为奇数,则置校验位为 1 使总数为偶。字节 1011001 有 4 个 1,故偶校验位为 0。校验和将数据单元(常为字节)在模 256 或模 65536 下相加,发送和或和的补码。CRC 使用二进制多项式除法。给定生成多项式如 x³+x+1(位串 1011),先在数据后追加 n 个零(n 为多项式次数),模 2 除法后附加余数。接收方除以同一生成多项式,余数非零即表示出错。
10. Boolean Algebra Simplification | 布尔代数化简
Boolean algebra uses laws such as identity, complement, idempotent, commutative, associative, distributive, absorption, and De Morgan’s theorems to simplify expressions. For example, simplify A·B + A·B’. By distributive law: A·(B+B’) = A·1 = A. Another common reduction: A + A·B = A·(1+B) = A. De Morgan’s theorems transform complements: (A·B)’ = A’ + B’ and (A+B)’ = A’·B’. When simplifying, break complex expressions stepwise and show each law applied. CIE questions may ask for simplification down to a given number of literals or gates, so practising pattern recognition is vital.
布尔代数利用同一律、互补律、幂等律、交换律、结合律、分配律、吸收律和德摩根定理来化简表达式。例如,化简 A·B + A·B’。由分配律:A·(B+B’) = A·1 = A。另一个常见归约:A + A·B = A·(1+B) = A。德摩根定理转换补运算:(A·B)’ = A’ + B’ 以及 (A+B)’ = A’·B’。化简时应逐步分解复杂表达式,并标明所用的每条定律。CIE 题目可能要求化简至给定数量的字面量或门数,因此练习模式识别至关重要。
11. Floating-point Precision & Errors | 浮点精度与误差
Floating-point representations have limited precision, leading to rounding errors. Absolute error is the difference between the represented value and the actual value: |V_represented − V_actual|. Relative error is absolute error divided by the actual value. When converting a decimal fraction to binary, if the fraction cannot be represented exactly in the given mantissa bits, truncation or rounding must occur, causing loss of precision. For instance, 0.1₁₀ in binary is an infinite repeating fraction 0.0001100110011…, so in a 23-bit mantissa it gets rounded, introducing an error. Exam questions may ask you to calculate the stored value and then find the absolute error.
浮点表示的精度有限,会产生舍入误差。绝对误差是表示值与实际值之差的绝对值:|V_表示 − V_实际|。相对误差是绝对误差除以实际值。将十进制小数转换为二进制时,若该小数无法在给定的尾数位中精确表示,就需截断或舍入,造成精度损失。例如,0.1₁₀ 在二进制中是无限循环小数 0.0001100110011…,因此在 23 位尾数中会被舍入而引入误差。考题可能要求计算存储值并求出绝对误差。
12. Sample Exam Questions | 典型考题示例
This final section integrates several skills. A typical question: A processor has a 2.5 GHz clock, program of 3×10⁶ instructions, CPI 0.8. Calculate execution time. Another: A colour image is 1024×768 pixels, 24-bit colour. Calculate the uncompressed file size in MiB. A third: Using an 8-bit two’s complement representation, perform 48 − 100 and determine if overflow occurs. Work through each step: convert to binary, find two’s complement of subtrahend, add, check overflow flag. Providing full working is essential for CIE examination marks. Always note units and present final answers clearly in the requested format.
最后这节综合多项技能。典型考题:某处理器时钟频率 2.5 GHz,程序包含 3×10⁶ 条指令,CPI 为 0.8,计算执行时间。另一题:一幅 1024×768 像素、24 位色的图像,求无压缩文件大小(单位 MiB)。第三题:用 8 位补码计算 48 − 100,并判断是否溢出。按步骤操作:转为二进制、求减数补码、相加、检查溢出标志。给出完整计算过程对 CIE 考试得分至关重要。务必注意单位,并按要求格式清晰给出最终答案。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导