📚 Common Exam Mistakes in CIE A-Level Computer Science | CIE A-Level 计算机易错题精讲
In CIE A-Level Computer Science, tricky exam questions often expose misunderstandings that even diligent students carry into the examination hall. This article collects the most frequent pitfalls across topics such as data representation, logic circuits, assembly language, networking, databases, data structures, and algorithms. Each section pinpoints a classic mistake, analyses why it occurs, and demonstrates the correct reasoning.
在 CIE A-Level 计算机科学考试中,很多精心设计的考题总能暴露出学生根深蒂固的误解。本文汇集了数据表示、逻辑电路、汇编语言、网络、数据库、数据结构和算法等章节中最常见的易错点。每个小节都聚焦一道典型错题,分析错误根源,并展示正确的解题思路。
1. Two’s Complement Overflow Misconceptions | 二进制补码溢出误区
When asked to state the range of an 8-bit two’s complement integer, many learners incorrectly write -127 to +127 or -128 to +128. The error arises from forgetting that the most negative number (10000000) represents -128 without a matching positive +128.
当题目要求写出 8 位二进制补码的表示范围时,许多学生错误地写成 -127 到 +127,或者 -128 到 +128。产生这一错误的原因在于,学生没有意识到最小的负数 10000000 表示的是 -128,而对应的 +128 无法用 8 位补码表示。
A common exam question presents two 8-bit additions and asks whether an overflow has occurred. The wrong approach is to look only at the carry into the sign bit. The correct rule: overflow occurs if the carry into the sign bit is different from the carry out of the sign bit. For example, 01111111 + 00000001 results in 10000000. The carries into and out of the sign bit are both 1? Wait, let’s check: 01111111 (127) + 00000001 (1) = 10000000 (-128) in 8-bit. The carry into the most significant bit (bit 7) is 1 from bit 6, and the carry out of bit 7 is 0. Since 1 ≠ 0, overflow occurs.
考试中常出现这样一道题:给出两个 8 位补码相加的算式,要求判断是否溢出。错误的做法是仅盯着符号位的进位。正确的溢出判断规则为:当符号位的进位输入与进位输出不相等时发生溢出。例如,01111111 + 00000001 的结果为 10000000。在这个例子中,进入最高位(第 7 位)的进位为 1,而第 7 位的进位输出为 0;由于 1 ≠ 0,因此发生了溢出。
Another typical mistake involves negating a two’s complement number. Students sometimes flip all the bits and forget to add 1, or they add 1 before flipping. The reliable method: starting from the rightmost bit, write all zeroes and the first ‘1’ exactly as they are, then flip all remaining bits. This avoids arithmetic errors when converting manually.
另一个常见错误出现在求补码相反数时。学生可能会只反相所有位而忘记加 1,或者在反相之前就加了 1。可靠的手工方法为:从最右侧开始,原样写下所有的 0 和遇到的第一个 1,然后将剩下的所有位依次取反。这样能有效避免手动转换中的算术错误。
2. Floating-Point Normalisation Errors | 浮点数规格化错误
Questions requiring a decimal value to be expressed in a normalised floating-point format (sign, exponent with bias, mantissa) often trip up candidates. A widespread error is to move the binary point in the wrong direction or to forget that the mantissa of a positive normalised number must start with 0.1 in a two’s complement fixed-point format. For instance, converting 6.5 (binary 110.1) to a mantissa of 0.1101 with exponent 3 (shift left three places) is correct, but many learners will try to store 110.1 directly in the mantissa, resulting in an unnormalised representation.
要求将十进制数表示为规格化浮点数(包含符号位、带偏置的阶码、尾数)的题目经常让学生丢分。一个普遍的错误是二进制小数点移动方向弄反,或者忘记正数的规格化尾数必须以 0.1 开头(采用二进制补码定点格式)。例如,将 6.5(二进制 110.1)转换为尾数 0.1101、阶码 3(小数点左移三位)才是正确的,但很多学生试图把 110.1 直接塞进尾数字段,得到的是未规格化的表示。
A typical exam problem might give a register layout: 1 sign bit, 4 exponent bits with a bias of 7, and a 4-bit mantissa (normalised). When asked to represent -3.25, a frequent misstep is applying the bias incorrectly. The binary of 3.25 is 11.01. After normalisation for negative numbers, in two’s complement the mantissa must start with 1.0. So the normalised mantissa is 1.0010 (in a 4-bit field, we might store 1001 if truncated). The exponent should be 2 (binary 2 + 7 = 9, i.e. 1001). Many candidates mistakenly shift the point to make the mantissa positive, or they omit the leading 1.0 requirement for negative numbers.
典型的考题可能给出这样的寄存器分配:1 位符号、4 位阶码(偏置 7)和 4 位规格化尾数。当要求表示 -3.25 时,常见的失分点是偏置值应用错误。3.25 的二进制为 11.01。对于负数,补码规格化的要求是尾数以 1.0 开始,因此规格化后的尾数为 1.0010(在 4 位字段中可能截断为 1001),阶码应为 2(2 + 7 = 9,即 1001)。许多考生却错误地移动小数点使尾数变成正数,或忽略了负数必须以 1.0 开头的规格化要求。
3. Half-Adder vs Full-Adder Confusion | 半加器与全加器的混淆
Circuit diagrams asking you to build a 4-bit adder often reveal that students do not distinguish between a half-adder and a full-adder. A half-adder handles only two input bits (A and B) and produces a sum and a carry-out, with no carry-in. A full-adder accepts three inputs: A, B, and a carry-in. The mistake of using a half-adder where a carry-in must be propagated leads to a non-functional ripple-carry adder.
要求设计 4 位加法器的电路图常常暴露出学生无法区分半加器和全加器。半加器只处理两个输入位(A 和 B),产生和与进位输出,没有进位输入。全加器则接受三个输入:A、B 和进位输入。在必须传递进位输入的位置错误地使用半加器,会导致行波进位加法器无法正常工作。
In exam questions, a frequent error is stating that a half-adder consists of two XOR gates or that its carry-out is produced by an OR gate. The correct Boolean expressions are: Sum = A XOR B, Carry = A AND B. For a full-adder, a typical logic diagram uses two half-adders and an OR gate, but students wrongly assign the OR gate’s input to the sums of the half-adders. The correct formula: Sum = A XOR B XOR C_in, Carry-Out = (A AND B) OR (C_in AND (A XOR B)).
考试中常见的错误包括:声称半加器由两个异或门构成,或者进位输出由一个或门产生。正确的布尔表达式为:Sum = A XOR B,Carry = A AND B。对于全加器,典型的逻辑图使用两个半加器和一个或门,但学生会错误地把或门的输入接在半加器的和输出上。正确的公式为:Sum = A XOR B XOR C_in,Carry-Out = (A AND B) OR (C_in AND (A XOR B))。
4. Pipelining Hazards: Data Dependency | 流水线冒险:数据依赖
Pipeline questions ask you to identify hazards in a sequence of instructions and to explain how they can be resolved. A classic error is failing to recognise a RAW (read-after-write) dependency and assuming the pipeline will stall automatically. For example, consider:
- ADD R1, R2, R3 // R1 ← R2 + R3
- SUB R4, R1, R5 // R4 ← R1 – R5
The SUB instruction needs the value of R1 from the ADD, but registers are written back in the final stage. Without forwarding, the SUB would read an old R1 value. Students often think a simple stall of one cycle solves all dependencies, but forwarding (bypassing) can avoid most stalls.
流水线相关的考题要求你识别指令序列中的冒险并解释如何解决。经典错误是未能识别 RAW (读后写) 数据依赖,并以为流水线会自动插入停顿。例如:
- ADD R1, R2, R3
- SUB R4, R1, R5
SUB 指令需要使用 ADD 写入 R1 的新值,但寄存器写回发生在流水线最后阶段。若无转发机制,SUB 将读到旧的 R1 值。学生往往以为插入一个时钟周期的停顿就能解决所有依赖,但事实上转发(旁路)技术可以避免大多数停顿。
Another pitfall is forgetting that conditional branches create control hazards, not data hazards. A wrong answer might suggest inserting NOPs for a branch hazard in the same way as for a data hazard. The correct strategy: branch prediction or flushing the pipeline.
另一个易错点是忘记条件分支会引起控制冒险,而非数据冒险。错误的回答可能会建议像处理数据冒险一样通过插入 NOP 来处理分支冒险。正确的策略是采用分支预测或清空流水线。
5. Assembly Addressing Modes: Immediate vs Direct | 汇编寻址模式:立即数与直接寻址
A very common source of lost marks is confusing the immediate addressing mode (#n) with direct (absolute) addressing (n). In a typical processor, LDR R0, #10 loads the literal value 10 into R0, while LDR R0, 10 loads the contents of memory location 10 into R0. When a table of memory values is provided, students frequently misinterpret the instruction and swap the meanings.
一个非常容易丢分的考点是混淆立即寻址(#n)与直接(绝对)寻址(n)。在典型处理器中,LDR R0, #10 将字面值 10 送入 R0,而 LDR R0, 10 将内存地址 10 中的内容加载到 R0。当题目提供内存数值表时,学生经常混淆二者的含义,颠倒解释。
Consider a question: “Given memory contents: address 5 holds 20, address 10 holds 30. What is in R0 after LDR R0, #10 and then LDR R0, 10?” The first instruction puts 10 into R0. The second instruction then uses R0 as an address if it were indirect? No, LDR R0, 10 is direct addressing, the operand 10 is the address, not the register. But careful: In some exam pseudocode, LDR R0, 10 means load from memory address 10. So R0 becomes 30. However, many students mistakenly think LDR R0, 10 loads 10 into R0 because they treat it like immediate. Understanding the syntax is crucial.
来看一个例题:“已知内存内容:地址 5 存有 20,地址 10 存有 30。执行 LDR R0, #10 和 LDR R0, 10 后 R0 的值分别是什么?”第一条指令将 10 放入 R0。第二条指令 LDR R0, 10 采用直接寻址,操作数 10 是内存地址,因此 R0 变为 30。然而大量学生错误地认为 LDR R0, 10 也会把 10 放进 R0,因为他们把它当成了立即数寻址。透彻理解指令语法至关重要。
Similarly, indexed addressing such as LDR R1, [R2, #4] is often misread. It loads from the address (R2+4), not loading R2+4 into R1. A clear table comparing addressing modes helps avoid these errors.
| Addressing Mode | Example | Meaning |
|---|---|---|
| Immediate | MOV R0, #5 | R0 ← 5 |
| Direct | LDR R1, 5 | R1 ← [Content at address 5] |
| Register Indirect | LDR R2, [R3] | R2 ← [Content at address in R3] |
| Indexed | LDR R4, [R5, #8] | R4 ← [Content at address (R5+8)] |
类似地,变址寻址形式 LDR R1, [R2, #4] 也经常被读错。它的含义是从地址 (R2+4) 处取数,而不是把 R2+4 的值放入 R1。用一个清晰的对比表格有助于规避这些错误。
6. Subnetting Mistakes: Identifying the Network Address | 子网划分错误:识别网络地址
Subnetting calculations in the networking topic regularly bring simple arithmetic mistakes. Given an IP address and a subnet mask or CIDR notation, candidates are asked for the network address, broadcast address, and usable host range. A frequent error is applying the mask only to the network octet and copying the host octet unchanged. For example, with 192.168.1.100/26, the mask in binary is 255.255.255.192. The network address requires a bitwise AND. The 100 in binary is 01100100; AND with 192 (11000000) gives 01000000, i.e. 64. So the network address is 192.168.1.64. Many students incorrectly leave it as 192.168.1.100 or 192.168.1.0.
网络章节中的子网划分计算经常出现低级算术错误。题目给出 IP 地址和子网掩码或 CIDR 表示法,要求找出网络地址、广播地址和可用主机范围。常见错误是只对网络段施行掩码运算,而将主机段直接原样照抄。例如,对于 192.168.1.100/26,掩码二进制为 255.255.255.192。计算网络地址需要按位与:100 的二进制为 01100100,与 192 (11000000) 相与得到 01000000,也就是 64。因此网络地址为 192.168.1.64。很多学生会错误地写成 192.168.1.100 或 192.168.1.0。
Another common misstep is miscalculating the number of usable hosts. For a /26 network, 32 – 26 = 6 host bits, so total addresses = 2⁶ = 64. Subtracting 2 (network and broadcast) leaves 62 usable hosts. Many candidates forget to subtract the two or erroneously subtract only one. Writing the calculation in clear steps drastically reduces such slip-ups.
另一个常见失误是计算可用主机数时出错。/26 网络中,32 – 26 = 6 个主机位,因此地址总数为 2⁶ = 64。减去网络地址和广播地址后,可用主机数为 62。许多考生忘记减去这两个地址,或者只减去一个。将计算过程清晰地分步写出,能大大减少这类粗心错误。
7. SQL JOIN Types Misapplied | SQL 连接类型的误用
Database questions frequently require writing an SQL query involving multiple tables. A pervasive error is using a natural join or comma-separated tables without a proper ON clause, leading to Cartesian products. Even when INNER JOIN is correctly employed, students often misjudge whether to use LEFT JOIN, RIGHT JOIN, or FULL OUTER JOIN in scenarios that require preserving unmatched rows.
数据库题目经常要求编写涉及多张表的 SQL 查询。一个普遍的错误是使用自然连接或不带合适 ON 子句的逗号分隔表,导致笛卡尔积。即便正确使用了 INNER JOIN,学生也往往在需要保留不匹配行的场景中错判该用 LEFT JOIN、RIGHT JOIN 还是 FULL OUTER JOIN。
Consider a typical exam scenario: “List all customers and any orders they have placed, showing customers even if they have no orders.” The appropriate query is: SELECT * FROM Customers LEFT JOIN Orders ON Customers.CustID = Orders.CustID; A common mistake is writing INNER JOIN, which will omit customers without orders. Candidates should remember: LEFT JOIN includes all rows from the left table.
看一个典型的考试情境:“列出所有顾客及其订单,即使顾客没有订单也要显示。”合适的查询为:SELECT * FROM Customers LEFT JOIN Orders ON Customers.CustID = Orders.CustID; 常见的错误是写出 INNER JOIN,这会遗漏没有订单的顾客。考生应牢记:LEFT JOIN 会保留左表的所有行。
Also, filtering in the WHERE clause after a LEFT JOIN can accidentally turn it into an inner join if a condition references the right table without allowing NULLs. The correct approach is to place such filter conditions in the ON clause or handle NULLs explicitly.
此外,在 LEFT JOIN 之后使用 WHERE 子句进行过滤时,如果条件引用了右表列且不允许 NULL 值,可能会意外地将左连接转换为内连接。正确的做法是将此类过滤条件放入 ON 子句,或者显式地处理 NULL 值。
8. Binary Tree Traversals: Pre-, In- and Post-order | 二叉树遍历:前序、中序与后序
Traversal algorithms form a core part of abstract data types. A question may display a binary tree with nodes labelled and ask for the node sequence when visited in a specific order. The most insidious mistake is swapping the rules: for pre-order (Root, Left, Right), students might traverse left subtree, then root, then right subtree, mimicking in-order. Writing an incorrect algorithm such as “visit left, visit root, visit right” for pre-order is a classic slip.
遍历算法是抽象数据类型的核心部分。题目可能给出一棵标注了字母的二叉树,要求写出按某种顺序访问的节点序列。最容易中招的错误是混淆规则:对于前序遍历(根、左、右),学生可能错误地按照“访问左子树,访问根,访问右子树”的顺序,即模仿了中序遍历。把前序遍历算法描述为“访问左,访问根,访问右”是一个典型的笔误。
A popular confusing tree is one where one child is missing. For example, a root A with only a right child B, and B has a left child C. The correct pre-order is A, B, C. The in-order is A, C, B. Many students incorrectly write pre-order as A, C, B because they think “left first”. Clearly knowing the recursive definitions eliminates these errors: pre-order: process node, then pre-order(left), then pre-order(right). Even if left is null, it is simply skipped.
一种容易让人混淆的树是某个子树缺失的结构。例如,根节点 A 只有右子节点 B,B 有左子节点 C。正确的前序遍历为 A, B, C。中序遍历为 A, C, B。很多学生错误地将前序写成 A, C, B,因为他们内心想着“左为先”。清晰地记住递归定义能消除这类错误:前序 = 处理节点,再前序(左子树),最后前序(右子树)。若左子树为空,直接跳过即可。
Applicably, mapping a given traversal sequence back to a tree structure is equally prone to mistakes; always verify using the properties of binary search trees (in-order yields sorted keys) when relevant.
反过来,根据遍历序列重构树结构同样易错;在涉及二叉搜索树时,务必利用好中序序列必然有序这一特性进行验证。
9. Sorting Algorithm Stability | 排序算法的稳定性
A surprisingly frequent misconception is regarding stability in sorting algorithms. Stability means that records with equal sort keys retain their original relative order. Many students claim that Quicksort is stable, or that Bubble sort is unstable. In fact, Bubble sort (if implemented carefully) is stable, Insertion sort is stable, and Merge sort is stable; whereas Selection sort, Heapsort, and the
Published by TutorHao | A-Level Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导