📚 IB WJEC Computer Science: Common Pitfalls in Exam Questions | IB WJEC 计算机易错题精讲
Many students lose marks not because they lack knowledge, but because they misinterpret questions or overlook subtle constraints. This article breaks down the most common mistakes seen in IB and WJEC Computer Science papers, offering clear corrections and strategies for each one. By working through these examples, you will sharpen your ability to spot traps and apply your understanding accurately under exam conditions.
很多学生并非知识不足,而是因为误解题意或忽略细微的限制条件而丢分。本文详解IB和WJEC计算机科学试卷中最常见的错误,逐一提供清晰的纠正方法与答题策略。通过这些例子多加练习,你就能提升识别陷阱的能力,在考试中精准运用所学知识。
1. Binary Subtraction and Overflow Detection | 二进制减法与溢出检测
A frequent error occurs when students perform binary subtraction using two’s complement but forget to extend the bit width before the operation. For example, given an 8-bit register, subtracting 0110 0100 (100) from 0101 1010 (90) often leads to a wrong result if the subtrahend is not correctly converted to its two’s complement and sign-extended. Another pitfall is misidentifying overflow. Overflow in signed arithmetic is not simply a carry out of the most significant bit; it happens when two numbers with the same sign produce a result with a different sign.
一个常见错误是:使用补码进行二进制减法时忘记在运算前扩展位宽。例如,在8位寄存器中,用0101 1010 (90)减去0110 0100 (100),如果减数未被正确转换为补码且进行符号扩展,就会得到错误结果。另一个陷阱是错误判断溢出。有符号数运算中的溢出并非只是最高位产生进位,而是两个同号数相加却得到异号结果时才发生。
2. Stack and Queue Operations Under Exam Pressure | 栈与队列操作的临场错误
Many candidates confuse the top pointer movement in push and pop operations. When pushing onto a stack, the pointer is incremented before storing the data only if the stack grows upwards in memory; otherwise it is decremented. In IB mark schemes, a common deduction is for drawing the stack with the top pointer pointing to an empty location instead of the last inserted element. In queue simulations, students often forget that after a dequeue, the front pointer should advance, but they fail to check if the queue has become empty, causing subsequent enqueues to overwrite incorrectly.
许多考生搞混压栈和弹栈时栈顶指针的移动。如果栈在内存中向上增长,压栈时指针应先增加再存入数据,否则应先减少。IB评分标准中常见的扣分点是:画栈图时栈顶指针指向空位而非最后一个插入的元素。在队列模拟中,学生往往在出队后记得前移队首指针,却忘了判断队列是否已空,导致后续入队操作错误覆盖数据。
3. Recursion: Base Case and Stack Frames | 递归:基准情形与栈帧
A classic mistake is writing a recursive function without a reachable base case, or placing the recursive call before the base condition check. In pseudocode tracing questions, students often miscount the number of active stack frames, assuming that the recursive calls unwind immediately after the base case is hit. Actually, each recursive call remains on the call stack until its return value is computed. Another confusion arises when a recursive solution changes global variables without restoring them, leading to side effects that corrupt the result.
一个经典错误是编写的递归函数没有可达的基准情形,或者将递归调用写在基准条件判断之前。在伪代码追踪题中,学生常错误估计活动栈帧的数量,以为一旦抵达基准情形,递归调用就会立即返回。实际上,每个递归调用都会保留在调用栈中,直到其返回值被计算出来。另一个困惑点:递归解法修改了全局变量却未恢复,导致副作用破坏最终结果。
4. Logic Gates and Boolean Algebra Simplification | 逻辑门与布尔代数化简
Students frequently misapply De Morgan’s laws when converting a circuit made entirely of NAND gates back to its Boolean expression. For example, the expression (A NAND B) NAND (C NAND D) is not equivalent to AB + CD; breaking it down correctly requires repeated application of the involution and De Morgan’s theorems. Another error is simplifying (A + B)·(A + ¬B) incorrectly. Many write A + (B·¬B) = A + 0 = A, but the absorption law gives the correct answer directly as A. However, in more complex expressions, distributing carelessly can lead to missing cross terms.
学生常常在将纯与非门电路还原为布尔表达式时误用德摩根定律。例如,(A NAND B) NAND (C NAND D) 并不等于 AB + CD;正确化简需要反复运用双重否定和德摩根定理。另一个错误是化简 (A + B)·(A + ¬B) 时搞错。很多人写成 A + (B·¬B) = A + 0 = A,吸收律确实直接给出 A,但在更复杂的表达式中,随意分配可能会导致漏掉交叉项。
5. Object-Oriented Inheritance and Polymorphism | 面向对象继承与多态
One of the most penalised mistakes in OOP questions is confusing method overriding with method overloading. Overriding occurs when a subclass redefines a method with the same signature as the superclass; overloading means multiple methods share the same name but have different parameter lists. Under exam conditions, students may write a subclass that ‘overrides’ a method but changes the parameter type, effectively creating an overloaded method instead. Consequently, the polymorphic call from a superclass reference does not dispatch to the subclass version as expected.
面向对象题目中扣分最多的一类错误是混淆方法重写(覆盖)与方法重载。重写是指子类用与父类相同的方法签名重新定义方法;重载则是多个方法共享相同名称但参数列表不同。考试中,学生可能写出一个子类 “重写” 了某个方法,却改变了参数类型,实际上只是创建了一个重载方法。这样一来,通过父类引用进行的多态调用就不会按预期分派到子类版本。
6. Database Normalisation and Normal Forms | 数据库规范化与范式
When moving a table into third normal form (3NF), students often eliminate all partial dependencies correctly but leave transitive dependencies intact. A common misstep is assuming that removing repeating groups already satisfies 2NF and 3NF. For instance, a table with columns (OrderID, CustomerID, CustomerName, ProductID, Quantity) might be adjusted by separating Order and Product details, yet CustomerName still depends on CustomerID, not on the full primary key of the Order table. This transitive dependency must be resolved by creating a separate Customer table.
在将表转化为第三范式(3NF)时,学生往往能正确地消除所有部分函数依赖,却保留了传递函数依赖。常见的失分点是误以为消除重复组就已经满足2NF和3NF。例如,一张表包含列 (订单ID, 客户ID, 客户姓名, 产品ID, 数量),学生可能将订单和产品信息分离,但客户姓名依然只依赖于客户ID,而非订单表主键的全部。这一传递依赖必须通过创建单独的客户表来解决。
7. Network Protocols and the OSI Model | 网络协议与OSI模型
Many candidates mistakenly map protocols to incorrect layers under time pressure. For instance, they place TCP at the network layer alongside IP, forgetting that TCP is a transport layer protocol responsible for reliable data transfer. Likewise, HTTP is often pushed down to the transport layer. An effective way to avoid this is to remember the functions: anything that deals with end-to-end communication and ports belongs to layer 4; application-specific protocols like HTTP, FTP, SMTP reside at layer 7. Protocols like ARP are frequently assigned to the data link layer because they deal with MAC addresses, though ARP operates between layer 2 and layer 3.
不少考生在时间紧迫时会把协议映射到错误的层级。比如将TCP与IP一同放在网络层,却忘了TCP是负责可靠数据传输的传输层协议。同样,HTTP常被误放到传输层。避免这个问题的一个有效方法是记住功能:所有处理端到端通信和端口的都属于第4层;像HTTP、FTP、SMTP等应用专属协议位于第7层。ARP等协议因涉及MAC地址而常被分到数据链路层,尽管它实际运行在第2层和第3层之间。
8. Algorithm Complexity and Big O Notation | 算法复杂度和O记法
A subtle error is claiming that an algorithm with two consecutive loops, each iterating n times, has a time complexity of O(2n) instead of O(n). While O(2n) is technically valid, IB and WJEC mark schemes expect the simplified form O(n) because constant factors are dropped. More seriously, students incorrectly derive the complexity of nested loops. If the inner loop runs log n times and the outer runs n times, the total complexity is O(n log n), not O(log n). Another common slip is confusing the complexity of a binary search on an unsorted data structure—before searching, sorting would add O(n log n), making the overall algorithm O(n log n) rather than O(log n).
一个细微的错误是:认为含有两个连续循环(每个循环迭代n次)的算法时间复杂度为O(2n)而非O(n)。虽然O(2n)在技术上没错,但IB和WJEC的评分方案要求写成简化形式O(n),因为常数因子会被去掉。更严重的是,学生在嵌套循环中推导复杂度时出错。如果内层循环运行log n次,外层运行n次,总复杂度应为O(n log n)而不是O(log n)。另一个常见失误是混淆对未排序结构进行二分查找的复杂度——在查找前需要先排序,这会额外增加O(n log n),使得整个算法的复杂度变为O(n log n)而非O(log n)。
9. Pseudocode Tracing and Variable Scope | 伪代码追踪与变量作用域
Under the pressure of a written exam, candidates often miscalculate accumulator variables when loops skip certain iterations. For example, a WHILE loop that increments a counter by an uncertain step might exit earlier or later than expected. Another frequent mistake is misunderstanding local and global variable scopes in procedures. If a procedure uses a variable that has the same name as a global variable, IB guidelines typically expect the local variable to take precedence, but if the variable is not declared inside the procedure, the global variable is used. Many students assume global variables are always accessible without considering whether the parameter passing is by value or by reference, leading to incorrect final values.
书面考试中,考生在循环跳过某些迭代时常常算错累加器变量的值。例如,一个按不确定步长增加计数器的WHILE循环可能过早或过晚退出。另一个常见错误是误解过程中局部变量和全局变量的作用域。如果过程使用的变量与全局变量同名,IB指南通常期望局部变量优先,但如果该变量未在过程内声明,则会使用全局变量。许多学生总是假定全局变量随时都可访问,而不考虑参数传递是值传递还是引用传递,从而得出错误的最终结果。
10. Sorting Algorithm Quirks and Comparison Counting | 排序算法的细节与比较次数
In insertion sort, a common miscalculation is counting the number of comparisons for a partially sorted array. The algorithm compares each element with those already sorted, and in the best case (already sorted) it makes exactly n-1 comparisons, not zero. For bubble sort, students frequently forget the optimisation that stops early if no swaps occur in a pass; without it, the quoted number of passes is always n-1. When asked to show the state of an array after a certain number of passes, rushing through the swapping logic can cause a cascade of errors. In selection sort, the number of swaps is (n-1) in the worst case, but students often write that it requires n² swaps, confusing swap count with comparison count.
在插入排序中,一个常见的计算错误是估算部分排序数组的比较次数。该算法会将每个元素与已排序部分逐一比较,最佳情况(已排序)下需要精确的n-1次比较,而非零次。对于冒泡排序,学生常忘记“如果一趟中没有发生交换就提前终止”这一优化;若不采用优化,排序趟数总是n-1。当题目要求展示数组在若干趟之后的状态时,匆忙写出交换逻辑很容易导致一连串错误。在选择排序中,最坏情况下的交换次数为n-1,但学生常写成需要n²次交换,混淆了交换次数与比较次数。
11. Storage Devices and Characteristics | 存储设备及其特性
A typical exam trap is asking for the most suitable storage medium for a given scenario and expecting justification that covers volatility, durability, access speed, and cost. Students often recommend a solid-state drive (SSD) for long-term archival but forget to mention that flash memory cells can lose charge over decades when unpowered. Another mistake is equating RAM with permanent storage; candidates may state that increasing RAM will allow a computer to store more files permanently, whereas RAM is volatile and only affects the number of active processes. In questions about optical media, confusing Blu-ray capacity with DVD capacity (25 GB single-layer vs. 4.7 GB) can cost marks.
一个典型的考试陷阱是要求为特定场景推荐最合适的存储介质,并期望从易失性、耐用性、访问速度和成本等方面加以论证。学生常常为长期归档推荐固态硬盘,却忘了闪存单元在不通电的情况下经过数十年会丢失电荷。另一个错误是将内存RAM与永久存储混为一谈;考生可能会说增加内存能让电脑永久存储更多文件,但实际上RAM是易失性的,只影响活动进程的数量。在关于光学介质的问题中,混淆蓝光与DVD的容量(单层25 GB 对比 4.7 GB)也会丢分。
12. Scheduling Algorithms and Pre-emption | 调度算法与抢占
When drawing Gantt charts for pre-emptive scheduling like Shortest Remaining Time First (SRT), many students forget to update remaining burst times after each clock cycle and misplace the pre-emption points. In Round Robin, they may treat the time quantum as a suggestion rather than a strict limit, allowing a process to finish its burst even if it exceeds the quantum. Another error is calculating the average waiting time without considering the arrival times; processes that arrive at time zero and later need to be handled carefully, especially in priority-based scheduling where starvation can occur. Providing a correct Gantt chart is only half the battle—the accompanying calculations must reflect the chart precisely.
在绘制最短剩余时间优先等抢占式调度算法的甘特图时,许多学生忘记在每个时钟周期后更新剩余执行时间,从而标错抢占点。在轮转调度中,他们可能将时间片当作建议而非严格限制,即便进程的执行时间超出时间片也允许其直接完成。另一个错误是计算平均等待时间时未考虑到达时间;在时间零及之后到达的进程需要谨慎处理,特别是在可能导致饥饿的优先级调度中。画出正确的甘特图只成功了一半——随附的计算必须精确反映图表内容。
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