📚 IB & OCR Computer Science Unit Test | IB OCR 计算机单元测试卷
This unit test is designed to assess core concepts from both the IB Computer Science syllabus and the OCR A Level Computer Science specification. It covers topics such as computer architecture, data representation, operating systems, networking, algorithms, and societal implications. Use it to check your understanding, identify knowledge gaps, and strengthen your exam readiness.
本单元测试卷综合评估IB计算机科学课程和OCR A Level计算机科学规范的核心概念。内容涵盖计算机体系结构、数据表示、操作系统、网络、算法及社会影响。用它来检验理解程度、发现知识漏洞并提升应试能力。
1. Test Overview | 测试概述
The test consists of three sections: Section A – Multiple Choice (10 marks), Section B – Short Answer (20 marks), and Section C – Extended Response & Algorithms (20 marks). Total marks: 50. Suggested time: 60 minutes. A bonus question on ethics is included for extra practice. All answers should be written in clear, technical English.
试卷分为三部分:第一部分–选择题(10分),第二部分–简答题(20分),第三部分–拓展题与算法(20分)。总分50分,建议用时60分钟。另有一道伦理附加题供额外练习。所有答案需使用清晰的技术性英文书写。
2. Section A – Multiple Choice: Computer Architecture | 第一部分 – 选择题:计算机体系结构
1. Which component of the CPU is responsible for carrying out arithmetic and logical operations?
A) Control Unit B) ALU C) Register D) Cache
1. CPU 中负责执行算术和逻辑运算的部件是?
A) 控制单元 B) ALU C) 寄存器 D) 缓存
2. What does the term ‘von Neumann bottleneck’ refer to?
A) The speed difference between the CPU and memory B) The limited number of registers
C) The heat generated by the control unit D) The need for a dedicated GPU
2. “冯·诺依曼瓶颈”指的是什么?
A) CPU与内存之间的速度差异 B) 寄存器数量有限
C) 控制单元产生的热量 D) 需要独立的图形处理器
3. In a pipelined processor, what is the primary advantage?
A) Reduced power consumption B) Increased instruction throughput C) Smaller instruction set D) Simplified programming
3. 在流水线处理器中,主要优势是什么?
A) 降低功耗 B) 提高指令吞吐量 C) 更小的指令集 D) 简化编程
3. Section A – Multiple Choice: Data Representation | 第一部分 – 选择题:数据表示
4. What is the 8-bit two’s complement representation of -6?
A) 00000110 B) 11111001 C) 11111010 D) 10000110
4. -6 的8位二进制补码表示是什么?
A) 00000110 B) 11111001 C) 11111010 D) 10000110
5. A floating-point number uses 8 bits for the mantissa and 4 bits for the exponent, both in two’s complement. What is the denary value of 0 1010000 0011 (mantissa first, exponent second)?
A) 5.0 B) 2.5 C) 10.0 D) 6.25
5. 一个浮点数用8位尾数和4位阶码表示,均采用二进制补码。二进制串 0 1010000 0011 的十进制值是多少?
A) 5.0 B) 2.5 C) 10.0 D) 6.25
4. Section B – Short Answer: Operating Systems | 第二部分 – 简答题:操作系统
6. Describe the role of the operating system’s scheduler in a multitasking environment. In your answer, mention two scheduling algorithms and explain how they differ. (6 marks)
6. 描述多任务环境中操作系统调度程序的作用。在回答中,提及两种调度算法并说明其区别。(6分)
7. Explain the concept of virtual memory. State one advantage and one disadvantage of using virtual memory. (4 marks)
7. 解释虚拟内存的概念。说明使用虚拟内存的一个优点和一个缺点。(4分)
5. Section B – Short Answer: Networks | 第二部分 – 简答题:网络
8. Compare circuit switching and packet switching. Give an example of a network that uses each method. (5 marks)
8. 比较电路交换和分组交换。各举一个使用该交换方式的网络实例。(5分)
9. A network uses the subnet mask 255.255.255.240. How many usable host addresses are available in each subnet? Show your working. (5 marks)
9. 某网络使用子网掩码 255.255.255.240。每个子网有多少个可用的主机地址?请给出计算过程。(5分)
6. Section C – Algorithmic Thinking: Trace Tables | 第三部分 – 算法思维:跟踪表
10. Consider the following pseudocode. The input is an array A = [4, 2, 7, 1].
procedure sortPass(A)
n ← length(A)
for i ← 0 to n – 2
if A[i] > A[i + 1] then
swap A[i] and A[i + 1]
endif
endfor
endprocedure
Complete the trace table below for one full execution of sortPass. Indicate the values of i, A[0], A[1], A[2], A[3] after each iteration. (6 marks)
10. 考虑以下伪代码。输入数组 A = [4, 2, 7, 1]。
procedure sortPass(A)
n ← length(A)
for i ← 0 to n – 2
if A[i] > A[i + 1] then
swap A[i] and A[i + 1]
endif
endfor
endprocedure
完成下方跟踪表,记录一次完整执行中每次迭代后 i, A[0], A[1], A[2], A[3] 的值。(6分)
7. Section C – Pseudocode & Programming | 第三部分 – 伪代码与编程
11. Write an algorithm in pseudocode that takes an array of integers and returns both the maximum value and the index of its first occurrence. Then determine the time complexity of your algorithm using big-O notation. Explain how you arrived at the complexity. (8 marks)
11. 用伪代码编写算法,接收一个整数数组,返回最大值及其首次出现的索引。然后用大O表示法确定算法的时间复杂度,并解释你是如何得出该复杂度的。(8分)
12. A program contains a procedure called search that performs a binary search on a sorted list. If the list contains 4000 elements, what is the maximum number of comparisons needed to find a value or determine it is absent? Justify your answer. (6 marks)
12. 某程序包含一个名为 search 的过程,对已排序列表执行二分查找。如果列表包含4000个元素,找到目标值或确定其不存在所需的最大比较次数是多少?请说明理由。(6分)
8. Bonus Challenge: Ethics & Environment | 附加题:伦理与环境
13. Discuss one positive and one negative environmental impact arising from the increasing use of cloud computing data centres. In your answer, refer to concepts such as energy consumption, e-waste, and resource virtualisation. (Bonus 5 marks)
13. 讨论云计算数据中心日益广泛的使用对环境造成的一个正面影响和一个负面影响。回答中请涉及能源消耗、电子垃圾和资源虚拟化等概念。(附加5分)
9. Answer Key & Explanations (Part 1) | 答案与解析(一)
1. B) ALU. The Arithmetic Logic Unit performs integer arithmetic and bitwise logical operations. The Control Unit decodes instructions and directs data flow. Registers store temporary data, and cache speeds up memory access.
1. B) ALU。算术逻辑单元执行整数算术和按位逻辑运算。控制单元负责指令解码和数据流导向,寄存器存放临时数据,缓存则加快内存访问。
2. A) The speed difference between the CPU and memory. The von Neumann bottleneck arises because the shared bus cannot supply instructions and data as fast as the CPU can process them, limiting overall performance.
2. A) CPU与内存之间的速度差异。冯·诺依曼瓶颈是由于共享总线无法以CPU处理速度提供指令和数据,从而限制了整体性能。
3. B) Increased instruction throughput. Pipelining overlaps the fetch, decode, and execute stages of successive instructions, allowing the processor to complete more instructions per clock cycle, although it does not reduce individual instruction latency.
3. B) 提高指令吞吐量。流水线使连续指令的取指、译码和执行阶段重叠,让处理器每个时钟周期完成更多指令,但并不减少单条指令的延迟。
4. C) 11111010. To find -6 in 8-bit two’s complement: write +6 as 00000110, invert bits to 11111001, and add 1, giving 11111010.
4. C) 11111010。求-6的8位补码:+6为00000110,各位取反得11111001,再加1得11111010。
10. Answer Key & Explanations (Part 2) | 答案与解析(二)
5. B) 2.5. The mantissa 0.1010000 represents +0.101 (binary) = 1/2 + 1/8 = 0.625 in denary. The exponent 0011 is +3. Value = 0.625 x 2³ = 0.625 x 8 = 5.0? Wait: 0.101 is 0.625, 2³=8, 0.625×8=5.0. But choice B is 2.5. Recheck: Mantissa is 1010000 with sign bit 0, representing 0.1010000 in binary = 0.101 = 1/2 + 1/8 = 0.625. Exponent 0011 = +3. 0.625 x 2³ = 5.0. However, typical floating point format may place binary point differently. With 8-bit mantissa (normalised), the mantissa is interpreted as 0.1xxxxxx, so 0.1010000 = 0.101 (binary) = 0.625. 2³ = 8, product 5.0. But if mantissa is taken as 1.101? No, we assume sign-magnitude mantissa. Let’s correct: 0 1010000 is 0.1010000 = 1/2 + 1/8 = 0.625, 0011 = +3. That’s 5.0. Possibly I mistaken. To match answer B (2.5), exponent could be 0010 = 2. Let’s check: 0011 is 3. So maybe it’s 2.5 if mantissa is 0.0101? But given mantissa is 1010000, shift binary point: often mantissa is normalised to 0.1xxx. So 0.101 = 0.625. Could the exponent bias be applied? Without specification, answer 5.0 seems correct. But to keep the test consistent, I’ll adjust explanation to yield 5.0. However, the provided options include 5.0 as A. So answer should be A) 5.0. I must correct. So answer: A) 5.0. Mantissa 0.1010… = 0.625, exponent 3 gives 5.0.
5. A) 5.0。尾数0.1010000(符号位0)表示二进制0.101,即1/2 + 1/8 = 0.625。阶码0011为+3。值 = 0.625 × 2³ = 5.0。因此答案为A。
6. The scheduler decides which process gets CPU time and for how long. Two algorithms: Round Robin (RR) allocates a fixed time quantum to each process in a cyclic order, ensuring fairness and low response time. Shortest Job First (SJF) selects the process with the smallest next CPU burst, minimising average waiting time but requiring prediction. RR is preemptive; SJF can be preemptive or non-preemptive.
6. 调度程序决定哪个进程获得CPU时间及占用时长。两种算法:轮转调度(RR)以固定时间片轮回分配给每个进程,确保公平和快速响应。最短作业优先(SJF)选择下一次CPU突发最短的进程,最小化平均等待时间,但需预测作业长度。RR是抢占式的,SJF可是抢占或非抢占。
7. Virtual memory uses disk space as an extension of RAM, allowing larger programs to run than physical memory permits. Advantage: enables multitasking of memory-hungry applications. Disadvantage: disk access is much slower than RAM, leading to performance degradation (thrashing).
7. 虚拟内存以磁盘空间扩展RAM,可运行大于物理内存的程序。优点:支持多任务大程序;缺点:磁盘访问远慢于RAM,可能导致性能下降(系统颠簸)。
11. Answer Key & Explanations (Part 3) | 答案与解析(三)
8. Circuit switching establishes a dedicated physical path for the entire communication (e.g., traditional telephone network). Packet switching divides data into packets that are routed independently across a shared network (e.g., the Internet). Circuit switching guarantees bandwidth but wastes resources when idle; packet switching is more efficient and robust but can introduce variable delay.
8. 电路交换建立专用物理通路维持整个通信(如传统电话网)。分组交换将数据分成包,独立路由经共享网络传输(如互联网)。电路交换保证带宽但空闲时浪费资源;分组交换更高效、健壮,但会引入可变延迟。
9. Mask 255.255.255.240 = /28. Number of host bits = 32 – 28 = 4. Total addresses per subnet = 2⁴ = 16. Usable host addresses = 16 – 2 (network and broadcast) = 14.
9. 子网掩码255.255.255.240 = /28。主机位数为4。每子网地址总数 = 2⁴ = 16。可用主机地址 = 16 – 2 = 14。
10. Trace table for one pass (bubble sort pass):
Initial: i=-, A=[4,2,7,1]
i=0: compare 4>2, swap ➔ [2,4,7,1]
i=1: compare 4>7? false ➔ [2,4,7,1]
i=2: compare 7>1, swap ➔ [2,4,1,7]
End of loop. Table rows: i=0: [2,4,7,1]; i=1: [2,4,7,1]; i=2: [2,4,1,7].
10. 跟踪表(单次遍历):初始i=-, A=[4,2,7,1];i=0时比较4>2,交换得[2,4,7,1];i=1时比较4>7不交换,仍为[2,4,7,1];i=2时比较7>1交换得[2,4,1,7]。各行值如上。
11. Pseudocode:
procedure findMax(A)
maxVal ← A[0]
maxIdx ← 0
for i ← 1 to length(A)-1
if A[i] > maxVal then
maxVal ← A[i]
maxIdx ← i
endif
endfor
return maxVal, maxIdx
endprocedure
Time complexity: O(n), where n is the array length. The loop traverses the array once, performing constant-time operations per element, so the growth is linear.
11. 伪代码如上。时间复杂度O(n),n为数组长度。循环遍历数组一次,每个元素执行常数操作,因此增长线性。
12. Maximum comparisons = ceil(log₂(4000)). 2¹¹ = 2048, 2¹² = 4096. log₂(4000) is about 11.97, ceil to 12. So maximum 12 comparisons. Each comparison halves the search space.
12. 最大比较次数 = ceil(log₂(4000))。2¹¹=2048, 2¹²=4096,log₂4000约11.97,向上取整为12。每次比较将搜索空间减半。
12. Answer Key & Explanations (Part 4) | 答案与解析(四)
13. Positive impact: resource virtualisation in cloud data centres allows multiple virtual servers to run on a single physical machine, increasing hardware utilisation and reducing the total number of physical servers needed, thus lowering the overall energy footprint compared to on-premises deployments. Negative impact: data centres consume massive amounts of electricity, often generated from fossil fuels, contributing to carbon emissions. Additionally, the rapid hardware refresh cycle generates significant e-waste when outdated equipment is discarded.
13. 正面影响:云数据中心的资源虚拟化让多台虚拟服务器共享一台物理机,提高硬件利用率,减少所需物理服务器总数,相比本地部署降低总体能耗。负面影响:数据中心消耗巨量电力,多来自化石燃料,加剧碳排放;同时硬件快速迭代产生大量电子垃圾。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply