📚 IB & WJEC Computer Science: Concept Clarifications | IB 与 WJEC 计算机概念辨析
Understanding subtle differences between core computer science concepts is essential for both IB and WJEC examinations. This article clarifies commonly confused terms, from compilers vs interpreters to recursion vs iteration, using paired English and Chinese explanations.
理解计算机科学核心概念之间的细微差别对 IB 和 WJEC 考试至关重要。本文以中英对照的方式澄清编译器与解释器、递归与迭代等易混淆术语。
1. Compiler vs Interpreter | 编译器与解释器
A compiler translates the entire source code into machine code (or bytecode) before execution. The resulting executable can run independently of the source code and the compiler. Languages like C and C++ typically use compilers.
编译器在执行前将整个源代码翻译成机器码(或字节码)。生成的可执行文件可以独立于源代码和编译器运行。C 和 C++ 等语言通常使用编译器。
An interpreter, by contrast, reads and executes the source code line by line without producing a separate executable. This means the source code must be reinterpreted each time the program runs. Python and JavaScript are often implemented with interpreters.
相反,解释器逐行读取并执行源代码,不生成独立的可执行文件。这意味着每次运行程序时都需要重新解释源代码。Python 和 JavaScript 常通过解释器实现。
Key distinction: compiled programs generally offer faster execution, while interpreted programs provide greater portability and easier debugging during development.
关键区别:编译后的程序通常执行速度更快,而解释型程序在开发过程中提供更好的可移植性和更轻松的调试。
2. High-Level Language vs Low-Level Language | 高级语言与低级语言
High-level languages (HLLs) like Python, Java, and C# use syntax that is closer to human language, abstracting away hardware details. They are portable across different platforms and require compilers or interpreters to convert code into machine language.
Python、Java 和 C# 等高级语言使用更接近人类语言的语法,抽象了硬件细节。它们可跨不同平台移植,并需要编译器或解释器将代码转换成机器语言。
Low-level languages include machine code (binary) and assembly language. Assembly uses mnemonics (e.g., MOV, ADD) that correspond directly to machine instructions. These languages give precise control over hardware but are not portable and are difficult for humans to read and write.
低级语言包括机器码(二进制)和汇编语言。汇编语言使用助记符(如 MOV、ADD),与机器指令直接对应。这些语言能精确控制硬件,但不可移植,且人类难以读写。
The trade-off: HLLs boost programmer productivity; low-level languages maximize execution speed and hardware control.
权衡:高级语言提高程序员生产力;低级语言最大化执行速度与硬件控制。
3. RAM vs ROM | 随机存储器与只读存储器
RAM (Random Access Memory) is volatile memory that temporarily stores data and instructions the CPU is actively using. When the power is turned off, all data in RAM is lost. RAM is typically used for running applications and the operating system.
RAM(随机存取存储器)是易失性存储器,暂时存储 CPU 正在使用的数据和指令。断电后 RAM 中的所有数据会丢失。RAM 通常用于运行应用程序和操作系统。
ROM (Read-Only Memory) is non-volatile; it retains data even without power. It stores firmware or boot instructions (e.g., BIOS/UEFI) that rarely change. Some types (like EEPROM) can be rewritten, but only with special procedures.
ROM(只读存储器)是非易失性的,即使断电也能保留数据。它存储固件或引导指令(如 BIOS/UEFI),这些内容极少更改。某些类型(如 EEPROM)可重写,但需要特殊操作。
Thus, RAM provides fast read/write for temporary data, while ROM offers permanent storage for essential startup routines.
因此,RAM 为临时数据提供快速读写,而 ROM 为必要的启动例程提供永久存储。
4. Abstraction vs Encapsulation | 抽象与封装
Abstraction focuses on hiding complex implementation details and exposing only essential features to the user. For example, a car's steering wheel abstracts the underlying mechanics. In programming, abstract classes and interfaces define what an object can do without specifying how.
抽象专注于隐藏复杂的实现细节,仅向用户暴露必要特性。例如,汽车方向盘抽象了底层机械结构。在编程中,抽象类和接口定义了对象能做什么而不指定如何做。
Encapsulation is about bundling data and the methods that operate on that data into a single unit (a class) and restricting direct access to some components. This is enforced through access modifiers like private and public. Encapsulation protects data integrity.
封装是指将数据和操作数据的方法绑定到一个单元(类)中,并限制对某些组件的直接访问。这通过 private 和 public 等访问修饰符实现。封装保护数据完整性。
In short: abstraction is an 'outside view' (what it does); encapsulation is an 'inside protection' (how it protects data).
简言之:抽象是“外部视角”(做什么),封装是“内部保护”(如何保护数据)。
5. TCP vs UDP | 传输控制协议与用户数据报协议
TCP (Transmission Control Protocol) is connection-oriented: it establishes a reliable link before data transfer, guarantees delivery through acknowledgements, and orders packets correctly. It is used for web browsing (HTTP/3 uses QUIC but historically TCP), email, and file transfers where data integrity is critical.
TCP(传输控制协议)面向连接:在数据传输前建立可靠链路,通过确认保证送达,并正确排序数据包。用于网页浏览(HTTP/3 使用 QUIC,但历史上为 TCP)、电子邮件和文件传输等数据完整性至关重要的场景。
UDP (User Datagram Protocol) is connectionless: it sends packets without prior handshaking and does not guarantee delivery or order. This makes UDP faster and suitable for real-time applications like video streaming, online gaming, and VoIP, where occasional packet loss is acceptable.
UDP(用户数据报协议)无连接:无需事先握手即发送数据包,不保证送达或顺序。因此 UDP 速度更快,适用于视频流、在线游戏和 VoIP 等实时应用,可接受偶尔的数据包丢失。
Choose TCP for reliability, UDP for speed and low latency.
选择 TCP 时看重可靠性,选择 UDP 时看重速度和低延迟。
6. IPv4 vs IPv6 | 互联网协议版本4与版本6
IPv4 uses 32-bit addresses, typically written as four decimal octets (e.g., 192.168.0.1), providing about 4.3 billion unique addresses. Address exhaustion led to the development of IPv6.
IPv4 使用 32 位地址,通常写为四组十进制数(如 192.168.0.1),提供约 43 亿个唯一地址。地址枯竭推动了 IPv6 的开发。
IPv6 employs 128-bit addresses, represented as eight groups of four hexadecimal digits (e.g., 2001:0db8:85a3::8a2e:0370:7334). This expands the address space to an astronomical number, plus it brings built-in features like simplified header format, better security (IPsec mandatory), and auto-configuration.
IPv6 采用 128 位地址,表示为八组四位十六进制数(如 2001:0db8:85a3::8a2e:0370:7334),地址空间极大扩展,而且自带简化报头格式、更好的安全性(IPsec 强制)和自动配置等特性。
Both can coexist, but IPv6 is gradually replacing IPv4 to accommodate the growing number of Internet-connected devices.
两者可以共存,但 IPv6 正逐步取代 IPv4,以容纳不断增长的联网设备数量。
7. Lossy vs Lossless Compression | 有损压缩与无损压缩
Lossless compression reduces file size without any loss of information, so the original data can be perfectly reconstructed. Examples include FLAC for audio, PNG for images, and ZIP for general files. Typical algorithms exploit statistical redundancy (e.g., run-length encoding, Huffman coding).
无损压缩在没有任何信息丢失的情况下减小文件大小,因此可以完美重建原始数据。示例包括音频的 FLAC、图像的 PNG 和通用文件的 ZIP。典型算法利用统计冗余(如游程编码、哈夫曼编码)。
Lossy compression achieves higher compression ratios by permanently discarding some data that is less perceptible to human senses. This is common in JPEG images, MP3 audio, and MPEG video. The result is a trade-off between file size and quality.
有损压缩通过永久丢弃人类感官不太敏感的数据来实现更高的压缩比。常见于 JPEG 图像、MP3 音频和 MPEG 视频。这需要权衡文件大小与质量。
Use lossless when exact replication is required; lossy when acceptable quality degradation yields significant storage savings.
需要精确复制时使用无损;当可接受的质量下降能显著节省存储时使用有损。
8. Symmetric vs Asymmetric Encryption | 对称加密与非对称加密
Symmetric encryption uses a single key for both encryption and decryption. The sender and receiver must share that secret key securely beforehand. It is fast and efficient for bulk data encryption. AES and DES
Published by TutorHao | IB Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

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