📚 A-Level Edexcel Computer Science: Calculation Question Bootcamp | A-Level Edexcel 计算机科学:计算题专项训练
Calculation questions form a significant part of the Edexcel A-Level Computer Science exam, demanding both speed and precision. From number systems and Boolean algebra to floating-point arithmetic and memory addressing, a step-by-step mastery of these quantitative skills can make the difference between a good grade and a top grade.
计算题在Edexcel A-Level计算机科学考试中比重可观,既要求速度又要求准确性。从数制系统和布尔代数到浮点算术和内存寻址,逐步掌握这些量化技能,往往能拉开普通成绩和顶尖成绩的差距。
1. Number System Conversions | 数制转换
Convert 2025 (decimal) to binary: repeatedly divide by 2. 2025 ÷ 2 = 1012 R1, 1012 ÷ 2 = 506 R0, 506 ÷ 2 = 253 R0, 253 ÷ 2 = 126 R1, 126 ÷ 2 = 63 R0, 63 ÷ 2 = 31 R1, 31 ÷ 2 = 15 R1, 15 ÷ 2 = 7 R1, 7 ÷ 2 = 3 R1, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1. Reading remainders upwards gives 11111100101₂.
将十进制数2025转换为二进制:重复除以2。2025 ÷ 2 = 1012 余1,1012 ÷ 2 = 506 余0,506 ÷ 2 = 253 余0,253 ÷ 2 = 126 余1,126 ÷ 2 = 63 余0,63 ÷ 2 = 31 余1,31 ÷ 2 = 15 余1,15 ÷ 2 = 7 余1,7 ÷ 2 = 3 余1,3 ÷ 2 = 1 余1,1 ÷ 2 = 0 余1。从下往上读取余数,得到11111100101₂。
To convert 0xA3F to decimal: A=10, 3=3, F=15. Compute 10×16² + 3×16¹ + 15×16⁰ = 10×256 + 3×16 + 15 = 2560 + 48 + 15 = 2623₁₀.
将十六进制0xA3F转换为十进制:A=10,3=3,F=15。计算10×16² + 3×16¹ + 15×16⁰ = 2560 + 48 + 15 = 2623₁₀。
2. Two’s Complement and Binary Subtraction | 补码与二进制减法
For an 8-bit signed integer, represent –23 in two’s complement. Write +23 as 00010111₂. Flip all bits: 11101000₂. Add 1: 11101001₂. So –23 is 11101001₂.
用8位有符号整数表示–23的补码。先写出+23为00010111₂,全部位取反:11101000₂,加1:11101001₂,因此–23为11101001₂。
To compute 45 – 18 using 8-bit two’s complement: 45 is 00101101₂, –18 is obtained from +18 (00010010₂) → 11101110₂. Add: 00101101₂ + 11101110₂ = 1 00011011₂. Discard carry, result is 00011011₂ = 27.
用8位补码计算45 – 18:45是00101101₂,–18由+18(00010010₂)得到→11101110₂。相加:00101101₂ + 11101110₂ = 1 00011011₂,丢弃进位,结果为00011011₂,即27。
3. Floating-Point Binary (Simplified IEEE 754) | 简化浮点数二进制
A 16-bit floating-point format uses 1 sign bit, 6 exponent bits (excess-31), and 9 mantissa bits (leading 1 implied). Represent +12.375. Normalise: 12.375 in binary is 1100.011₂ = 1.100011₂ × 2³. Exponent 3 +31 = 34 → 100010₂. Sign 0, mantissa drop leading 1 → 100011000. So 0 100010 100011000.
一个16位浮点格式使用1位符号、6位阶码(偏置31)和9位尾数(隐含前导1)。表示+12.375:规范化:12.375二进制为1100.011₂ = 1.100011₂ × 2³。阶码3+31=34 → 100010₂。符号0,尾数去掉前导1 → 100011000。因此表示为0 100010 100011000。
Convert the floating-point number 1 011110 101000000 back to decimal. Sign 1 → negative. Exponent 011110₂ = 30, actual exponent 30–31 = –1. Mantissa 1.101₂ (add implied 1) = 1.625. Value = –1.625 × 2⁻¹ = –0.8125.
将浮点数1 011110 101000000转回十进制。符号1→负数。阶码011110₂=30,实际指数30–31 = –1。尾数加上隐含1得1.101₂=1.625。数值= –1.625 × 2⁻¹ = –0.8125。
4. Boolean Algebra Simplification | 布尔代数简化
Simplify the expression A·B + A·¬B. Factor A: A·(B + ¬B) = A·1 = A. Use identities to reduce gate count in a circuit.
简化表达式A·B + A·¬B。提取A:A·(B + ¬B) = A·1 = A。利用恒等式减少电路中的门数量。
Apply De Morgan’s law to ¬(X + Y)·Z. ¬(X+Y)·Z = (¬X·¬Y)·Z = ¬X·¬Y·Z. The expression is now in product-of-variables form.
对 ¬(X + Y)·Z 应用德摩根定律:¬(X+Y)·Z = (¬X·¬Y)·Z = ¬X·¬Y·Z。表达式变为变量的乘积形式。
5. Logic Gates and Truth Tables | 逻辑门与真值表
Given the circuit (A XOR B) AND C, construct the truth table. There are 8 rows. The output is 1 only when A and B are different and C=1. Rows: A=0,B=0,C=0→0; 0,0,1→0; 0,1,0→0; 0,1,1→1; 1,0,0→0; 1,0,1→1; 1,1,0→0; 1,1,1→0. So output = A·¬B·C + ¬A·B·C.
给定电路(A异或B)与C,构建真值表。共有8行。仅当A和B不同且C=1时输出为1。行:0,0,0→0; 0,0,1→0; 0,1,0→0; 0,1,1→1; 1,0,0→0; 1,0,1→1; 1,1,0→0; 1,1,1→0。所以输出 = A·¬B·C + ¬A·B·C。
Realise the expression ¬(A·B + C) using only NAND gates. ¬(A·B + C) = ¬(A·B) · ¬C (De Morgan). A·B can be made with NAND followed by NOT (another NAND with tied inputs). Final circuit uses four NAND gates.
仅用与非门实现表达式¬(A·B + C)。¬(A·B + C) = ¬(A·B) · ¬C (德摩根)。A·B可用一个与非门后接非门(用另一与非门将输入并接)实现。最终电路使用四个与非门。
6. Karnaugh Maps Minimisation | 卡诺图化简
Minimise F(A,B,C) = Σ(1,3,4,6) using a 3-variable K-map. Plot: BC=00,01,11,10 for A=0 and A=1. Row A=0: m0=0, m1=1, m3=1, m2=0. Row A=1: m4=1, m5=0, m7=0, m6=1. Pair m3,m1 gives ¬B·C; pair m4,m6 gives A·¬C. Result F = ¬B·C + A·¬C.
用三变量卡诺图化简F(A,B,C)=Σ(1,3,4,6)。填图:BC=00,01,11,10对于A=0和A=1。A=0行:m0=0, m1=1, m3=1, m2=0。A=1行:m4=1, m5=0, m7=0, m6=1。m3,m1对给出¬B·C;m4,m6对给出A·¬C。结果F = ¬B·C + A·¬C。
For F(A,B,C,D)=Σ(2,3,6,7,10,11,14,15), groups of 4 give F = C (since all cells with C=1). K-map directly reveals a trivial simplification.
对于F(A,B,C,D)=Σ(2,3,6,7,10,11,14,15),4个一组化简得到F = C(因为所有C=1的格子)。卡诺图直接揭示了平凡化简。
7. Opcode and Addressing Mode Calculations | 操作码与寻址模式计算
A 16-bit instruction format has 4 bits for opcode and 12 bits for operand. The number of possible opcodes is 2⁴ = 16. The maximum directly addressable memory range is 2¹² = 4096 locations.
某16位指令格式中,4位为操作码,12位为操作数。可编码的操作码数量是2⁴ = 16。可直接寻址的最大内存范围是2¹² = 4096个单元。
If an instruction uses indirect addressing, and the 12-bit operand field holds address 0x200, which contains the value 0x3A0, the effective address is 0x3A0. The data actually moved comes from that location.
如果某指令使用间接寻址,且12位操作数存储地址0x200,该地址内容为0x3A0,则有效地址是0x3A0。实际移动的数据来自该位置。
8. Memory Address and Offset Arithmetic | 内存地址与偏移量运算
Base register = 0x1000, index register = 0x0005. In indexed addressing, effective address = base + index = 0x1005. Relative addressing with program counter PC=0x2000 and displacement = –8 (two’s complement) gives target address = 0x2000 – 8 = 0x1FF8.
基址寄存器=0x1000,变址寄存器=0x0005。在变址寻址中,有效地址=基址+变址=0x1005。相对寻址,程序计数器PC=0x2000,位移量=–8(补码),目标地址=0x2000 – 8 = 0x1FF8。
An array starts at memory location 0x300. To fetch the 7th element (0-indexed, element size 4 bytes), offset = 7 × 4 = 28 = 0x1C. Address = 0x31C.
一个数组从内存地址0x300开始。取第7个元素(0索引,元素大小4字节),偏移量=7×4=28=0x1C。地址=0x31C。
9. Subnet Mask Calculation (Networking Topic) | 子网掩码计算(网络专题)
Given IP 192.168.1.0/27, subnet mask is 255.255.255.224. Number of subnets? Borrowed bits = 27 – 24 (class C) = 3, so 2³ = 8 subnets. Hosts per subnet: 2⁽³²⁻²⁷⁾ – 2 = 2⁵ – 2 = 30 hosts.
给定IP 192.168.1.0/27,子网掩码为255.255.255.224。子网数量?借位数=27–24 (C类)=3,所以2³=8个子网。每个子网主机数:2⁽³²⁻²⁷⁾ – 2 = 2⁵ – 2 = 30台主机。
The network address is the first in range: 192.168.1.0. Broadcast address is last: 192.168.1.31 for subnet 0. For subnet 3 (counting from 0), network: 192.168.1.96, broadcast: 192.168.1.127.
网络地址是范围内的第一个:192.168.1.0。广播地址是最后一个:子网0为192.168.1.31。对于子网3(从0计),网络地址:192.168.1.96,广播地址:192.168.1.127。
10. Bitmap Image and Sound File Size Calculations | 位图图像与声音文件大小计算
An image 800×600 pixels, 24-bit colour depth. Raw file size = 800 × 600 × 24 bits = 11,520,000 bits = 1,440,000 bytes = 1.44 MB (approx).
一张800×600像素、24位色深的图像,原始文件大小=800×600×24位=11,520,000位=1,440,000字节≈1.44 MB。
A 10-second mono sound clip sampled at 44.1 kHz, 16-bit sample resolution. Data size = 44100 × 16 × 10 = 7,056,000 bits = 882,000 bytes = 882 KB. Stereo doubles it.
一段10秒单声道声音片段,采样率44.1 kHz,16位分辨率。数据大小=44100×16×10=7,056,000位=882,000字节=882 KB。立体声则翻倍。
11. RSA Encryption Stepping Calculation | RSA加密步骤计算
Pick primes p=3, q=11. n = 3×11 = 33. φ(n) = (3–1)(11–1) = 20. Choose e=7 (coprime with 20). Find d such that e·d ≡ 1 mod 20. 7×3=21≡1 mod 20, so d=3. Public key: (33,7); private key: (33,3). Encrypt plaintext 4: cipher = 4⁷ mod 33 = 16384 mod 33 = ??? Compute: 4²=16, 4³=64≡31 mod 33, 4⁴=4×31=124≡25, 4⁵=4×25=100≡1, 4⁷=4⁵·4²=1×16=16. Ciphertext = 16. Decrypt: 16³ mod 33 = 4096 mod 33. 16²=256≡256–231=25, 16³=16×25=400≡400–396=4. Recovered 4.
取素数p=3, q=11。n=3×11=33。φ(n)=(3–1)(11–1)=20。选择e=7(与20互质)。求d使得e·d ≡ 1 mod 20。7×3=21≡1 mod 20,所以d=3。公钥:(33,7);私钥:(33,3)。加密明文4:密文=4⁷ mod 33=16384 mod 33。计算:4²=16, 4³=64≡31 mod 33, 4⁴=124≡25, 4⁵=100≡1, 4⁷=4⁵·4²=1×16=16。密文=16。解密:16³ mod 33=4096 mod 33。16²=256≡25, 16³=16×25=400≡4。恢复得4。
12. Quick Checks and Common Pitfalls | 速算检查与常见误区
Always verify: binary subtraction result must be in range for the given bits; floating-point normalisation must have mantissa 1.xxx; K-map groups must be powers of two and rectangular. Double-check carry and borrow operations.
务必验证:二进制减法结果必须在给定位数范围内;浮点规范化尾数必须是1.xxx;卡诺图分组必须是2的幂且矩形。仔细检查进位和借位操作。
Forgetting the hidden 1 in floating-point, mixing little-endian/big-endian in fetched instructions, or using zero-index incorrectly in array offset are common exam traps. Practice with past paper calculation drills until the steps become automatic.
浮点数遗忘隐含1、取指令时大小端混淆、数组偏移中索引使用不当,都是常见考试陷阱。用真题计算练习反复训练,直到步骤成为本能。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply