📚 Common Misconceptions in AS Cambridge Computer Science and How to Correct Them | AS 剑桥计算机常见误区与纠正方法
AS Level Computer Science students often develop misunderstandings that can cost valuable marks in exams. This article identifies ten frequent misconceptions, explains why they are wrong, and provides clear corrections. By addressing these errors early, you can strengthen your conceptual understanding and boost your confidence for the Cambridge International AS examination.
AS 阶段的计算机科学学生常常会产生一些误解,这些误解可能会在考试中造成不必要的失分。本文总结了十个常见的误区,解释了它们错在哪里,并给出了清晰的纠正方法。及早纠正这些错误,可以帮助你加深对概念的理解,并增强应对剑桥国际 AS 考试的信心。
1. Misunderstanding Two's Complement Representation | 对二进制补码表示法的误解
Many students incorrectly believe that the most significant bit (MSB) in Two's Complement is merely a sign flag, while the remaining seven bits hold the absolute value, similar to sign-and-magnitude representation. This leads to wrong conversions, especially for negative numbers.
很多学生误以为二进制补码中的最高有效位(MSB)只是一个符号标志,剩下的七位存有绝对值,类似于原码表示法。这会导致错误的转换,尤其是对于负数。
In Two's Complement, the MSB carries a negative weight. For an 8-bit number, the MSB represents -128 rather than -0. To find the decimal value of a negative binary number, you should invert all bits, add 1, and then treat the result as a positive magnitude. For example, 1111 1100 is not -124; it is -4 because flipping bits gives 0000 0011, adding 1 gives 0000 0100 (4), so the value is -4.
在二进制补码中,MSB 携带的是负权重。对于一个 8 位二进制数,MSB 表示的是 -128 而不是 -0。要找出负数二进制数的十进制值,应该把所有位取反,加 1,然后把结果当作正数来读取。例如,1111 1100 并不是 -124,而是 -4,因为取反得到 0000 0011,加 1 得到 0000 0100(即十进制的 4),所以原来的值是 -4。
Similarly, when converting a negative decimal like -5 to Two's Complement, you must write the positive binary (0000 0101), flip bits (1111 1010), and add 1 (1111 1011). Simply setting the MSB to 1 on the positive number will give the wrong result.
类似地,在将负数(例如 -5)转换为二进制补码时,必须先写出正数的二进制形式(0000 0101),取反(1111 1010)再加 1(1111 1011)。直接在最左边加一个 1 作为符号位则会得到错误的结果。
2. Confusion Between Logical Shifts and Arithmetic Shifts | 逻辑移位与算术移位的混淆
A frequent error is to use a logical shift when an arithmetic shift is required, or to believe that shifting left always multiplies by two regardless of sign. With Two's Complement, arithmetic right shift preserves the sign bit, while logical right shift fills with zeros.
一个常见的错误是,在需要算术移位的时候使用了逻辑移位,或者认为无论正负数,左移就一定是乘以 2。在二进制补码中,算术右移会保留符号位,而逻辑右移则用 0 填充空位。
If you apply a logical right shift to 1111 1100 (-4), the result becomes 0111 1110 (+126), which is completely wrong. An arithmetic right shift would yield 1111 1110 (-2), correctly preserving the sign and performing division by two. Remember: use arithmetic shifts for signed integers, and logical shifts for unsigned data or bitwise operations.
如果对 1111 1100(-4)应用逻辑右移,结果会变成 0111 1110(+126),这完全是错的。算术右移则会得到 1111 1110(-2),正确地保留了符号并实现了除以 2。请记住:对有符号整数使用算术移位,对无符号数据或位操作使用逻辑移位。
3. Mixing Up LDR and STR in Assembly Language | 汇编语言中 LDR 与 STR 的混淆
Students often misuse LDR (load) and STR (store) in ARM assembly or the Cambridge 9618 instruction set. A typical mistake is writing LDR R1, [R2] when they intend to write data from a register into memory.
学生在 ARM 汇编或剑桥 9618 指令集中经常会用错 LDR(加载)和 STR(存储)。一个典型的错误是,当他们想把数据从寄存器写入内存时,却写成了 LDR R1, [R2]。
LDR copies a value from a memory address into a register. STR copies a value from a register into a memory address. For example, to store the content of R0 into the address held in R5, you must use STR R0, [R5]. Using LDR would overwrite R0 with the value at that address, which is the opposite of what is intended.
LDR 的作用是把内存地址中的值复制到一个寄存器中。STR 则是把寄存器中的值复制到一个内存地址中。例如,要把 R0 的内容存放到 R5 所指向的地址中,必须使用 STR R0, [R5]。如果错误地使用了 LDR,就会用该地址原有的值覆盖 R0,结果与目标完全相反。
Another common error is forgetting the square brackets when using register-indirect addressing. LDR R1, R2 is invalid; the correct form is LDR R1, [R2].
另一个常见错误是使用寄存器间接寻址时忘记加方括号。LDR R1, R2 是无效的;正确的写法是 LDR R1, [R2]。
4. Assuming Arrays Are Always Better Than Linked Lists | 认为数组总是优于链表
A common oversimplification is to think that arrays are superior to linked lists in every situation because they allow direct access via an index. However, this ignores the cost of insertion and deletion.
一种常见的过度简化是认为数组在任何情况下都优于链表,因为它们支持通过索引直接访问。然而,这忽略了插入和删除操作的成本。
Arrays indeed give O(1) time for reading or writing at a known index, but inserting or deleting an element in the middle requires shifting all subsequent elements, taking O(n) time. Linked lists allow insertion and deletion at any point in O(1) time once the position is located, because only pointers need to be changed. In scenarios with frequent insertions and deletions, a linked list can be more efficient even though access is O(n).
确实,数组在已知索引处读取或写入的时间复杂度为 O(1),但在中间插入或删除元素时需要移动其后的所有元素,时间复杂度为 O(n)。链表则允许在定位之后,以 O(1) 的时间在任何位置进行插入和删除,因为只需要修改指针。在频繁进行插入和删除操作的场景下,即使访问的时间复杂度为 O(n),链表的整体效率也可能更高。
Also, dynamic arrays may need to resize when they are full, causing unpredictable delays. Linked lists grow and shrink naturally, although they use extra memory for pointers. Students must choose the data structure based on actual usage patterns, not on a blanket assumption.
此外,动态数组在填满时可能需要扩容,导致不可预测的延迟。链表可以自然地增长和缩减,尽管它们需要额外的内存来存储指针。学生必须根据实际使用模式来选择数据结构,而不是基于一个笼统的假设。
5. Confusion About Stable vs. Unstable Sorting Algorithms | 排序算法稳定性混淆
Many learners memorise that 'bubble sort is stable' and 'quicksort is unstable' without understanding what stability means. Stability refers to preserving the relative order of records with equal keys.
许多学生只是记住了 "冒泡排序是稳定的" 而 "快速排序是不稳定的",却不理解稳定性到底意味着什么。稳定性是指在排序过程中,具有相同键值的记录的相对顺序保持不变。
For example, if two students have the same test score but different student IDs, a stable sort will keep the original order of those two students after sorting by score. Bubble sort and insertion sort are stable; selection sort and the standard in-place quicksort are unstable. However, it is possible to implement a stable quicksort by using extra memory, so the property depends on the implementation, not just the algorithm's name. In exams, always check the context and the description of the algorithm being used.
例如,如果两个学生的考试成绩相同,但学号不同,那么稳定的排序会在按照成绩排序后,保持这两个学生原本的先后顺序。冒泡排序和插入排序是稳定的;选择排序和常见的原地快速排序是不稳定的。但是,通过使用额外的内存也可以实现稳定的快速排序,因此这一性质取决于具体实现,而不仅仅是算法的名称。在考试中,一定要结合上下文和所描述算法的具体细节来判断。
6. Misinterpreting IP and MAC Addresses | 混淆 IP 地址与 MAC 地址
A widespread mistake is to believe that IP addresses and MAC addresses are interchangeable or that a MAC address changes as a device moves between networks. Some students also think an IP address is permanently bound to a device.
一个普遍的错误是认为 IP 地址和 MAC 地址可以互换,或者认为 MAC 地址会随着设备在不同网络之间移动而改变。有些学生还会认为 IP 地址是永久绑定在某台设备上的。
A MAC address is a hardware identifier burned into the network interface card (NIC) and typically remains fixed. It is used for communication within the same local network segment. An IP address is a logical address assigned to a device when it connects to a network; it can change when the device connects to a different network or when the DHCP lease expires. MAC addresses operate at the Data Link layer (Layer 2), while IP addresses operate at the Network layer (Layer 3). They serve different purposes and are both essential for delivering data across the internet.
MAC 地址是烧录在网络接口卡(NIC)中的硬件标识符,通常保持固定不变。它用于同一局域网段内的通信。IP 地址则是设备连接到网络时分配的逻辑地址;当设备连接到不同网络或 DHCP 租约到期时,IP 地址可能会改变。MAC 地址工作在数据链路层(第二层),IP 地址工作在网络层(第三层)。它们服务于不同的目的,并且要在互联网中传输数据,两者缺一不可。
7. Incorrect Subnet Mask Calculations | 子网掩码计算错误
Many AS candidates struggle with determining the network and host portions of an IP address. A typical error is to assume that the default subnet mask always applies, leading to wrong identification of the network ID or broadcast address.
许多 AS 考生在确定 IP 地址的网络部分和主机部分时感到困难。一个典型的错误是假定默认的子网掩码总是适用,从而导致网络 ID 或广播地址识别错误。
When a custom subnet mask like 255.255.255.240 is given, students must convert the IP address and mask to binary, then perform a bitwise AND to find the network ID. The number of host bits determines the number of usable addresses (2n - 2). For example, with a /28 mask (255.255.255.240), the last octet provides 4 host bits, giving 14 usable hosts. Forgetting to subtract 2 for the network and broadcast addresses is another common slip.
当给出了类似 255.255.255.240 这样的自定义子网掩码时,学生必须将 IP 地址和掩码都转换为二进制,然后进行按位 AND 运算才能找到网络 ID。主机位的位数决定了可用地址的数量(2n - 2)。例如,对于 /28 掩码(255.255.255.240),最后一个字节提供了 4 个主机位,可提供 14 个可用主机。忘记为网络地址和广播地址减去 2 是另一个常见的疏忽。
8. Misunderstanding the Fetch-Decode-Execute Cycle and the Program Counter | 误解取指-译码-执行周期和程序计数器
A very common exam error is to state that the Program Counter (PC) always increments by 1 after each instruction fetch. In many architectures, the PC increments by the instruction length in bytes, not by the number of instructions.
一个非常常见的考试错误是声称程序计数器(PC)在每次取指后总是加 1。在许多体系结构中,PC 是按指令的字节长度递增的,而不是按指令的条数递增。
If each instruction is 2 bytes long, the PC will increase by 2. Also, jump and branch instructions will load a completely new address into the PC, not simply add an offset. The PC always holds the address of the next instruction to be fetched, not the current one, once the fetch stage is complete. Describing the cycle accurately—MAR ← PC, then MDR ← [memory], then CIR ← MDR, and PC ← PC + length—is essential for gaining full marks.
如果每条指令长 2 字节,那么 PC 就会加 2。而且,跳转和分支指令会将一个全新的地址加载到 PC 中,而不仅仅是增加一个偏移量。一旦取出阶段完成,PC 中存放的总是下一条待取指令的地址,而不是当前指令的地址。准确描述该周期——MAR ← PC,然后 MDR ← [内存],然后 CIR ← MDR,然后 PC ← PC + 指令长度——对于获得满分至关重要。
9. Thinking That an Interrupt Immediately Halts Execution | 认为中断会立即停止程序的执行
Students often imagine that as soon as an interrupt signal arrives, the processor instantly stops what it is doing and services the interrupt. In reality, the current instruction is usually completed before the interrupt is acknowledged.
学生们经常设想,一旦中断信号到达,处理器就会立刻停下手中的工作去处理中断。但实际上,当前指令通常会在确认中断之前执行完毕。
The processor checks for interrupts at specific points during the fetch-decode-execute cycle, commonly at the end of each cycle. After finishing the current instruction, the processor saves the contents of registers (including the PC and status register) onto the stack before jumping to the Interrupt Service Routine (ISR). This ensures the program can resume correctly once the ISR completes. Understanding this sequence is important for both the interrupt topic and for explaining how operating systems manage multitasking.
处理器在取指-译码-执行周期中的特定时刻(通常是在每个周期结束时)检查中断请求。完成当前指令后,处理器将寄存器(包括 PC 和状态寄存器)的内容保存到堆栈中,然后跳转到中断服务例程(ISR)。这确保了程序可以在 ISR 完成后正确恢复执行。理解这一顺序对于中断这一主题,以及解释操作系统如何管理多任务都非常重要。
10. Assuming Primary Keys Must Be Integers | 认为主键必须是整数
When designing databases, a widespread misconception is that a primary key field must be an integer, or that it must be an auto-increment number. While integer primary keys are common for performance, it is not a rule.
在设计数据库时,一个普遍的误解是主键字段必须是整数,或者必须是自动递增的数字。虽然出于性能考虑,整数主键很常见,但这并不是一项规则。
A primary key can be any data type—text, date, or even a composite of multiple columns—as long as it uniquely identifies each record and does not contain NULL values. For example, a table of countries could use the ISO country code (CHAR(2)) as the primary key. In exams, the key requirement is uniqueness and non-null, not the data type itself.
主键可以是任何数据类型——文本、日期,甚至是多个列组成的复合主键——只要它能够唯一标识每条记录,并且不包含 NULL 值。例如,一个国家的表可以使用 ISO 国家代码(CHAR(2))作为主键。考试中,关键的要求是唯一性和非空,而不是数据类型本身。
Published by TutorHao | AS Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

或截图后用「扫一扫 → 相册」选择本图