Common Mistake Analysis in IGCSE WJEC Computer Science | IGCSE WJEC 计算机:易错题精讲

📚 Common Mistake Analysis in IGCSE WJEC Computer Science | IGCSE WJEC 计算机:易错题精讲

IGCSE WJEC Computer Science covers foundational concepts in data representation, networking, programming, algorithms, and system fundamentals. Through our teaching experience, we have identified several recurring mistakes students make in exams. This article presents eight carefully selected questions that highlight common pitfalls, explains why these errors occur, and provides clear, exam-ready solutions. Engaging with these examples will help you avoid losing marks unnecessarily.

IGCSE WJEC 计算机科学涵盖数据表示、网络、编程、算法以及系统基础等核心知识。根据我们的教学经验,学生在考试中会反复出现一些典型错误。本文精选八道易错题,剖析常见误区的原因,并给出清晰的、适用于考试的解答。认真练习这些例题,能帮助你避免不必要的失分。

1. Two’s Complement Subtraction and Overflow | 二进制补码减法与溢出

Question: Perform the subtraction 5 – 7 using 4-bit two’s complement binary numbers. State whether overflow occurs and justify your answer.

题目:使用4位二进制补码计算 5 – 7。判断是否发生溢出,并说明理由。

A common mistake is to convert both numbers directly to binary and subtract without paying attention to the fixed bit width. Students often write 5 as 0101 and 7 as 0111, then attempt binary subtraction directly, producing an incorrect result like 1110, which they incorrectly interpret as -2. The proper method is to convert the subtrahend (7) into its two’s complement form and perform addition: 5 + (-7). The range for a 4-bit signed integer is -8 to +7. The result here is -2, which lies within range, so no overflow occurs. Overflow happens only when the result exceeds the representable range, i.e., when adding two positive numbers yields a negative result, or adding two negative numbers yields a positive result.

常见错误是直接将两个数转换为二进制进行减法,却忽略了固定的位宽。学生常把5写作0101,7写作0111,然后直接做二进制减法,得到错误结果1110,并错误地解释为-2。正确做法是将减数7转换为补码形式,再做加法:5 + (-7)。4位有符号整数的范围是 -8 到 +7。此处结果是-2,落在范围内,因此不会发生溢出。溢出仅当结果超出可表示范围时发生,即两个正数相加得负数,或两个负数相加得正数。

Correct steps: 5 in 4-bit = 0101. 7 in 4-bit = 0111; its two’s complement: invert = 1000, add 1 = 1001. Add: 0101 + 1001 = 1110. The result 1110 in two’s complement is -2 (since 1110 inverted = 0001, add 1 = 0010, decimal 2, therefore -2). No overflow because the carry into the sign bit equals the carry out of the sign bit.

正确步骤:5的4位表示为0101。7为0111;其补码:取反得1000,加1得1001。相加:0101 + 1001 = 1110。结果1110在补码中表示-2(因为1110取反得0001,加1得0010,十进制2,故为-2)。没有溢出,因为进入符号位的进位等于出符号位的进位。


2. Logic Gate Combinations and Truth Tables | 逻辑门组合与真值表

Question: Draw the truth table for the circuit: (A AND B) OR (NOT C). Then describe a real-world equivalent of this logic.

题目:画出电路 (A AND B) OR (NOT C) 的真值表,并描述该逻辑的一个实际等效应用。

Many students incorrectly evaluate the NOT operation before AND, or mistakenly write the final output without considering operator precedence. In Boolean algebra, NOT has the highest precedence, then AND, then OR. Thus the expression should be read as (A AND B) OR (NOT C). A frequent error is to write the output column for (A AND B) OR NOT C but accidentally treat NOT as applying to the whole expression. Another common pitfall is missing the intermediate columns in the truth table, leading to evaluation mistakes. The correct truth table has 8 rows (2^3 inputs). The output is 1 when either A and B are both 1, or C is 0. A real-world equivalent could be a security alarm: A = door sensor, B = window sensor, C = master switch. The alarm sounds if (door AND window are opened) OR (master switch is OFF).

许多学生错误地在AND之前计算NOT,或者忽略了运算符优先级而导致最终输出错误。在布尔代数中,NOT优先级最高,其次是AND,然后是OR。因此表达式应理解为 (A AND B) OR (NOT C)。一个常见错误是把输出列写成 (A AND B) OR NOT C,却误将NOT作用于整个表达式。另一个常见陷阱是在真值表中遗漏中间列,导致评价出错。正确的真值表有8行(2³个输入)。当A和B同时为1,或者C为0时,输出为1。一个实际等效应用是安全报警器:A=门传感器,B=窗传感器,C=总开关。当(门和窗都被打开)或(总开关关闭)时,警报响起。

Correct truth table: | A | B | C | NOT C | A AND B | Output | (表格略)。Students should systematically fill intermediate columns to avoid errors.

正确真值表:| A | B | C | NOT C | A AND B | Output | (表格省略)。学生应系统地填写中间列,以免出错。


3. Network Protocols and the TCP/IP Stack | 网络协议与 TCP/IP 协议栈

Question: Explain which layer of the TCP/IP model is responsible for routing packets, and identify a protocol that operates at that layer.

题目:解释 TCP/IP 模型中哪一层负责路由数据包,并指出一个在该层运行的协议。

Students often confuse the Internet layer with the Transport layer. A common mistake is to say that TCP is responsible for routing, because TCP ensures reliable delivery. However, routing is performed at the Internet layer (also called the Network layer in the OSI model). The protocol responsible for routing is IP (Internet Protocol). TCP operates at the Transport layer and handles end-to-end communication, segmentation, and error recovery, not routing. Another error is misidentifying the layer names: some students refer to ‘network layer’ instead of ‘Internet layer’ when asked about the TCP/IP model specifically, though in WJEC both terms may be accepted. The key is to remember: IP is at the Internet layer and is connectionless; TCP is at the Transport layer and is connection-oriented.

学生经常把互联网层与传输层混淆。一个常见错误是说TCP负责路由,因为TCP确保可靠传输。然而,路由是由互联网层(在OSI模型中亦称网络层)执行的。负责路由的协议是IP(互联网协议)。TCP工作在传输层,处理端到端通信、分段和差错恢复,而非路由。另一个错误是层名称的误用:一些学生在TCP/IP模型中回答’网络层’而不是’互联网层’,尽管在WJEC考试中这两个术语可能都被接受。关键是记住:IP在互联网层,是无连接的;TCP在传输层,是面向连接的。

To avoid confusion, draw a simple diagram: Application (HTTP, FTP), Transport (TCP, UDP), Internet (IP), Network Access (Ethernet). Routing decisions, packet forwarding, and logical addressing are functions of the Internet layer.

为避免混淆,可画一个简单示意图:应用层(HTTP, FTP)、传输层(TCP, UDP)、互联网层(IP)、网络接入层(以太网)。路由决策、包转发和逻辑寻址都是互联网层的功能。


4. Algorithm Efficiency and Bubble vs Merge Sort | 算法效率与冒泡排序对比归并排序

Question: Compare the time complexity of bubble sort and merge sort. Explain why bubble sort is rarely used for large datasets.

题目:比较冒泡排序和归并排序的时间复杂度。解释为什么冒泡排序很少用于大数据集。

Tricky aspect: Students frequently state that bubble sort has a time complexity of O(n^2) but fail to explain the best-case scenario. Bubble sort can achieve O(n) in the best case (when the list is already sorted and a swap flag is used to stop early). However, in the worst and average cases it is O(n^2). Merge sort consistently has O(n log n) time complexity due to its divide-and-conquer approach, but it requires additional memory for merging, making it less space-efficient. The mistake is to claim that bubble sort is always O(n^2) without mentioning the possibility of early termination. For large datasets, O(n^2) becomes prohibitive; for example, sorting 1 million items with bubble sort could require around 10^12 comparisons, while merge sort would need approximately 20 million comparisons. This drastic difference makes bubble sort unsuitable for large datasets.

易错点:学生常常说冒泡排序的时间复杂度是O(n²),但未能解释最优情况。冒泡排序在最好情况下(当列表已经有序并且使用交换标志来提前停止时)可以达到O(n)。但在最坏和平均情况下,它是O(n²)。归并排序由于采用分治法,始终具有O(n log n)的时间复杂度,但它需要额外的内存来进行合并,因此空间效率较低。错误之处在于没有提及提前终止的可能性,就声称冒泡排序总是O(n²)。对于大数据集,O(n²)会变得无法接受;例如,排序100万项,冒泡排序可能需要约10¹²次比较,而归并排序大约需要2000万次比较。这种巨大差异使得冒泡排序不适合大数据集。

Students should also note that WJEC often asks about the number of passes and comparisons in a specific scenario, so they must be able to simulate bubble and merge sort steps. Bubble sort’s passes: n-1 in worst case; comparisons: n(n-1)/2.

学生还应注意WJEC经常要求回答特定场景下的趟数和比较次数,因此必须能模拟冒泡排序和归并排序的步骤。冒泡排序的趟数:最坏情况下为n-1;比较次数:n(n-1)/2。


5. Pseudocode Loop Boundaries and Off-by-One Errors | 伪代码循环边界与差一错误

Question: Examine the following pseudocode:

FOR i ← 1 TO 5

OUTPUT i * 2

ENDFOR

Explain what will be output, and how the loop would differ if ‘TO’ were replaced by ‘WHILE i <= 5' with i starting at 0.

题目:阅读以下伪代码:

FOR i ← 1 TO 5

OUTPUT i * 2

ENDFOR

解释将会输出什么,并说明如果 ‘TO’ 被替换为 ‘WHILE i <= 5' 且 i 从0开始,循环会有何不同。

The FOR loop outputs 2, 4, 6, 8, 10 because i takes values 1,2,3,4,5. A frequent mistake is to think the loop includes 0 or excludes 5, or to incorrectly start at 0 and output 0,2,4,6,8. Off-by-one errors occur when students miscount the number of iterations. The FOR loop iterates exactly 5 times. If we rewrite using WHILE with i starting at 0: i ← 0; WHILE i <= 5; OUTPUT i * 2; i ← i + 1; ENDWHILE. Now i takes values 0,1,2,3,4,5, so there are 6 iterations, outputting 0,2,4,6,8,10. The condition i <= 5 with start at 0 causes one extra iteration compared to the original FOR. Many students fail to update the counter or incorrectly place the INCREMENT step, leading to infinite loops or wrong output sequences.

FOR循环输出2, 4, 6, 8, 10,因为i取值为1,2,3,4,5。一个常见错误是认为循环包含0或排除5,或者错误地从0开始而输出0,2,4,6,8。差一错误发生在学生误数迭代次数时。FOR循环恰好迭代5次。如果我们用WHILE重写,i从0开始:i ← 0; WHILE i <= 5; OUTPUT i * 2; i ← i + 1; ENDWHILE。此时i取值为0,1,2,3,4,5,所以有6次迭代,输出0,2,4,6,8,10。与原始FOR相比,条件i <= 5且从0开始导致多一次迭代。许多学生忘记更新计数器或者错误地放置了自增步骤,导致无限循环或错误的输出序列。

In exams, always set up a trace table to track variable values step by step. This eliminates boundary mistakes.

考试中,一定要建立一个追踪表来逐步跟踪变量值。这能消除边界错误。


6. String Concatenation vs Arithmetic Addition | 字符串拼接与算术加法

Question: A program has two variables: x ← “5” (a string) and y ← 3 (an integer). In a language that uses + for both addition and concatenation, what is the result of x + y? What common mistake do programmers make when using such loosely-typed operations?

题目:某程序有两个变量:x ← “5”(字符串)和 y ← 3(整数)。在同时使用+进行加法和拼接的语言中,x + y的结果是什么?程序员在使用这种弱类型操作时常犯什么错误?

Many students assume the result will be 8, because they think the string “5” will be automatically converted to a number. However, in languages like Python, x + y would raise a type error because you cannot concatenate a string with an integer directly. In JavaScript or similar languages, the integer y would be coerced into a string, and concatenation would occur, giving “53”. The common mistake is failing to consider data types and operator overloading. Programmers often forget to explicitly convert between types (e.g., using int() or str()) and then produce unexpected results such as treating numeric values as strings, which can lead to logic errors in programs.

许多学生认为结果会是8,因为他们以为字符串”5″会被自动转换为数字。然而,在像Python这样的语言中,x + y会引发类型错误,因为你不能直接将字符串与整数拼接。在JavaScript或类似语言中,整数y会被强制转换成字符串,并发生拼接,得到”53″。常见错误是没有考虑数据类型和运算符重载。程序员经常忘记在类型之间显式转换(例如使用int()或str()),然后产生意外结果,比如把数值当字符串处理,这可能导致程序中的逻辑错误。

A safe approach is to always validate and cast data types before performing operations. Exam questions often test this through trace tables where a variable’s type changes implicitly.

安全的做法是在执行操作之前始终验证并转换数据类型。考试题目经常会通过追踪表来考察这一知识点,其中变量的类型会发生隐式改变。


7. Sequential vs Direct File Access | 顺序存取与直接文件存取

Question: Describe one advantage and one disadvantage of using sequential file access instead of direct access for a student record system. Give an example of when each access method is most appropriate.

题目:对于学生记录系统,描述使用顺序文件存取而非直接存取的一个优点和一个缺点。举例说明每种存取方法何时最合适。

Mistake: Some students incorrectly state that sequential access is always slower than direct access for all operations. While sequential access can be slow for searching individual records (requires reading from the start), it is very efficient for batch processing such as printing all student reports, because the records are physically stored one after another. Direct access allows any record to be reached in roughly the same time, ideal when you need to retrieve a single student’s details quickly. Many also forget that sequential files often use magnetic tape, which is cheap but has sequential nature, while direct access uses hard disks or SSDs. An advantage of sequential access is simpler implementation and lower storage overhead (no need for index structures). A disadvantage is the inability to efficiently update, insert, or delete records without rewriting the whole file. In a student record system, direct access is appropriate for real-time queries, whereas sequential access is suitable for end-of-term report generation where the entire file must be processed.

易错点:有些学生错误地认为顺序存取在所有操作上都比直接存取慢。虽然顺序存取在搜索个别记录时可能很慢(需要从头开始读取),但它对于批量处理(如打印所有学生报告)非常高效,因为记录是物理上连续存放的。直接存取允许在几乎相同的时间内访问任何记录,非常适合需要快速检索单个学生详细信息的场景。许多人还忘记顺序文件常使用磁带,磁带便宜但具有顺序特性,而直接存取使用硬盘或SSD。顺序存取的一个优点是实现简单且存储开销低(无需索引结构)。缺点是无法在不重写整个文件的情况下高效地更新、插入或删除记录。在学生记录系统中,直接存取适合实时查询,而顺序存取适合学期末需要处理整个文件的报告生成。

To score full marks, always link the example to the application context, not just state definitions.

要获得满分,始终将示例与应用场景联系起来,而不仅仅是陈述定义。


8. SQL WHERE vs HAVING and Aggregation Errors | SQL中 WHERE 与 HAVING 及聚合错误

Question: A database table ‘Students’ contains fields ID, Name, YearGroup, Grade. Write an SQL statement to find the number of students in each year group where the count is greater than 50. Explain why HAVING is required instead of WHERE.

题目:数据库表 ‘Students’ 包含字段 ID, Name, YearGroup, Grade。编写一条SQL语句,找出每个年级组学生人数大于50的年级组。解释为什么必须使用 HAVING 而不是 WHERE。

A very common error is writing: SELECT YearGroup, COUNT(*) FROM Students WHERE COUNT(*) > 50 GROUP BY YearGroup; This is invalid because WHERE cannot be used with aggregate functions like COUNT(*). WHERE filters rows before aggregation, whereas HAVING filters groups after aggregation. Students also forget that any column not in an aggregate function must appear in the GROUP BY clause. The correct SQL is: SELECT YearGroup, COUNT(*) FROM Students GROUP BY YearGroup HAVING COUNT(*) > 50; Another typical mistake is confusing the order of clauses: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY. Writing HAVING before GROUP BY causes an error.

一个非常常见的错误是写出:SELECT YearGroup, COUNT(*) FROM Students WHERE COUNT(*) > 50 GROUP BY YearGroup;这是无效的,因为 WHERE 不能与像 COUNT(*) 这样的聚合函数一起使用。WHERE 在聚合之前过滤行,而 HAVING 在聚合之后过滤组。学生还经常忘记不在聚合函数中的列必须出现在 GROUP BY 子句中。正确的SQL是:SELECT YearGroup, COUNT(*) FROM Students GROUP BY YearGroup HAVING COUNT(*) > 50;另一个典型错误是混淆子句的顺序:SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY。在 GROUP BY 之前写 HAVING 会导致错误。

Remember: WHERE eliminates rows before grouping; HAVING eliminates groups after grouping. Always test your SQL logic by considering a small sample dataset to see if the output matches expectations.

记住:WHERE 在分组前消除行;HAVING 在分组后消除组。始终通过考虑一个小的样本数据集来测试你的SQL逻辑,看输出是否符合预期。


Published by TutorHao | 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