IB Computer Science: Typical Exam Questions Explained | IB 计算机:典型例题详解

📚 IB Computer Science: Typical Exam Questions Explained | IB 计算机:典型例题详解

Mastering IB Computer Science requires more than memorising facts — it demands the ability to apply concepts to a wide range of problems. This article walks you through carefully selected typical exam questions, covering topics from system fundamentals to object‑oriented programming and databases. Each section presents a question, a thorough analysis of the solution, and bilingual explanations to reinforce your understanding.

掌握 IB 计算机科学不仅仅需要记忆事实,更需要将概念灵活应用于各种问题的能力。本文精选了典型考题,涵盖系统基础、面向对象编程和数据库等主题,逐题剖析,并提供中英双语解析,帮助你巩固理解。


1. Number Systems: Binary to Hexadecimal Conversion | 数制:二进制与十六进制转换

Question: Convert the binary number 110110101101₂ into hexadecimal. Show all working.

题目:将二进制数 110110101101₂ 转换为十六进制,写出所有步骤。

Solution & Analysis: Group the binary digits into nibbles (groups of four) from right to left. The given binary number is 1101 1010 1101? Wait, let’s count: 110110101101 has 12 bits. Grouped as: 1101 1010 1101. Now convert each nibble independently: 1101₂ = D (13 in decimal), 1010₂ = A (10 in decimal), 1101₂ = D. Therefore, the hexadecimal equivalent is DAD₁₆. Always pad with leading zeros if the number of bits is not a multiple of four, but here it fits exactly.

解析:从右向左将二进制数每四位分为一组(半字节)。给定的二进制数为 110110101101,共 12 位,恰好分为 1101 1010 1101。分别转换各组:1101₂ = D(十进制 13),1010₂ = A(十进制 10),1101₂ = D。因此十六进制结果为 DAD₁₆。如果位数不足 4 的倍数,需在左侧补零,但本题正好匹配。


2. Logic Gates and Truth Tables | 逻辑门与真值表

Question: Construct the truth table for the logic circuit defined by (A AND B) OR (NOT C). Label all intermediate columns.

题目:给出逻辑表达式 (A AND B) OR (NOT C) 的真值表,并标注所有中间列。

Solution & Analysis: Create columns for A, B, C, A AND B, NOT C, and the final output. There are 2³ = 8 rows. For each row, compute A AND B, then NOT C, and finally the OR of these two intermediate results. The truth table shows that the final output is 1 except when both A AND B = 0 and NOT C = 0, i.e., when C = 1 and at least one of A or B is 0. Such systematic evaluation is key in IB exams, as it demonstrates understanding of operator precedence and circuit behaviour.

解析:需要列出 A、B、C、A AND B、NOT C 以及最终输出列。共有 2³ = 8 行。逐行计算 A AND B 和 NOT C,再对两者进行 OR 运算。真值表显示只有当 (A AND B) = 0 且 NOT C = 0 时输出才为 0,即当 C = 1 且 A 和 B 中至少有一个为 0。这类系统化评估考察对运算符优先级和电路行为的理解,是考试常见题型。


3. System Fundamentals: Input and Output Devices | 系统基础:输入与输出设备

Question: A library uses barcode scanners and receipt printers at the checkout desk. Identify the type of each device and explain how they interact with the computer system.

题目:某图书馆在借阅台使用条码扫描器和收据打印机。指出各自设备类型,并解释它们如何与计算机系统交互。

Solution & Analysis: The barcode scanner is an input device; it captures the barcode pattern and translates it into digital data representing the book ID. This data is sent to the computer system, which looks up the member and book records. The receipt printer is an output device; it receives processed data from the system and produces a physical slip. The interaction typically follows the input‑process‑output model: scan (input) → database lookup and transaction update (process) → print receipt (output). IB exams often expect you to identify not just the device category, but also the role it plays in the broader system.

解析:条码扫描器是输入设备,它捕捉条码图案并转换为代表图书编号的数字数据,传送给计算机系统,以查询会员及图书记录。收据打印机是输出设备,接收系统处理后的数据并生成实体凭条。交互遵循“输入‑处理‑输出”模型:扫描(输入)→数据库查询与事务更新(处理)→打印收据(输出)。IB 考试常要求不仅要辨别设备类型,还要描述其在整体系统中的角色。


4. Operating Systems and Resource Management | 操作系统与资源管理

Question: Explain how a modern operating system manages memory using virtual memory and paging. Include the roles of the memory management unit (MMU).

题目:解释现代操作系统如何通过虚拟内存和分页来管理内存,说明内存管理单元(MMU)的作用。

Solution & Analysis: Virtual memory allows a computer to use disk space as an extension of RAM, giving the illusion of a larger main memory. The address space is divided into fixed‑size blocks called pages. When a process references a page not currently in physical memory, a page fault occurs, triggering the OS to load the required page from disk. The MMU translates virtual addresses to physical addresses using a page table, providing protection and isolation between processes. This mechanism enables multitasking and efficient memory usage. IB candidates should link paging, page tables, and MMU functions clearly in their answers.

解析:虚拟内存使计算机能够将磁盘空间作为 RAM 的扩展,营造出更大的主存空间。地址空间被划分为固定大小的块,称为页。当进程引用的页不在物理内存中时,发生缺页异常,操作系统会将所需页从磁盘加载到内存。MMU 利用页表将虚拟地址转换为物理地址,同时提供进程间的保护与隔离。此机制支持多任务和高效内存利用。IB 考生需要在答案中清晰关联分页、页表和 MMU 的功能。


5. Networks: OSI Model and TCP/IP Stack | 网络:OSI 模型与 TCP/IP 协议栈

Question: Compare the OSI model and the TCP/IP stack by stating the layers present in each and explaining why TCP/IP better reflects internet architecture.

题目:比较 OSI 模型和 TCP/IP 协议栈,列出各自的层次,并解释为何 TCP/IP 更具互联网架构的代表性。

Solution & Analysis: The OSI model has seven layers: Physical, Data Link, Network, Transport, Session, Presentation, Application. The TCP/IP stack has four layers: Network Access (Link), Internet, Transport, Application. TCP/IP merges the Session, Presentation, and Application layers of OSI into a single Application layer, reflecting real‑world protocols such as HTTP, SMTP, and FTP that handle presentation and session control internally. Additionally, TCP/IP was designed around the Internet’s packet‑switched nature, whereas OSI is a more generic theoretical framework. In exam responses, students should emphasise that TCP/IP’s protocol‑driven design matches the actual protocols used on the Internet.

解析:OSI 模型有七层:物理层、数据链路层、网络层、传输层、会话层、表示层、应用层。TCP/IP 协议栈为四层:网络接入层、互联网层、传输层、应用层。TCP/IP 将 OSI 的会话层、表示层和应用层合并为一个应用层,这更贴合实际协议(如 HTTP、SMTP、FTP)在设计时自行处理表示和会话控制的特点。此外,TCP/IP 体系围绕互联网的分组交换特性构建,而 OSI 是一个更通用的理论框架。考试中应强调 TCP/IP 以协议为核心,与实际互联网使用的协议一致。


6. Data Structures: Stack Operations | 数据结构:栈操作

Question: A stack is initially empty. Perform the following operations in sequence: push(5), push(3), pop(), push(7), push(1), pop(), pop(). Show the contents of the stack after each operation and state the final top element.

题目:初始栈为空,依次执行:push(5), push(3), pop(), push(7), push(1), pop(), pop()。写出每一步操作后栈的内容,并指出最终栈顶元素。

Solution & Analysis: After push(5) → [5]; push(3) → [5,3]; pop() removes 3 → [5]; push(7) → [5,7]; push(1) → [5,7,1]; pop() removes 1 → [5,7]; pop() removes 7 → [5]. Final stack contains [5] with top element 5. Stacks follow Last‑In‑First‑Out (LIFO) order, which is essential knowledge for IB Paper 2 (HL/SL) when dealing with expression evaluation or recursion simulation.

解析:push(5) → [5];push(3) → [5,3];pop() 移除 3 → [5];push(7) → [5,7];push(1) → [5,7,1];pop() 移除 1 → [5,7];pop() 移除 7 → [5]。最终栈内容为 [5],栈顶元素为 5。栈遵循后进先出(LIFO)原则,这是 IB 试卷二中表达式求值或递归模拟等考题的基础。


7. Object‑Oriented Programming: Inheritance and Polymorphism | 面向对象编程:继承与多态

Question: Define a superclass Vehicle with attributes make and model, and a method displayInfo(). Then create a subclass ElectricCar that inherits from Vehicle, adds an attribute batteryCapacity, and overrides displayInfo(). Explain how polymorphism is demonstrated.

题目:定义一个超类 Vehicle,具有属性 makemodel,以及方法 displayInfo()。然后创建子类 ElectricCar,继承自 Vehicle,添加属性 batteryCapacity,并重写 displayInfo()。解释如何体现多态。

Solution & Analysis: In code (pseudocode), the subclass ElectricCar would call the superclass constructor to set make and model, then set its own batteryCapacity. Its overridden displayInfo() might call the superclass version and then append battery details. Polymorphism occurs when a variable of type Vehicle refers to an ElectricCar object; calling displayInfo() on that reference will invoke the ElectricCar version at runtime (dynamic binding). This is a core concept that IB exam questions often explore through trace tables or UML diagrams.

解析:在代码(伪代码)中,子类 ElectricCar 会调用超类构造函数设置 makemodel,再设置自身的 batteryCapacity。其重写的 displayInfo() 方法可能先调用超类版本,再附加电池信息。当声明为 Vehicle 类型的变量指向一个 ElectricCar 对象时,通过该引用调用 displayInfo() 会在运行时实际执行子类的版本(动态绑定),这便是多态的体现。IB 考试常通过跟踪表或 UML 图来考察这一核心概念。


8. Computational Thinking: Tracing Pseudocode | 计算思维:伪代码跟踪

Question: Trace the following pseudocode when x = 4 and y = 3. State the output.

loop while x > 0 and y > 0
    if x > y then
        x = x - y
    else
        y = y - x
    end if
end loop
output x + y

题目:当 x = 4, y = 3 时,跟踪以下伪代码,给出输出结果。

Solution & Analysis: Let’s trace iteration by iteration. Initially x = 4, y = 3. Loop condition true. x > y (4 > 3) → x = 4 – 3 = 1, y remains 3. Next iteration: x = 1, y = 3. Condition true, x > y? 1 > 3 false → y = y – x = 3 – 1 = 2. Next: x = 1, y = 2. Condition true, x > y? false → y = 2 – 1 = 1. Next: x = 1, y = 1. Condition true, x > y? false → y = 1 – 1 = 0. Now x = 1, y = 0. Loop condition (x > 0 and y > 0) fails. Final output = x + y = 1 + 0 = 1. This algorithm essentially computes the greatest common divisor (like Euclid’s algorithm) but with a subtle difference — here after the loop the sum equals the gcd. Tracing pseudocode is a fundamental skill in IB Paper 1 and Paper 2.

解析:逐步跟踪。初始 x = 4, y = 3,循环条件满足。x > y(4>3)成立 → x = 1, y = 3。下一轮:x=1, y=3,条件满足,x > y?否 → y = 3-1=2。再下一轮:x=1, y=2,条件满足,x > y?否 → y = 2-1=1。继续:x=1, y=1,条件满足,x > y?否 → y = 1-1=0。此时 x=1, y=0,循环条件(x>0 且 y>0)不满足,退出。输出 x+y = 1+0 = 1。此算法实质上计算最大公约数(类似欧几里得算法),但这里最终的和即为 gcd。跟踪伪代码是 IB 试卷一和试卷二的基本功。


9. Database: SQL Query with Aggregation | 数据库:含聚合函数的 SQL 查询

Question: Given a table Students (ID, Name, Grade) and a table Enrolments (StudentID, Subject, Score), write an SQL query to find the average score per subject for students in Grade 12, displayed as Subject and AvgScore. Only include subjects with more than 10 students.

题目:设有表 Students (ID, Name, Grade) 和表 Enrolments (StudentID, Subject, Score)。请写一条 SQL 查询,计算 12 年级学生各科的平均分,显示科目和平均分(AvgScore),只包含参与学生数超过 10 人的科目。

Solution & Analysis: The query involves joining Students and Enrolments on ID = StudentID, filtering by Grade = 12, grouping by Subject, and then calculating AVG(Score). To enforce the “more than 10 students” rule, we use HAVING COUNT(*) > 10. A correct SQL statement would be:

SELECT E.Subject, AVG(E.Score) AS AvgScore
FROM Students S JOIN Enrolments E ON S.ID = E.StudentID
WHERE S.Grade = 12
GROUP BY E.Subject
HAVING COUNT(*) > 10;

Note the order of clauses: JOIN, WHERE, GROUP BY, HAVING. IB database questions often test this precise syntax, especially the use of HAVING for aggregate conditions.

解析:该查询需要连接 StudentsEnrolments 表(ID = StudentID),筛选 Grade = 12,按 Subject 分组,然后计算 AVG(Score)。为了满足“学生数超过 10 人”的条件,需使用 HAVING COUNT(*) > 10。正确的 SQL 语句如上所示。注意子句顺序:JOIN → WHERE → GROUP BY → HAVING。IB 数据库题目经常考察这种精确语法,尤其是聚合条件必须用 HAVING 而非 WHERE。


10. Computer Architecture: Fetch‑Decode‑Execute Cycle | 计算机体系结构:取指‑译码‑执行周期

Question: Describe the steps of the fetch‑decode‑execute cycle, and explain the roles of the program counter (PC), memory address register (MAR), memory data register (MDR), and current instruction register (CIR).

题目:描述取指‑译码‑执行周期的步骤,并解释程序计数器(PC)、内存地址寄存器(MAR)、内存数据寄存器(MDR)和当前指令寄存器(CIR)的作用。

Solution & Analysis: Fetch: The PC holds the address of the next instruction. This address is copied to the MAR, and the PC is incremented. The instruction at that memory address is read into the MDR and moved to the CIR. Decode: The control unit interprets the opcode in the CIR. Execute: The control unit sends signals to carry out the instruction, using the ALU for arithmetic/logic operations. The registers mentioned are crucial: PC points to the next instruction; MAR holds the address to be read/written; MDR buffers data transferring between memory and CPU; CIR holds the current instruction being decoded/executed. A precise sequence with register involvement is often examined in IB Paper 1.

解析:取指:PC 存放下一条指令的地址,该地址复制到 MAR,同时 PC 递增。内存中该地址的指令被读入 MDR,再移入 CIR。译码:控制单元解析 CIR 中的操作码。执行:控制单元发送信号执行指令,如需运算则使用 ALU。各寄存器角色明确:PC 指向下一条指令;MAR 存放待读写的地址;MDR 缓冲内存与 CPU 间的数据;CIR 保存正在译码/执行的指令。IB 试卷一常考察这一过程的精确次序与寄存器参与。


11. Security & Data Integrity: Symmetric vs Asymmetric Encryption | 安全与数据完整性:对称加密与非对称加密

Question: Compare symmetric and asymmetric encryption in terms of key usage, speed, and typical application. Give an example of each encryption method.

题目:比较对称加密与非对称加密,从密钥使用、速度、典型应用等方面进行对比,并各举一例。

Solution & Analysis: Symmetric encryption uses a single shared key for both encryption and decryption; it is fast and suitable for bulk data. Example: AES (Advanced Encryption Standard). Asymmetric encryption uses a key pair (public and private); it is slower but solves the key distribution problem. Example: RSA. Typical usage: symmetric encryption for secure file storage or TLS session data; asymmetric encryption for digital signatures and initial key exchange in TLS. IB marks are awarded for recognising the trade‑off and correctly naming real protocols.

解析:对称加密使用同一个共享密钥进行加密和解密,速度快,适合大量数据,例如 AES。非对称加密使用公钥/私钥对,速度较慢,但解决了密钥分发问题,例如 RSA。典型应用:对称加密用于安全文件存储或 TLS 会话数据传输;非对称加密用于数字签名和 TLS 初始密钥交换。IB 评分注重指出这种权衡,并能正确列举真实协议。


12. Ethical and Social Implications: Face Recognition Systems | 道德与社会影响:人脸识别系统

Question: A city considers deploying face recognition technology in public spaces to enhance security. Discuss two benefits and two concerns from ethical and social perspectives.

题目:某城市计划在公共场所部署人脸识别技术以提升安全性。从道德和社会角度讨论两项益处和两项忧虑。

Solution & Analysis: Benefits: quicker identification of suspects and missing persons, deterrence of crime. Concerns: privacy erosion — citizens are monitored without explicit consent; potential for bias — some systems have higher error rates on certain demographic groups, leading to false accusations. The IB syllabus requires students to evaluate technology’s impact beyond technical features, considering privacy, data protection, and societal fairness. A balanced argument with concrete examples (e.g., GDPR restrictions, algorithmic fairness studies) demonstrates higher‑order thinking.

解析:益处:快速识别嫌疑人与失踪人员,震慑犯罪。忧虑:隐私侵蚀——市民在未经明确同意的情况下被监控;潜在偏见——部分系统对特定人群的错误率较高,可能导致错误指控。IB 大纲要求评估技术影响时跳出技术本身,考虑隐私、数据保护和社会公平。结合具体案例(如 GDPR 限制、算法公平性研究)进行均衡论述能体现高阶思维。


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