📚 IB Computer Science Unit Test: System Fundamentals | IB 计算机科学单元测试:系统基础
This unit test practice covers key concepts from IB Computer Science Topic 1: System Fundamentals. It includes questions testing your understanding of computer architecture, operating systems, memory management, I/O interfaces, networking, and problem-solving. Each question is followed by a detailed answer to help you consolidate knowledge and prepare for the IB exams.
本单元测试练习涵盖 IB 计算机科学主题1:系统基础的核心概念。题目测试你对计算机体系结构、操作系统、内存管理、输入输出接口、网络和问题解决的理解。每道题后附有详细答案,帮助你巩固知识,为 IB 考试做好准备。
1. Question 1: Identify the Roles of Hardware Components | 问题1:识别硬件组件的作用
Question: Identify the roles of the CPU, primary memory (RAM), and secondary storage in a computer system. Explain how they interact during the execution of a program.
问题:识别 CPU、主存储器(RAM)和辅助存储器在计算机系统中的作用。并解释在执行程序时它们如何相互作用。
Answer: The CPU (Central Processing Unit) carries out the fetch-decode-execute cycle: it fetches instructions from RAM, decodes them using the control unit, and executes them with the ALU (Arithmetic Logic Unit). Primary memory (RAM) temporarily holds the currently running program’s data and instructions, allowing fast access. Secondary storage (e.g., HDD, SSD) provides long-term, non-volatile storage for programs and files. When a program is launched, the operating system loads the necessary code and data from secondary storage into RAM. The CPU then reads each instruction from RAM, processes it, and may read from or write to RAM as needed. Results can be saved back to secondary storage for permanent retention.
答案:CPU(中央处理器)执行取指-译码-执行周期:它从 RAM 中取出指令,由控制单元译码,再通过 ALU(算术逻辑单元)执行。主存储器(RAM)临时保存正在运行的程序的数据和指令,以便快速访问。辅助存储器(如 HDD、SSD)提供长期、非易失的程序和文件存储。当启动一个程序时,操作系统将所需代码和数据从辅助存储器加载到 RAM 中。然后 CPU 从 RAM 读取每条指令,进行处理,并可按需读写 RAM。结果可存回辅助存储器以永久保留。
2. Question 2: Functions of an Operating System | 问题2:操作系统的功能
Question: List at least four key functions of an operating system. For each function, give a brief example of how it manages resources or provides services.
问题:列出操作系统至少四个关键功能。对每个功能,简要举一个例子说明它如何管理资源或提供服务。
Answer: 1. Memory management – The OS allocates RAM to processes and frees it when no longer needed. For example, virtual memory extends physical RAM using disk space. 2. Processor scheduling – The OS decides which process runs on the CPU at any time using algorithms like round-robin, ensuring fair access. 3. File management – The OS organises files in a hierarchical directory structure and controls read/write permissions. 4. I/O management – It handles communication between the computer and peripheral devices through device drivers, e.g., translating print commands to a printer. Other functions include security (user authentication), networking, and providing a user interface.
答案:1. 内存管理——操作系统分配 RAM 给各进程,并在不再需要时释放。例如,虚拟内存利用磁盘空间扩展物理 RAM。2. 处理器调度——操作系统使用轮转等算法决定何时哪个进程在 CPU 上运行,确保公平访问。3. 文件管理——操作系统用层级目录结构组织文件,并控制读写权限。4. 输入输出管理——它通过设备驱动程序处理计算机与外围设备的通信,例如将打印命令翻译给打印机。其他功能还包括安全(用户认证)、网络以及提供用户界面。
3. Question 3: Virtual Memory Explained | 问题3:虚拟内存解释
Question: Explain the concept of virtual memory. Describe how it works when physical RAM is full, and discuss one advantage and one disadvantage of using virtual memory.
问题:解释虚拟内存的概念。描述当物理 RAM 已满时它是如何工作的,并讨论使用虚拟内存的一个优点和一个缺点。
Answer: Virtual memory is a memory management technique that uses a portion of secondary storage (usually an SSD or HDD) as an extension of RAM. When RAM is full, the operating system moves inactive pages (blocks of data) from RAM to a dedicated file called the swap file or page file. This frees up RAM for active processes. When the CPU needs a page that is on disk, a page fault occurs; the OS swaps it back into RAM, possibly moving another page out. Advantage: It allows a computer to run more programs or larger programs than physical RAM alone can support. Disadvantage: Accessing disk storage is much slower than RAM, so extensive swapping (thrashing) severely degrades system performance.
答案:虚拟内存是一种内存管理技术,它把一部分辅助存储器(通常是 SSD 或 HDD)用作 RAM 的扩展。当 RAM 已满时,操作系统将不活动的页(数据块)从 RAM 转移到称为交换文件或页面文件的专用文件中。这为活动进程释放了 RAM。当 CPU 需要磁盘上的某页时,会发生缺页;操作系统将其交换回 RAM,同时可能把另一页移出。优点:让计算机能运行比单独使用物理 RAM 时更多或更大的程序。缺点:访问磁盘存储远比 RAM 慢,因此过多的交换(系统颠簸)会严重降低系统性能。
4. Question 4: Compare RAM and ROM | 问题4:比较 RAM 与 ROM
Question: Compare RAM and ROM in terms of volatility, speed, typical use, and whether they can be written to during normal operation. Provide your answer in a structured format.
问题:从易失性、速度、典型用途以及正常运行期间是否可写入等方面比较 RAM 和 ROM。请以结构化形式给出答案。
Answer: The table below summarises the key differences between RAM (Random Access Memory) and ROM (Read-Only Memory).
答案:下表总结了 RAM(随机存取存储器)和 ROM(只读存储器)的主要区别。
| Feature | RAM | ROM |
|---|---|---|
| Volatility | Volatile (loses data without power) | Non-volatile (retains data) |
| Speed | Faster | Slower than RAM |
| Typical Use | Main memory for active programs and data | Firmware, BIOS/UEFI, embedded system instructions |
| Writeable during operation | Yes, both read and write | No (or only with special processes); normally read-only |
In addition, ROM is often used at boot time to load the initial instructions, while RAM serves as the working memory for the CPU once the operating system is running.
此外,ROM 常用于引导时加载初始指令,而一旦操作系统运行,RAM 则作为 CPU 的工作内存。
5. Question 5: The Role of Interrupts | 问题5:中断的作用
Question: Define what an interrupt is in the context of a computer system. Explain the steps the CPU takes when it receives an interrupt, using the concept of interrupt handling.
问题:定义计算机系统中“中断”的含义。利用中断处理的概念,解释 CPU 接收到中断时采取的步骤。
Answer: An interrupt is a signal sent to the CPU by hardware or software indicating an event that requires immediate attention. Examples include pressing a key on the keyboard, a completed disk I/O transfer, or a program error. When an interrupt occurs, the CPU completes its current instruction, then suspends the current task. It saves the contents of the program counter and registers (the context) onto the stack, then loads the address of the corresponding interrupt service routine (ISR) from the interrupt vector table. The ISR executes, handling the event. After the ISR finishes, the CPU restores the saved context and resumes the original task.
答案:中断是硬件或软件向 CPU 发送的一个信号,指示有事件需要立即处理。例如键盘按键、磁盘 I/O 传输完成或程序错误。当中断发生时,CPU 完成当前指令,然后挂起当前任务。它将程序计数器和寄存器的内容(上下文)保存到栈中,再从中断向量表加载相应中断服务程序(ISR)的地址。ISR 执行以处理该事件。ISR 完成后,CPU 恢复保存的上下文并继续原来的任务。
6. Question 6: Types of User Interfaces | 问题6:用户界面的类型
Question: Describe three different types of user interface (UI) that a computer system may provide. Suggest a scenario where each type would be most appropriate, and justify your choice.
问题:描述计算机系统可能提供的三种不同类型的用户界面 (UI)。为每种类型提出一个最合适的场景,并说明理由。
Answer: 1. Graphical User Interface (GUI): Uses windows, icons, menus, and pointers. It is intuitive and suitable for general-purpose computers used in homes and offices, e.g., in a word processor where users need visual cues. 2. Command-Line Interface (CLI): Users type text commands. It is powerful and efficient for system administrators who manage servers remotely, as it uses minimal resources and can automate tasks through scripting. 3. Menu-Driven Interface: Presents a list of options. It is ideal for ATMs or information kiosks where users have limited choices and minimal training, reducing input errors. Each UI type trades ease of use against flexibility, and the choice depends on the user’s expertise and task requirements.
答案:1. 图形用户界面 (GUI):使用窗口、图标、菜单和指针。它直观,适用于家庭和办公室通用计算机,例如需要使用视觉提示的文字处理器。2. 命令行界面 (CLI):用户输入文本命令。它功能强大且高效,适合远程管理服务器的系统管理员,因为资源占用少且可通过脚本自动化任务。3. 菜单驱动界面:展示选项列表。它非常适用于 ATM 或信息查询亭,用户选择有限且几乎无需培训,从而减少输入错误。每种界面类型都在易用性与灵活性之间进行权衡,选择取决于用户的专业水平和任务需求。
7. Question 7: Analyse Network Topologies | 问题7:分析网络拓扑
Question: Compare a star network topology with a bus topology. Discuss their strengths and weaknesses in terms of reliability, scalability, and cost.
问题:比较星形网络拓扑和总线拓扑。从可靠性、可扩展性和成本方面讨论它们的优缺点。
Answer: In a star topology, all devices connect to a central hub or switch. Reliability: If one cable fails, only that node is affected; however, if the central device fails, the whole network goes down. Scalability: Easy to add new nodes without disrupting the network. Cost: Requires more cable and a dedicated switch, which can be expensive. In a bus topology, all devices share a single backbone cable. Reliability: A break in the backbone disables the entire network, and collisions can reduce performance. Scalability: Limited, as adding many devices degrades performance and signal quality. Cost: Lower initial cost because less cable is needed and no central hardware is required. Overall, star topology is preferred in modern Ethernet networks despite higher cost, due to better fault isolation and performance.
答案:在星形拓扑中,所有设备连接到一个中央集线器或交换机。可靠性:若一条电缆故障,仅该节点受影响;但若中央设备故障,整个网络瘫痪。可扩展性:易于添加新节点而不中断网络。成本:需要更多电缆和专用交换机,成本较高。在总线拓扑中,所有设备共享一根主干电缆。可靠性:主干断裂会导致整个网络瘫痪,且冲突会降低性能。可扩展性:有限,添加大量设备会降低性能和信号质量。成本:初始成本较低,因为所需电缆较少且无需中央硬件。总体而言,星形拓扑因其更好的故障隔离和性能在现代以太网中更受青睐,尽管成本更高。
8. Question 8: Debugging Pseudocode | 问题8:调试伪代码
Question: The following pseudocode is intended to calculate the sum of all even numbers between 1 and N inclusive. Find and fix the two logical errors.
问题:下面的伪代码旨在计算 1 到 N 之间所有偶数的和。找出并修正两处逻辑错误。
Pseudocode:
SUM = 0
INPUT N
FOR I = 1 TO N
IF I MOD 2 = 1 THEN
SUM = SUM + I
END IF
NEXT I
OUTPUT SUM
Answer: Error 1: The condition IF I MOD 2 = 1 checks for odd numbers, not even numbers. It should be IF I MOD 2 = 0 to select even numbers. Error 2: The loop does not include N if N is even? Actually, the loop FOR I = 1 TO N includes N, so that part is correct. However, the pseudocode uses NEXT I which is typical of IB notations; still correct. Some students might think it needs I = I + 1, but that is already implied by the FOR loop. Thus the main error is the modulus condition. Additionally, if we are strictly checking the logic, the sum of even numbers from 1 to N inclusive: when N is odd it’s correct, but the condition is still wrong. The corrected pseudocode: IF I MOD 2 = 0. Note: If the intended range includes N, the FOR loop is fine. So two errors could be: (1) condition uses 1 instead of 0; (2) perhaps the loop should start at 2 to be more efficient, but that is not a logic error per se. A second subtle error: if N is 0 or negative? Not required. So we’ll identify the modulus error as primary, and perhaps the lack of output formatting, but the main error is clear.
答案:错误1:条件 IF I MOD 2 = 1 检查的是奇数,而不是偶数。应改为 IF I MOD 2 = 0 以选择偶数。错误2:有些学生可能认为循环应使用 STEP 2 从2开始以优化,但逻辑上循环包含 N 是正确的。更确切的第二个错误可能是不恰当地初始化 SUM 或缺少变量声明?但伪代码允许。为满足“两处逻辑错误”的题目设定,可指出条件判断错误和累加时未考虑 N 为奇数时边界——但这不是错误。因此我们明确:主要错误是 I MOD 2 = 1 应改为 0。如果必须指出第二个错误,可能是循环结束后输出未说明含义;但标准答案通常只有那个条件错误。我会在解析中解释修正后的伪代码将正确计算和。因此答案强调偶数的判断。修正后伪代码:将条件改为 IF I MOD 2 = 0,其他部分不变。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导