← 返回资讯屏轩教育 · 行业资讯

AS WJEC Computer Science: Common Misconceptions and Corrections | AS WJEC 计算机科学:常见误区与纠正方法

2026-07-25 07:19 · 本文部分内容由AI辅助创作

📚 AS WJEC Computer Science: Common Misconceptions and Corrections | AS WJEC 计算机科学:常见误区与纠正方法

In WJEC AS Computer Science, students often develop misunderstandings that can hinder exam performance. This article identifies frequent misconceptions across key topics and provides clear corrections to solidify your understanding.

在 WJEC AS 计算机科学中,学生常会形成一些误解,这些误解会影响考试成绩。本文指出了各关键主题中常见的误区,并给出清晰的纠正方法,以巩固你的理解。

1. Sign Extension in Two's Complement | 二进制补码的符号扩展

Misconception: Extending an 8-bit two's complement number to 16 bits simply involves adding zeros to the left, regardless of the sign.

误区:将8位二进制补码数扩展到16位,只需简单地在左侧补零,而不考虑符号。

Correction: In two's complement, sign extension must replicate the most significant bit (the sign bit) into all new higher-order bits. For example, the 8-bit negative number 11110010 (-14 in decimal) extended to 16 bits becomes 11111111 11110010, not 00000000 11110010. Zero-extending would turn it into a positive number and change its value.

纠正:在二进制补码中,符号扩展必须将最高有效位(符号位)复制到所有新增的高位中。例如,8位负数 11110010(十进制 -14)扩展到16位后应为 11111111 11110010,而非 00000000 11110010。补零会将其变为正数,从而改变数值。


2. Logical Shift vs Arithmetic Shift | 逻辑移位与算术移位

Misconception: Logical and arithmetic right shifts are identical; both simply move bits to the right and fill with zeros.

误区:逻辑右移和算术右移是相同的,都是将位向右移动并用零填充。

Correction: A logical right shift fills the vacant bits with zeros, whereas an arithmetic right shift preserves the sign by filling with the sign bit (for two's complement). Therefore, arithmetic right shift on a negative number keeps it negative, effectively performing integer division by powers of two with rounding towards negative infinity. Logical shift treats the pattern as an unsigned integer and does not maintain the sign.

纠正:逻辑右移用零填充空出的位,而算术右移则通过填充符号位(针对二进制补码)来保留符号。因此,对负数进行算术右移会保持其负数,实际上等效于除以2的幂并向负无穷方向舍入。逻辑移位将位模式视为无符号整数,不保留符号。


3. ASCII vs Unicode Character Encoding | ASCII 与 Unicode 字符编码

Misconception: ASCII and Unicode are just different names for the same thing, or Unicode simply uses 16 bits per character for all characters.

误区:ASCII 和 Unicode 是同一概念的不同名称,或者 Unicode 统一使用16位表示所有字符。

Correction: ASCII is a 7-bit character encoding for English characters and control codes. Unicode is a universal character set that assigns a unique code point to each character of every writing system. It can be implemented with different encodings such as UTF-8, UTF-16, and UTF-32, which vary in the number of bytes used per character. UTF-8 is backward-compatible with ASCII while handling millions of other characters.

纠正:ASCII 是一种7位字符编码,用于英文字符和控制码。Unicode 是一个通用字符集,为每种书写系统的每个字符分配唯一的码点。它可通过不同的编码方式(如 UTF-8、UTF-16、UTF-32)实现,每个字符使用的字节数不同。UTF-8 与 ASCII 向后兼容,同时能处理数百万其他字符。


4. Error Detection by Compilers and Interpreters | 编译器和解释器的错误检测

Misconception: A compiler or interpreter can detect all types of errors in a program, including logical errors.

误区:编译器或解释器能够检测程序中的所有错误,包括逻辑错误。

Correction: Compilers and interpreters detect syntax errors and some semantic errors (such as type mismatches), but they cannot detect logical errors. A logical error occurs when a program runs without crashing but produces incorrect results, e.g., miscalculating an average. Only testing and debugging by the programmer can reveal logical flaws. Additionally, runtime errors (such as division by zero) are detected during execution, not at compile time.

纠正:编译器和解释器能检测语法错误以及部分语义错误(如类型不匹配),但无法检测逻辑错误。当程序能正常运行但产生错误结果(如计算平均数出错)时,即为逻辑错误。只有通过程序员的测试和调试才能发现逻辑缺陷。此外,运行时错误(如除以零)在执行时才会被检测到,而非编译时。


5. Array Index Base | 数组索引基数

Misconception: In all programming languages, array indices start at 1, matching everyday counting.

误区:在所有编程语言中,数组索引都从 1 开始,与日常计数一致。

Correction: Most high-level languages taught in WJEC AS, such as Python, Java, and C#, use zero-based indexing; the first element is accessed with index 0. This is because the index represents an offset from the start of the array in memory. Confusing index bases can lead to off-by-one errors, especially when processing array bounds in loops. Always check the language specification.

纠正:WJEC AS 所教授的大多数高级语言(如 Python、Java、C#)使用基于零的索引;第一个元素用索引 0 访问。这是因为索引表示从数组起始内存地址的偏移量。混淆索引基数会导致“差一”错误,尤其在循环中处理数组边界时。务必查阅语言规范。


6. For and While Loop Interchangeability | for 与 while 循环的可互换性

Misconception: A for loop and a while loop are always interchangeable and produce identical results, with no performance difference.

误区:for 循环和 while 循环总是可以互换,且产生完全相同的结果,毫无性能差异。

Correction: Although many iterative tasks can be written with either construct, they are not fully interchangeable in every context. A for loop is typically used when the number of iterations is known beforehand, while a while loop is preferred when iteration depends on a condition evaluated at runtime. Moreover, the scope of loop control variables may differ. In some languages, a for loop defines its counter locally, while a while loop uses a variable declared outside. Choosing the appropriate loop improves readability and reduces errors.

纠正:虽然许多迭代任务可用任一结构编写,但它们并非在所有情况下都可互换。当迭代次数预先已知时,通常使用 for 循环;而当迭代依赖于运行时求值的条件时,更适合用 while 循环。此外,循环控制变量的作用域可能不同。在某些语言中,for 循环在局部定义其计数器,而 while 循环使用外部声明的变量。选择合适的循环能提高可读性并减少错误。


广告 / Sponsored

7. Recursion and Base Case | 递归与基础情况

Misconception: A recursive function just needs to call itself; a base case is optional if the problem eventually terminates naturally.

误区:递归函数只需调用自身即可;如果问题最终会自然终止,则可省略基础情况。

Correction: Every correct recursive algorithm must have at least one base case that stops the recursion and prevents infinite calls. Without a base case, the recursion continues until a stack overflow error occurs at runtime. The base case provides an explicit terminating condition, often for the smallest input size, ensuring the recursion unwinds correctly. Trace tables for recursive routines should clearly show the base-case checks.

纠正:每个正确的递归算法都必须至少有一个基础情况,用于停止递归并防止无限调用。如果没有基础情况,将以运行时栈溢出错误告终。基础情况提供了一个明确的终止条件(通常针对最小输入规模),确保递归正确回退。递归程序的跟踪表应清晰展示基础情况的检查。


8. Distributive Law Confusion in Boolean Algebra | 布尔代数中的分配律混淆

Misconception: A AND (B OR C) is always equivalent to (A AND B) OR C, just like in ordinary algebra.

误区:A AND (B OR C) 总是等价于 (A AND B) OR C,就像在普通代数中一样。

OR Z) (distributing OR over AND). The mistaken expression (A AND B) OR C is different because it applies OR to B and C without replicating A. To simplify correctly, absorb the ANDed variable across the terms inside the brackets. Using truth tables can verify identities.

纠正:布尔代数有两条分配律:X AND (Y OR Z) = (X AND Y) OR (X AND Z)(AND 对 OR 分配),以及 X OR (Y AND Z) = (X OR Y) AND (X OR Z)(OR 对 AND 分配)。错误的表达式 (A AND B) OR C 不同,因为它未将 A 复制到对 C 的运算中。在简化时,需要将 AND 的变量分配到括号内的每个项。使用真值表可以验证恒等式。


9. Virtual Memory is Just Extra RAM on Disk | 虚拟内存仅仅是磁盘上的额外 RAM

Misconception: Virtual memory means using a portion of the hard disk as if it were additional RAM, and the OS simply extends the total memory space without any performance cost.

误区:虚拟内存就是将部分硬盘当作额外 RAM 使用,操作系统仅扩展了总内存空间而无任何性能代价。

Correction: Virtual memory is a memory management technique that uses a combination of RAM and disk storage to create the illusion of a large contiguous address space. It operates through paging or segmentation, moving pages between physical memory and secondary storage. When a required page is not in RAM, a page fault occurs, causing a disk read that is thousands of times slower than RAM access. While virtual memory allows more processes to run, excessive paging (thrashing) can severely degrade system performance.

纠正:虚拟内存是一种内存管理技术,它结合 RAM 和磁盘存储,营造出巨大连续地址空间的假象。它通过分页或分段机制实现,在物理内存与辅助存储器之间移动页面。当所需页面不在 RAM 中时,会发生缺页,导致磁盘读取,其速度比 RAM 访问慢数千倍。虽然虚拟内存允许运行更多进程,但过度换页(抖动)会严重降低系统性能。


10. IP Address Equals MAC Address | IP 地址等同于 MAC 地址

Misconception: An IP address and a MAC address serve the same purpose and are permanently tied to a device, so they can be used interchangeably.

误区:IP 地址和 MAC 地址作用相同,且永久与设备绑定,因此可以互换使用。

Correction: A MAC address is a hardware address burnt into the network interface card (NIC) and operates at the data link layer. It is used for local network delivery. An IP address is a logical address assigned at the network layer and can change depending on the network. Routers use IP addresses to forward packets across different networks. The Address Resolution Protocol (ARP) maps IP addresses to MAC addresses for local delivery. They work together but are distinct layers and identifiers.

纠正:MAC 地址是烧录在网络接口卡(NIC)中的硬件地址,工作在数据链路层,用于本地网络传输。IP 地址是网络层分配的逻辑地址,可随网络变化。路由器使用 IP 地址在不同网络间转发数据包。地址解析协议(ARP)将 IP 地址映射到 MAC 地址以完成本地交付。两者协同工作,但属于不同层次和标识符。


11. Primary Key and Foreign Key Confusion | 主键与外键混淆

Misconception: A primary key and a foreign key are just two names for the same concept; a foreign key can duplicate values arbitrarily.

误区:主键和外键只是同一概念的两个名称;外键可以任意重复值。

Correction: A primary key uniquely identifies each record in a table and must be unique and not null. A foreign key is a field in one table that refers to the primary key of another table, establishing a relationship. Foreign keys may contain duplicate values if multiple records link to the same primary key record, but they must reference an existing primary key value or be null, ensuring referential integrity. Failure to enforce this leads to orphaned records.

纠正:主键唯一标识表中的每条记录,必须唯一且非空。外键是一个表中的字段,它引用另一个表的主键,用于建立关系。外键可以包含重复值(多个记录关联同一个主键记录),但必须引用存在的主键值或为空,从而保证参照完整性。不强制实施会导致孤立记录。


12. Program Counter Stores the Current Instruction | 程序计数器存放当前指令

Misconception: The Program Counter (PC) contains the instruction currently being executed by the CPU.

误区:程序计数器(PC)存放着 CPU 当前正在执行的指令。

Correction: The Program Counter (sometimes called the instruction pointer) holds the memory address of the next instruction to be fetched, not the instruction itself. The current instruction is stored in the Current Instruction Register (CIR) after being fetched. The PC increments automatically after a fetch, or is updated by branch instructions, to point to the following instruction in sequence. This fundamental misunderstanding can cause errors when tracing the fetch-decode-execute cycle.

纠正:程序计数器(有时称为指令指针)存放的是下一条要取出的指令的内存地址,而非指令本身。当前指令在取出后存放在当前指令寄存器(CIR)中。PC 在取指后自动递增,或根据跳转指令更新,以指向序列中的下一条指令。这一根本性误解会在跟踪取指-解码-执行周期时导致错误。


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

广告 / Sponsored
Linux高级程序设计(高等院校计算机技术十二五规划教材)/刘加海/季江民/浙江大学出版社
计算机 备考教辅 · 正版现货 · 与本文内容相关
查看详情 / View on Taobao参考价 ¥55.6

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

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao