📚 A-Level WJEC Computer Science: Calculation Questions Drill | A-Level WJEC 计算机:计算题专项训练
A-Level WJEC Computer Science requires strong numerical skills across many topics, from data representation to Boolean logic and network performance. This article covers the most common types of calculation questions you will face in the exam, with clear step-by-step explanations and practice examples.
A-Level WJEC 计算机科学考试中,许多专题都要求扎实的计算能力,包括数据表示、布尔逻辑和网络性能等。本文涵盖你将在考试中遇到的最常见的计算题型,并配有清晰的逐步解析与练习实例。
1. Binary, Denary and Hexadecimal Conversions | 二进制、十进制与十六进制转换
You must be able to convert between binary, denary, and hexadecimal fluently. For denary to binary, repeatedly divide by 2 and read remainders bottom-up. For binary to hex, group bits into nibbles.
你必须能够熟练地在二进制、十进制和十六进制之间进行转换。十进制转二进制时,反复除以2并自下而上读取余数。二进制转十六进制时,将比特位按四位一组分组。
Example: Convert 202₍₁₀₎ to binary → 11001010₂
示例:将 202₍₁₀₎ 转换为二进制 → 11001010₂
- 220 ÷ 2 = 110 r 0, 110 ÷ 2 = 55 r 0, 55 ÷ 2 = 27 r 1, 27 ÷ 2 = 13 r 1, 13 ÷ 2 = 6 r 1, 6 ÷ 2 = 3 r 0, 3 ÷ 2 = 1 r 1, 1 ÷ 2 = 0 r 1. Read remainders upwards: 11001010₂.
- 220 ÷ 2 = 110 余 0, 110 ÷ 2 = 55 余 0, 55 ÷ 2 = 27 余 1, 27 ÷ 2 = 13 余 1, 13 ÷ 2 = 6 余 1, 6 ÷ 2 = 3 余 0, 3 ÷ 2 = 1 余 1, 1 ÷ 2 = 0 余 1。自下而上读取余数:11001010₂。
To convert 11001010₂ to hexadecimal, split into 1100 1010 → C A → CA₁₆.
将 11001010₂ 转换为十六进制,拆分为 1100 1010 → C A → CA₁₆。
2. Binary Addition and Subtraction | 二进制加法与减法
Binary addition follows the rules: 0+0=0, 0+1=1, 1+0=1, 1+1=0 carry 1. Subtraction often uses two’s complement to handle negative numbers.
二进制加法遵循以下规则:0+0=0, 0+1=1, 1+0=1, 1+1=0 进 1。减法常使用补码来处理负数。
Add 0110₂ (6) and 0111₂ (7):
加 0110₂ (6) 和 0111₂ (7):
0110
+ 0111
= 1101₂ (13 in denary). The carry out from the MSB is ignored if working within fixed bits.
0110
+ 0111
= 1101₂ (十进制 13)。若在固定位宽内工作,最高位的进位将被忽略。
For subtraction, convert the subtrahend to two’s complement and add. Example: 5 – 3 in 4-bit: 0101 + (1101) = 10010, discard overflow → 0010₂ = 2.
减法时,将减数转换为补码然后相加。例如,4 位下 5 – 3:0101 + (1101) = 10010,丢弃溢出 → 0010₂ = 2。
3. Two’s Complement | 二进制补码
Two’s complement is used to represent negative integers. To find the negative of a number, invert all bits and add 1.
补码用于表示负整数。要取一个数的负数,将所有位取反再加 1。
Find -6 in 4-bit two’s complement: +6 = 0110 → invert → 1001 → add 1 → 1010.
以 4 位补码表示 -6:+6 = 0110 → 取反 → 1001 → 加 1 → 1010。
You must also convert a two’s complement binary number back to denary. If the MSB is 1, treat it as negative: find its two’s complement to get the magnitude, then add minus sign.
你还必须将补码二进制数转换回十进制。如果最高位是 1,将其视为负数:求其补码得到绝对值,然后加上负号。
For 1010₂, invert → 0101, add 1 → 0110₂ = 6, so answer is -6.
对于 1010₂,取反 → 0101,加 1 → 0110₂ = 6,所以答案是 -6。
4. Floating Point Binary | 浮点二进制数
WJEC uses a mantissa and exponent format. You might be given a fixed total bit length divided between mantissa (including sign) and exponent (using two’s complement). To convert a binary floating point number to denary, move the binary point according to the exponent.
WJEC 使用尾数和阶码格式。你可能会遇到给定总位宽后,在尾数(含符号位)和阶码(用补码)之间分配的题型。将浮点二进制数转换为十进制时,需根据阶码移动二进制小数点。
8-bit register, 5-bit mantissa, 3-bit exponent: 0 1010 010 → Mantissa = 0.1010, Exp = 010 = +2. Denary value = + (1×½ + 0×¼ + 1×⅛ + 0×1/16) × 2² = (0.625) × 4 = 2.5.
8 位寄存器,5 位尾数,3 位阶码:0 1010 010 → 尾数 = 0.1010,阶码 = 010 = +2。十进制值 = + (1×½ + 0×¼ + 1×⅛ + 0×1/16) × 2² = 0.625 × 4 = 2.5。
Normalisation ensures the mantissa starts with 01 for positive or 10 for negative. Unnormalised numbers must be shifted and the exponent adjusted accordingly.
浮点数规格化要求正数尾数以 01 开头,负数以 10 开头。非规格化数必须移动并相应调整阶码。
5. Boolean Algebra Simplification | 布尔代数化简
You must be able to simplify logic expressions using Boolean laws: commutativity, associativity, distributivity, De Morgan’s, absorption, etc. Exam questions often present a truth table or expression and ask for the simplest form.
你必须能够使用布尔定律化简逻辑表达式:交换律、结合律、分配律、德·摩根律、吸收律等。考试题目常给出真值表或表达式,要求求出最简形式。
Example: Simplify A • B + A • ¬B.
示例:化简 A • B + A • ¬B。
Factor out A: A (B + ¬B) = A • 1 = A.
提取公因子 A:A (B + ¬B) = A • 1 = A。
Use truth tables to verify simplifications. In more complex cases, apply De Morgan’s and other laws step by step.
可使用真值表验证化简结果。在更复杂的情况下,逐步应用德·摩根律和其他定律。
6. Logic Gate Circuits and Truth Tables | 逻辑门电路与真值表
Given a logic diagram, you should produce its Boolean expression and truth table, then simplify if required. Intermediate gate outputs can be labelled to build the expression.
给定逻辑电路图,你需要写出其布尔表达式和真值表,然后按要求化简。可标记中间门输出来构建表达式。
A half adder circuit: Sum = A XOR B, Carry = A AND B. A full adder incorporates a carry-in: Sum = A XOR B XOR Cᵢₙ, Carry-out = (A AND B) OR (Cᵢₙ AND (A XOR B)).
半加器电路:和 S = A ⊕ B,进位 C = A · B。全加器包含进位输入:和 S = A ⊕ B ⊕ Cᵢₙ,进位输出 Cₒᵤₜ = (A · B) + (Cᵢₙ · (A ⊕ B))。
| A | B | Sum | Carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
7. Data Storage Calculations | 数据存储计算
Calculations include file sizes for images, sound, and text. Know the units: bit, byte, kilobyte (KB = 1000 B or 1024 B depending on context — WJEC usually uses powers of 2 for storage). Sound file size = sample rate × bit depth × channels × duration.
计算涉及图像、声音和文本的文件大小。掌握单位:比特、字节、千字节(KB = 1000 B 还是 1024 B 视上下文而定——WJEC 在存储方面通常使用 2 的幂)。声音文件大小 = 采样率 × 位深 × 声道数 × 时长。
Example: 10 seconds of stereo audio at 44.1 kHz sample rate, 16-bit depth. Size = 44100 × 16 × 2 × 10 bits = 14,112,000 bits = 1,764,000 bytes ≈ 1.68 MiB.
示例:10 秒立体声音频,采样率 44.1 kHz,位深 16 位。大小 = 44100 × 16 × 2 × 10 位 = 14,112,000 位 = 1,764,000 字节 ≈ 1.68 MiB。
Image size = width × height × bit depth. For a 1024×768 image with 24-bit colour, uncompressed size ≈ 1024 × 768 × 24 bits = 18,874,368 bits = 2.25 MiB.
图像大小 = 宽度 × 高度 × 位深。一幅 1024×768 的 24 位彩色图像,未压缩大小 ≈ 1024 × 768 × 24 位 = 18,874,368 位 = 2.25 MiB。
8. Network Transmission Time and Delay | 网络传输时间与延迟
Transmission time = size of data / bandwidth. Remember to use consistent units. Propagation delay = distance / propagation speed. Total delay = transmission time + propagation delay + queuing/processing delays.
传输时间 = 数据量 / 带宽。注意单位统一。传播延迟 = 距离 / 传播速度。总延迟 = 传输时间 + 传播延迟 + 排队/处理延迟。
Example: Send a 1 Megabyte file over a 100 Mbps link. Transmission time = 1 × 8 × 10⁶ bits / 100 × 10⁶ bps = 0.08 s = 80 ms.
示例:通过 100 Mbps 链路发送 1 兆字节的文件。传输时间 = 1 × 8 × 10⁶ 位 / 100 × 10⁶ 位/秒 = 0.08 秒 = 80 毫秒。
If optical fibre distance is 200 km, speed of light in fibre ≈ 2×10⁸ m/s, propagation delay = 200,000 m / 2×10⁸ m/s = 0.001 s = 1 ms. Total ≈ 81 ms.
若光纤距离为 200 公里,光在光纤中的速度 ≈ 2×10⁸ 米/秒,传播延迟 = 200,000 米 / 2×10⁸ 米/秒 = 0.001 秒 = 1 毫秒。总延迟 ≈ 81 毫秒。
9. IP Addressing and Subnetting | IP 地址与子网划分
Given an IP address and subnet mask, calculate the network address, broadcast address, and number of usable hosts. Perform bitwise AND between IP and mask to get network address.
给定 IP 地址和子网掩码,计算网络地址、广播地址和可用主机数。将 IP 与掩码按位与得到网络地址。
Example: 192.168.1.10/26. Mask 255.255.255.192. Step: Convert last octet to binary: IP . 00001010, mask . 11000000 → AND → 00000000 → Network: 192.168.1.0. Number of host bits = 32 – 26 = 6, hosts = 2⁶ – 2 = 62.
示例:192.168.1.10/26。掩码 255.255.255.192。步骤:将最后一个八位组转为二进制:IP .00001010,掩码 .11000000 → 与运算 → 00000000 → 网络地址为 192.168.1.0。主机位数 = 32 – 26 = 6,可用主机数 = 2⁶ – 2 = 62。
Broadcast address is all host bits set to 1: 192.168.1.63.
广播地址将主机位全置 1:192.168.1.63。
10. CPU Performance and Clock Speed | CPU 性能与时钟频率
Execution time = number of instructions × CPI / clock frequency. CPI = average clock cycles per instruction. Clock period = 1 / frequency.
执行时间 = 指令数 × CPI / 时钟频率。CPI = 平均每条指令时钟周期数。时钟周期 = 1 / 频率。
Example: A program of 2 million instructions, CPI = 1.5, clock frequency = 3 GHz. Execution time = 2×10⁶ × 1.5 / 3×10⁹ = 1×10⁻³ s = 1 ms.
示例:一个程序有 200 万条指令,CPI = 1.5,时钟频率 = 3 GHz。执行时间 = 2×10⁶ × 1.5 / 3×10⁹ = 1×10⁻³ 秒 = 1 毫秒。
You might also be asked to calculate speedup when using parallel processing or pipelining, using Amdahl’s Law or simple pipeline throughput.
你可能还需要用阿姆达尔定律或简单的流水线吞吐率来计算并行处理或流水线设计的加速比。
11. Compression Ratios | 压缩比
Compression ratio = uncompressed size / compressed size. This appears in both theory and data representation. Always use the same units.
压缩比 = 未压缩大小 / 压缩后大小。此概念在理论和数据表示中都会出现。务必使用相同单位。
Example: Original file 800 KB, compressed file 200 KB. Ratio = 800 : 200 = 4 : 1. Percentage saving = (600/800) × 100 = 75%.
示例:原文件 800 KB,压缩后 200 KB。压缩比 = 800 : 200 = 4 : 1。节省百分比 = (600/800) × 100 = 75%。
Lossy vs lossless compression trade-offs may be examined alongside size calculations.
考试中可能结合大小计算考查有损压缩与无损压缩的权衡。
12. Hash Table Probing and Load Factor | 哈希表探测与负载因子
Load factor = number of entries / table size. A high load factor increases collisions. The average number of probes for successful/unsuccessful search can be estimated using given formulae in open addressing.
负载因子 = 条目数 / 表大小。负载因子高会增加冲突。在开放寻址中,成功/不成功查找的平均探测次数可用给定公式估算。
Example: Hash table with 10 slots, 7 entries. Load factor = 7/10 = 0.7. For linear probing, average number of probes for a successful search ≈ ½ (1 + 1/(1-λ)) where λ = load factor → ½ (1 + 1/0.3) ≈ 2.17.
示例:哈希表有 10 个槽,7 个条目。负载因子 = 7/10 = 0.7。对于线性探测,成功查找的平均探测次数 ≈ ½ (1 + 1/(1-λ)),其中 λ 为负载因子 → ½ (1 + 1/0.3) ≈ 2.17。
These calculations test your ability to apply formulas and interpret hash table behaviour.
此类计算题考查你应用公式和解释哈希表行为的能力。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导