📚 A-Level AQA Computer Science: Intensive Calculation Practice | A-Level AQA 计算机科学:计算题专项训练
Calculation questions form a core part of the AQA A-Level Computer Science examination, appearing across topics such as data representation, Boolean logic, data transmission and algorithm analysis. Mastering these calculations is essential for achieving top marks, as they test your ability to apply theoretical knowledge to numerical problems under timed conditions. This article provides a focused collection of worked examples and explanations for the most common calculation-based topics in Papers 1 and 2.
计算题是AQA A-Level计算机科学考试的核心组成部分,涵盖数据表示、布尔逻辑、数据传输和算法分析等主题。掌握这些计算对于取得高分至关重要,因为它们考察你在限时条件下将理论知识应用于数值问题的能力。本文针对试卷一和试卷二中最常见的计算题型,提供了一组集中的示例和解析。
1. Binary to Decimal Conversion | 二进制转十进制
Every binary digit (bit) carries a weight based on powers of two, starting from 2⁰ on the right. To convert an unsigned binary integer to decimal, sum the products of each bit and its positional weight.
每个二进制位根据2的幂次赋予权重,从最右侧的2⁰开始。要将无符号二进制整数转换为十进制,将每个位与其位权相乘后求和。
Example: Convert 1101011₂ to decimal.
1×2⁶ + 1×2⁵ + 0×2⁴ + 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 64 + 32 + 0 + 8 + 0 + 2 + 1 = 107.
示例:将二进制数1101011₂转为十进制。
1×2⁶ + 1×2⁵ + 0×2⁴ + 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 64 + 32 + 0 + 8 + 0 + 2 + 1 = 107。
For fractional binary numbers, bits beyond the radix point have weights 2⁻¹, 2⁻², etc. For instance, 10.101₂ = 1×2¹ + 0×2⁰ + 1×2⁻¹ + 0×2⁻² + 1×2⁻³ = 2 + 0.5 + 0.125 = 2.625.
对于带小数的二进制,小数点后的位权为2⁻¹、2⁻²等。例如,10.101₂ = 1×2¹ + 0×2⁰ + 1×2⁻¹ + 0×2⁻² + 1×2⁻³ = 2 + 0.5 + 0.125 = 2.625。
2. Hexadecimal and Binary Conversion | 十六进制与二进制转换
Hexadecimal provides a compact way to represent binary groups. One hex digit stands for a 4-bit nibble. To convert binary to hex, partition the binary string into groups of four bits from the right, then replace each group with the equivalent hex symbol (0–9, A–F).
十六进制为紧凑表示二进制分组提供了一种方式。一位十六进制代表一个4位半字节。将二进制转为十六进制时,从右侧开始每四位分组,然后用对应的十六进制符号(0–9, A–F)替换每组。
Example: Convert 110111100101₂ to hex.
Group as 1101 1110 0101 (padding two leading zeros for the leftmost group if needed).
1101₂ = D, 1110₂ = E, 0101₂ = 5 → Result: DE5₁₆.
示例:将二进制110111100101₂转为十六进制。
分组为 1101 1110 0101(若最左组不足四位需补零)。
1101₂ = D,1110₂ = E,0101₂ = 5 → 结果:DE5₁₆。
The reverse process takes each hex digit and expands it to exactly four bits. A7₁₆ becomes 1010 0111₂. This conversion is frequently needed in memory addressing and colour code problems.
反向过程将每个十六进制数字扩展为恰好四位二进制。A7₁₆ 变为 1010 0111₂。这种转换常用于内存寻址和颜色编码问题。
3. Two’s Complement Representation and Arithmetic | 补码表示与运算
In AQA Computer Science, two’s complement is the standard method for representing signed integers. An n-bit two’s complement number has a range of –2ⁿ⁻¹ to 2ⁿ⁻¹ – 1. The most significant bit acts as the sign bit (1 for negative, 0 for positive).
在AQA计算机科学中,补码是表示有符号整数的标准方法。一个n位补码数的范围是–2ⁿ⁻¹ 至 2ⁿ⁻¹ – 1。最高位作为符号位(1表示负,0表示正)。
To obtain the negative representation of an integer, start with the positive binary magnitude, flip all bits, and add 1. For –23 in 8 bits: 23₁₀ = 00010111₂ → flip → 11101000 → add 1 → 11101001.
要得到整数的负数表示,从正数二进制原码开始,所有位取反后加1。以8位–23为例:23₁₀ = 00010111₂ → 取反 → 11101000 → 加1 → 11101001。
Addition works as usual; the result will wrap around if overflow occurs. Add 11010110 (–42) and 00011001 (25).
11010110
+ 00011001
= 11101111 (which represents –17). The carry out of the sign bit is ignored in two’s complement arithmetic.
加法按正常规则进行;发生溢出时结果会环绕。计算11010110(–42)与00011001(25)相加。
11010110
+ 00011001
= 11101111(表示–17)。补码运算中忽略符号位的进位输出。
4. Floating Point Representation (Mantissa and Exponent) | 浮点数表示(尾数与阶码)
AQA defines floating point using a mantissa in two’s complement and an exponent in two’s complement. A typical 12-bit format might use an 8-bit mantissa followed by a 4-bit exponent. The value is mantissa × 2exponent. You need to shift the binary point in the mantissa right (for positive exponent) or left (for negative exponent).
AQA定义浮点数使用补码表示尾数和补码表示阶码。一个典型的12位格式可能使用8位尾数后跟4位阶码。其值为 尾数 × 2阶码。你需要根据阶码将尾数的二进制小数点右移(正阶码)或左移(负阶码)。
Example: A 12-bit register stores mantissa 10110000 and exponent 0011. Mantissa is in two’s complement: the leading bit is 1, so it is negative. Invert and add 1: 01010000? Actually, to find its decimal value we first treat it as a fixed-point fraction. The implied binary point is after the sign bit: 1.0110000. Since the sign bit is 1, this number is –(0.1010000₂) = –(0.5 + 0.125) = –0.625. Exponent 0011₂ = 3. Multiply mantissa by 2³: –0.625 × 8 = –5.0.
示例:一个12位寄存器存储尾数10110000和阶码0011。尾数为补码:首位为1,故为负数。取反加1得到正数幅值0.1010000?实际上,先将其视为定点小数。隐含的小数点在符号位之后:1.0110000。因为符号位为1,数值为 –(0.1010000₂) = –(0.5 + 0.125) = –0.625。阶码0011₂ = 3。尾数乘以2³:–0.625 × 8 = –5.0。
Normalisation is required to maximise precision. A positive mantissa must start with 0.1 and a negative mantissa with 1.0. You may need to adjust the exponent accordingly after shifting the mantissa.
为提高精度,浮点数需要规格化。正尾数必须以0.1开头,负尾数以1.0开头。你可能需要相应调整尾数和阶码。
5. Bitmap Image Size Calculations | 位图图像大小计算
The size in bytes of an uncompressed bitmap image is determined by (width × height × colour depth) / 8, where colour depth is the number of bits per pixel. Common depths are 1 bit (monochrome), 8 bits (256 colours), and 24 bits (true colour).
未压缩位图图像的文件大小(字节)由(宽度×高度×颜色深度)/ 8决定,其中颜色深度是每像素的位数。常见的深度有1位(单色)、8位(256色)和24位(真彩色)。
Example: An 800×600 image uses 24-bit colour. Compute its raw size.
Total bits = 800 × 600 × 24 = 11,520,000 bits.
Bytes = 11,520,000 / 8 = 1,440,000 bytes, which is about 1.44 MB (using 1 MB = 10⁶ bytes).
示例:一张800×600的图像使用24位颜色。计算其原始大小。
总位数 = 800 × 600 × 24 = 11,520,000 位。
字节数 = 11,520,000 / 8 = 1,440,000 字节,约1.44 MB(按1 MB = 10⁶ 字节)。
In exam questions, you may also need to account for metadata or file headers, but the core calculation focuses on pixel data. Remember to state units clearly and convert bits to bytes by dividing by 8.
在考试问题中,你可能还需要考虑元数据或文件头,但核心计算针对像素数据。记得清楚标明单位,并通过除以8将位转换为字节。
6. Sound Sampling Calculations | 声音采样计算
Audio file size depends on sample rate (Hz), bit depth, number of channels, and duration. Use the formula: File size (bits) = sample rate × bit depth × channels × time (sec). Divide by 8 to obtain bytes.
音频文件大小取决于采样率(Hz)、位深度、声道数和时长。使用公式:文件大小(位)= 采样率 × 位深度 × 声道数 × 时间(秒)。除以8得到字节数。
Example: A high-quality stereo recording uses a 44.1 kHz sample rate, 16-bit samples, and lasts 3 minutes. Calculate the uncompressed WAV file size in megabytes.
Time = 3 × 60 = 180 seconds.
Total bits = 44,100 × 16 × 2 × 180 = 254,016,000 bits.
Bytes = 254,016,000 / 8 = 31,752,000 bytes ≈ 31.75 MB (using 1 MB = 10⁶ bytes).
示例:一段高质量立体声录音使用44.1 kHz采样率、16位采样,时长3分钟。计算未压缩WAV文件大小(以兆字节为单位)。
时间 = 3 × 60 = 180秒。
总位数 = 44,100 × 16 × 2 × 180 = 254,016,000位。
字节数 = 254,016,000 / 8 = 31,752,000字节 ≈ 31.75 MB(1 MB = 10⁶字节)。
Note that you may be asked to convert from minutes to seconds and to express the final answer in kB, MB or GB. Always check the prefix requested (actual binary prefixes are sometimes used, but AQA typically sticks to decimal multiples).
注意你可能会被要求将分钟转换为秒,并以kB、MB或GB表示最终答案。务必检查要求的前缀(有时会使用实际二进制前缀,但AQA通常使用十进制倍数)。
7. Logic Gate Simplification with Boolean Algebra | 布尔代数逻辑门化简
Boolean algebra allows simplification of logic circuits, reducing the number of gates. The key laws include identity, annulment, idempotent, complement, commutative, associative, distributive, and De Morgan’s theorems. In exam calculations, you often need to simplify an expression and state the number of basic gates required.
布尔代数可用于简化逻辑电路,减少门数量。关键定律包括同一律、零一律、幂等律、互补律、交换律、结合律、分配律和德摩根定理。在考试计算中,你通常需要简化一个表达式,并说明所需基本门的数量。
Simplify F = A·B + A·¬B. Using the distributive law: F = A·(B + ¬B) = A·1 = A. This reduces two AND gates and one OR gate to a single wire (buffer). The gate count drops from 3 to 0 (or 1 buffer if necessary).
简化 F = A·B + A·¬B。使用分配律:F = A·(B + ¬B) = A·1 = A。这将两个与门和一个或门减少为一条连线(或一个缓冲器)。门数从3减少到0(或必要时1个缓冲器)。
Apply De Morgan’s law to ¬(¬A·B + C). First, ¬(X + Y) = ¬X · ¬Y. So ¬(¬A·B + C) = ¬(¬A·B) · ¬C = (A + ¬B) · ¬C. Convert this to NAND-only if required to compute propagation delays or gate costs.
对 ¬(¬A·B + C) 应用德摩根定律。首先,¬(X + Y) = ¬X · ¬Y。因此 ¬(¬A·B + C) = ¬(¬A·B) · ¬C = (A + ¬B) · ¬C。若要求计算传播延迟或门成本,可能需要将其转换为纯与非门。
8. Karnaugh Map Minimisation | 卡诺图化简
Karnaugh maps (K-maps) offer a visual method to simplify Boolean expressions of up to 4 variables. You group adjacent 1s in powers of two (1,2,4,8) to form prime implicants, then select the fewest groups covering all 1s. Each group corresponds to a product term where a variable is eliminated if it changes within the group.
卡诺图提供了一种可视化方法,用于简化最多四个变量的布尔表达式。你可以将相邻的1按2的幂次(1,2,4,8)分组,形成质蕴含项,然后选择覆盖所有1的最少组。每组对应一个乘积项,若变量在组内发生变化则被消除。
Example: Minimise F(A,B,C,D) = Σm(0,2,4,6,8,10,12,14) using a 4-variable K-map. Plotting the minterms shows that for all rows, the column variable D is 0 (D’). The variable C varies, B varies, but A also? Actually, these minterms cover D’ because when D=0, we have all combinations of A,B,C giving 1; the group 0,2,4,6,8,10,12,14 corresponds to D’ only. The simplified expression is F = D’.
示例:使用4变量卡诺图化简 F(A,B,C,D) = Σm(0,2,4,6,8,10,12,14)。标绘这些最小项后,可以看出在所有行中,列变量D均为0(D’)。变量C、B、A都有变化?实际上这些最小项覆盖了D’,因为当D=0时,所有A、B、C的组合都给出1;组0,2,4,6,8,10,12,14对应的正是D’。简化表达式为 F = D’。
When designing circuits, you may need to calculate the literal cost (number of input appearances) of the original and minimised expressions to quantify the savings. This directly links simplification to a measurable reduction in gate inputs.
设计电路时,你可能需要计算原始表达式和化简后表达式的字面成本(输入变量出现次数),以量化节省情况。这直接将化简与可衡量的门输入减少联系起来。
9. Network Data Transfer Time | 网络数据传输时间
Transfer time calculations involve the relationship: time (seconds) = data size (bits) / bandwidth (bits per second). Ensure consistent units: if file size is given in megabytes and bandwidth in megabits per second, convert megabytes to megabits by multiplying by 8. Use 1 MB = 8 × 10⁶ bits for AQA exams unless specified otherwise.
传输时间计算涉及关系式:时间(秒)= 数据大小(位)/ 带宽(位每秒)。确保单位一致:若文件大小以兆字节给出,带宽以兆位每秒给出,则将兆字节乘以8转换为兆位。除非另有说明,AQA考试使用1 MB = 8 × 10⁶ 位。
Example: A 250 MB file is downloaded over a 50 Mbps connection. Calculate the minimum transfer time ignoring overheads.
Data in bits = 250 × 8 × 10⁶ = 2,000 × 10⁶ bits.
Bandwidth = 50 × 10⁶ bps.
Time = 2,000 × 10⁶ / 50 × 10⁶ = 40 seconds.
示例:一个250 MB文件通过50 Mbps连接下载。忽略开销,计算最短传输时间。
数据位数 = 250 × 8 × 10⁶ = 2,000 × 10⁶ 位。
带宽 = 50 × 10⁶ bps。
时间 = 2,000 × 10⁶ / 50 × 10⁶ = 40秒。
You may also be asked to add packet headers (e.g., TCP/IP overhead of 40 bytes per 1500-byte packet). Compute effective data capacity by accounting for these additional bits.
你可能还会被要求加上数据包头(例如每1500字节数据包附加40字节的TCP/IP开销)。通过计入这些额外位来计算有效数据容量。
10. Checksum Calculation | 校验和计算
A checksum is used to detect errors during transmission. The sender computes the arithmetic sum of all data bytes, discards any carry beyond the checksum size, and appends the one’s complement of the sum. The receiver performs the same sum including the checksum; a zero result typically indicates no error.
校验和用于检测传输过程中的错误。发送方计算所有数据字节的算术和,丢弃任何超出校验和位宽度的进位,然后追加该和的二进制反码。接收方在包含校验和的情况下进行相同求和;结果为零通常表示无错误。
Example: Two data bytes are 11010110 and 10101100. Using an 8-bit checksum, find the transmitted checksum.
Add: 11010110 + 10101100 = 1 10000010 (9 bits). Discard carry → 10000010. One’s complement → 01111101. This is the checksum appended to the data.
示例:两个数据字节为11010110和10101100。使用8位校验和,找出传输的校验和。
相加:11010110 + 10101100 = 1 10000010(9位)。丢弃进位 → 10000010。求反 → 01111101。此即为附加至数据的校验和。
At the receiver, add all three bytes: 11010110 + 10101100 + 01111101 = 1 11111111. Ignoring the carry gives 11111111. The one’s complement of 11111111 is 00000000, thus data is assumed intact. Note that this method cannot detect all errors, such as swapped bytes.
在接收端,对三个字节求和:11010110 + 10101100 + 01111101 = 1 11111111。忽略进位得11111111。11111111的反码是00000000,因此假定数据完好。注意,该方法无法检测所有错误,如字节交换。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导