A-Level CCEA Computer Science: Calculation Practice | A-Level CCEA 计算机:计算题专项训练

📚 A-Level CCEA Computer Science: Calculation Practice | A-Level CCEA 计算机:计算题专项训练

This article is designed to sharpen your calculation skills for the CCEA A-Level Computer Science examinations. Each section focuses on a key type of computational question, providing step‑by‑step methods, worked examples, and tips to avoid common pitfalls.

本文旨在为 CCEA A-Level 计算机科学考试打磨你的计算能力。每个小节聚焦一类关键的计算题型,提供逐步求解的方法、解题示例以及避开常见陷阱的技巧。

1. Number System Conversions | 数制转换

Conversions between binary, denary (decimal) and hexadecimal are essential. Always show your working to gain method marks. For binary to denary, sum the place values where a 1 appears. For denary to binary, repeatedly divide by 2 and record remainders.

二进制、十进制与十六进制之间的转换是必考内容。解题时务必写出过程以获取方法分。二进制转十进制时,将出现 1 的位权相加;十进制转二进制时,不断除以 2 并记录余数。

Example: Convert 1011 0101₂ to denary.

示例:将 1011 0101₂ 转换为十进制。

1011 0101₂ = 1×2⁷ + 0×2⁶ + 1×2⁵ + 1×2⁴ + 0×2³ + 1×2² + 0×2¹ + 1×2⁰ = 128 + 32 + 16 + 4 + 1 = 181₁₀

For hexadecimal, group binary digits into nibbles (4 bits) from the right. The same byte becomes 1011₂ = B₁₆ and 0101₂ = 5₁₆, giving B5₁₆.

十六进制转换时,从右向左将二进制数每 4 位分为一组。该字节中 1011₂ = B₁₆,0101₂ = 5₁₆,因此结果为 B5₁₆。

When converting denary to hex, divide by 16 and use remainder as the least significant digit. Always check your answers by reversing the operation.

十进制转十六进制时,除以 16 取余数作为最低位。务必通过逆运算验证答案。


2. Binary Arithmetic and Overflow | 二进制算术与溢出

Binary addition follows these rules: 0+0=0, 0+1=1, 1+0=1, 1+1=0 carry 1. Overflow occurs when a carry into the most significant bit (MSB) creates a result that cannot be represented in the available bits, especially in two’s complement.

二进制加法遵循:0+0=0,0+1=1,1+0=1,1+1=0 并进位 1。当进位进入最高有效位 (MSB) 导致结果超出可用位数时,特别是补码表示中,会发生溢出。

Example: Add 0110 1101₂ and 0101 1010₂ in an 8‑bit register. Interpret the result as unsigned and as two’s complement.

示例:在 8 位寄存器中将 0110 1101₂ 和 0101 1010₂ 相加,分别按无符号数和补码解释结果。

0110 1101
+ 0101 1010
————-
1100 0111₂

Unsigned: 1100 0111₂ = 199₁₀ (correct, no overflow because carry out of MSB is 0). Two’s complement: both numbers positive, but result has MSB 1, indicating a negative number. This is an overflow because the sum of two positive numbers cannot be negative in valid two’s complement.

无符号数:1100 0111₂ = 199₁₀(正确,无溢出,因为 MSB 的进位输出为 0)。补码:两个正数相加,结果的 MSB 为 1,表示负数。这是溢出,因为在有效的补码表示中,两个正数之和不可能为负。

Remember: two’s complement overflow occurs when carry into MSB ≠ carry out of MSB. Use this rule to detect overflow in exam questions.

请记住:补码溢出的条件是进入 MSB 的进位 ≠ 从 MSB 溢出的进位。在考试题中请用该规则检测溢出。


3. Floating Point Representation | 浮点表示

CCEA questions often require converting a denary number into a normalised floating point binary format, given a mantissa and exponent size. Normalisation means the mantissa’s binary point is preceded by a sign bit and the first bit after the point is different from the sign.

CCEA 常要求学生将十进制数转换为给定尾数和指数位数的规格化浮点二进制格式。规格化意味着尾数中小数点前有一位符号位,且小数点后第一位与符号位不同。

Example: Represent +6.25₁₀ in an 8‑bit register with a 5‑bit two’s complement mantissa and 3‑bit two’s complement exponent.

示例:用 5 位补码尾数和 3 位补码指数在 8 位寄存器中表示 +6.25₁₀。

Step 1: Convert magnitude to binary. 6.25₁₀ = 110.01₂.
Step 2: Normalise. Move the binary point 2 places left to get 1.1001₂. The exponent is +2₁₀ = 010₂ (3‑bit).
Step 3: Adjust mantissa to 5 bits with sign. The number is positive, so mantissa sign is 0. Mantissa bits after sign: 1001 (from 1.1001, drop the leading 1). To fill 5 bits: 0.1001 → 01001. The full register: mantissa 01001, exponent 010. Combined: 01001 010.

步骤 1:将数值转为二进制。6.25₁₀ = 110.01₂。
步骤 2:规格化。将小数点左移 2 位得到 1.1001₂。指数为 +2₁₀ = 010₂(3 位)。
步骤 3:用 5 位符号位调整尾数。正数符号位为 0。符号位后的尾数位:1001(来自 1.1001,去掉前导 1)。补足 5 位:0.1001 → 01001。完整寄存器:尾数 01001,指数 010。组合为 01001 010。

Always check the stored exponent range; 3‑bit two’s complement can represent −4 to +3. This normalisation lies within range.

务必检查指数存储范围;3 位补码可表示 −4 至 +3。该规格化在范围内。


4. Boolean Algebra and Logic Circuit Simplification | 布尔代数与逻辑电路简化

Simplifying Boolean expressions using laws (identity, annulment, complement, distributive, etc.) saves design costs. You must be able to derive a truth table from an expression and vice versa.

使用定律(同一律、零一律、互补律、分配律等)化简布尔表达式可降低设计成本。必须能根据表达式推导真值表,反之亦然。

Example: Simplify (A ∧ B) ∨ (A ∧ ¬B) ∨ (¬A ∧ B).

示例:化简 (A ∧ B) ∨ (A ∧ ¬B) ∨ (¬A ∧ B)。

(A∧B) ∨ (A∧¬B) = A∧(B ∨ ¬B) = A∧1 = A
So expression becomes A ∨ (¬A∧B) = (A ∨ ¬A) ∧ (A ∨ B) = 1 ∧ (A ∨ B) = A ∨ B

The simplified expression is A ∨ B, which corresponds to an OR gate. Always present both the simplification steps and the final circuit diagram where asked.

化简结果为 A ∨ B,对应于一个或门。若题目要求,应同时给出化简步骤和最终电路图。


5. Karnaugh Maps | 卡诺图

Karnaugh maps (K‑maps) are a visual tool to minimise Boolean expressions for up to 4 variables. Group adjacent cells containing 1s in rectangles of size 1, 2, 4, or 8, ensuring groups are as large as possible.

卡诺图 (K‑map) 是一种可视化工具,用于化简含有最多 4 个变量的布尔表达式。将包含 1 的相邻单元格组成大小为 1、2、4 或 8 的矩形,确保组尽可能大。

Example: Given the truth table for a function F(A,B,C) = Σ(1,2,3,6), draw the 3‑variable K‑map and find the minimal sum of products.

示例:已知函数 F(A,B,C) = Σ(1,2,3,6) 的真值表,画出 3 变量卡诺图并求出最简与或式。

AB\C 0 1
00 0 1
01 1 1
11 1 0
10 0 0

Group the four 1s in positions 01 and 11 (rows 00,01 with column 1, and row 11 with column 0). The two groups give:
Group 1 (m1,m3): A’C (since A=0, C=1)
Group 2 (m2,m3,m6): BC’ (check: when B=1, C=0).
Hence minimal expression is A’C + BC’.

将 01 和 11 行的四个 1 进行分组。两个分组为:
组 1 (m1,m3):A’C(因为 A=0,C=1)
组 2 (m2,m3,m6):BC’(验证:当 B=1,C=0)。
因此最简表达式为 A’C + BC’。

Always cover all 1s with the fewest groups; overlapping is allowed if it enlarges a group. In exams, neatly label your K‑map and show derived expression.

必须用最少的组覆盖所有 1;允许重叠以使组更大。考试中请工整标注卡诺图并给出导出表达式。


6. Addressing Modes and Effective Address Calculation | 寻址模式与有效地址计算

In assembly language, understanding how the CPU calculates the effective address of an operand is vital. CCEA expects you to compute the actual address accessed for immediate, direct, indirect, and indexed addressing.

在汇编语言中,理解 CPU 如何计算操作数的有效地址至关重要。CCEA 要求你为立即寻址、直接寻址、间接寻址和变址寻址计算出实际访问的地址。

Example: A CPU has the following register values: PC = 500, MAR = 200, MBR = 300, Index register (IX) = 50. Main memory contents:
Address 200: 250
Address 250: 100
Address 300: 400
Address 350: 600

示例:某 CPU 的寄存器值如下:PC = 500,MAR = 200,MBR = 300,变址寄存器 (IX) = 50。主存内容:
地址 200:250
地址 250:100
地址 300:400
地址 350:600

If the instruction is LOAD 200 (direct), effective address is 200 → value 250. If it is LOAD (200) (indirect), first read address 200 to get 250, then effective address is 250 → value 100. For indexed addressing, e.g. LOAD 300,X, effective address = 300 + IX = 350 → value 600.

若指令为 LOAD 200(直接寻址),有效地址为 200 → 取值 250。若为 LOAD (200)(间接寻址),先读取地址 200 得到 250,有效地址为 250 → 取值 100。变址寻址如 LOAD 300,X,有效地址 = 300 + IX = 350 → 取值 600。

These calculations are often embedded in fetch‑execute cycle questions; break down each micro‑operation and track register content changes.

此类计算常嵌入在取指‑执行周期问题中;拆解每个微操作并跟踪寄存器内容的变化。


7. Process Scheduling Calculations | 进程调度计算

Scheduling algorithms like First‑Come First‑Served (FCFS), Shortest Job First (SJF), and Round Robin (RR) require you to compute waiting time, turnaround time, and response time. Drawing a Gantt chart helps.

先来先服务 (FCFS)、最短作业优先 (SJF) 和轮转 (RR) 等调度算法要求你计算等待时间、周转时间和响应时间。绘制甘特图有助于解题。

Example: Processes P1, P2, P3 arrive at time 0, 1, 2 with burst times 5, 3, 2. For non‑preemptive SJF, the Gantt chart is:

示例:进程 P1, P2, P3 到达时间为 0, 1, 2,执行时间分别为 5, 3, 2。对于非抢占式 SJF,甘特图为:

| P1 (0‑5) | P3 (5‑7) | P2 (7‑10) |

Waiting time for P1 = 0, P3 = 5 − 2 = 3, P2 = 7 − 1 = 6. Average waiting = (0+3+6)/3 = 3 ms. Turnaround time = time in system; P1 = 5, P3 = 5+2 − 2 = 5, P2 = 10 − 1 = 9. Average turnaround = (5+5+9)/3 = 6.33 ms.

P1 等待时间 = 0,P3 = 5 − 2 = 3,P2 = 7 − 1 = 6。平均等待时间 = (0+3+6)/3 = 3 ms。周转时间 = 在系统内的时间;P1 = 5,P3 = 5+2 − 2 = 5,P2 = 10 − 1 = 9。平均周转时间 = (5+5+9)/3 ≈ 6.33 ms。

For Round Robin with time quantum q, carefully count context switches; preempted processes return to the ready queue. Always show the ready queue state at each step.

对于时间片为 q 的轮转调度,仔细计入上下文切换;被抢占的进程返回就绪队列。请始终展示每一步就绪队列的状态。


8. Tree and Graph Calculations | 树和图的计算

Binary tree traversal (pre‑order, in‑order, post‑order) and constructing expression trees from algebraic expressions are common calculation tasks. For graphs, you may need to trace Dijkstra’s or Prim’s algorithm step by step.

二叉树遍历(前序、中序、后序)以及根据代数表达式构建表达式树是常见的计算任务。对于图,你可能需要逐步追踪 Dijkstra 或 Prim 算法。

Example: Represent the expression (A + B) * (C − D) as a binary tree, then produce the post‑order traversal. The tree has root ‘*’, left child ‘+’ with children A, B; right child ‘−’ with children C, D. Post‑order: left subtree, right subtree, root → A B + C D − *.

示例:将表达式 (A + B) * (C − D) 表示为二叉树,然后写出后序遍历序列。树的根为 ‘*’,左子结点 ‘+’ 有子结点 A, B;右子结点 ‘−’ 有子结点 C, D。后序:左子树、右子树、根 → A B + C D − *。

For Dijkstra’s algorithm on a weighted graph, maintain a table of distances from the source and visited set. Update distances at each iteration and show the shortest path tree.

对于加权图的 Dijkstra 算法,维护从源点出发的距离表及已访问集合。每次迭代更新距离,并展示最短路径树。

Example graph (nodes A‑D, undirected): edges A‑B:4, A‑C:2, B‑C:1, B‑D:5, C‑D:8. Starting at A, distances initially: A=0, B=∞, C=∞, D=∞. After relaxing from A: B=4, C=2. Next smallest unvisited is C (2). Relax through C: B becomes min(4, 2+1)=3, D becomes 2+8=10. Next visit B (3): D becomes min(10, 3+5)=8. Final shortest distances: A=0, B=3, C=2, D=8.

示例图(结点 A‑D,无向):边 A‑B:4, A‑C:2, B‑C:1, B‑D:5, C‑D:8。源点为 A,初始距离:A=0, B=∞, C=∞, D=∞。从 A 松弛后:B=4, C=2。下一个未访问最小为 C (2)。经 C 松弛:B 变为 min(4, 2+1)=3,D 变为 2+8=10。接着访问 B (3):D 变为 min(10, 3+5)=8。最终最短距离:A=0, B=3, C=2, D=8。

Always lay out algorithm steps clearly, as method marks are awarded for intermediate tables.

务必清晰地列出算法步骤,因为中间表格能获得方法分。


Published by TutorHao | CCEA Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading