📚 AS CCEA Computer Science: Unit Test Mock Paper Analysis | AS CCEA 计算机:单元测试模拟卷解析
This article provides detailed solutions and explanations for a mock unit test covering core AS CCEA Computer Science topics. Each question is broken down step by step, with paired English and Chinese commentary to reinforce understanding of data representation, logic gates, computer architecture, operating systems, networking, algorithms, data structures, legal issues, error detection, and assembly language.
本文为一份覆盖 AS CCEA 计算机科学核心知识点的单元模拟卷提供详细解答与解析。每道题目均分步骤拆分,并配以中英双语解说,帮助强化对数据表示、逻辑门、计算机体系结构、操作系统、网络、算法、数据结构、法律伦理、错误检测以及汇编语言等内容的掌握。
1. Data Representation: Hexadecimal, Binary, and Two’s Complement | 数据表示:十六进制、二进制与补码
Question: (a) Convert the hexadecimal number 2F3A16 to binary and then to decimal. (b) Using 8‑bit two’s complement, represent the decimal integer −25. Show all working.
问题: (a) 将十六进制数 2F3A16 转换为二进制,再转换为十进制。(b) 使用 8 位补码表示十进制整数 −25。请展示全部过程。
(a) Each hexadecimal digit corresponds to a 4‑bit binary group: 216 = 0010, F16 = 1111, 316 = 0011, A16 = 1010. Combined, the binary value is 0010 1111 0011 1010.
(a) 每个十六进制数字对应一个 4 位二进制组:216 = 0010,F16 = 1111,316 = 0011,A16 = 1010。组合后二进制值为 0010 1111 0011 1010。
To convert to decimal: 2 × 16³ + 15 × 16² + 3 × 16¹ + 10 × 16⁰ = 2 × 4096 + 15 × 256 + 48 + 10 = 8192 + 3840 + 48 + 10 = 12090. So 2F3A16 = 1209010.
转换为十进制:2 × 16³ + 15 × 16² + 3 × 16¹ + 10 × 16⁰ = 2 × 4096 + 15 × 256 + 48 + 10 = 8192 + 3840 + 48 + 10 = 12090。因此 2F3A16 = 1209010。
(b) Write +25 in 8‑bit binary: 00011001. To form two’s complement, invert bits → 11100110, then add 1 → 11100111. Thus −25 is represented as 11100111.
(b) 先写出 +25 的 8 位二进制:00011001。求补码时,将所有位取反 → 11100110,再加 1 → 11100111。因此 −25 表示为 11100111。
2. Logic Gates and Boolean Simplification | 逻辑门与布尔表达式化简
Question: Simplify the Boolean expression Y = (A + B) · (A + ¬B) using algebraic laws. Draw the resulting logic circuit using the fewest gates.
问题: 使用布尔代数定律化简表达式 Y = (A + B) · (A + ¬B),并用最少的门画出对应的逻辑电路。
Apply the distributive law: (A + B)(A + ¬B) = A + (B · ¬B). Since B · ¬B = 0, we get Y = A + 0 = A. The simplest circuit is a single wire connecting input A to output Y; no gate is needed.
应用分配律:(A + B)(A + ¬B) = A + (B · ¬B)。由于 B · ¬B = 0,得到 Y = A + 0 = A。最简电路仅需将输入 A 直接连至输出 Y,无需任何门。
3. Computer Architecture: Fetch‑Decode‑Execute Cycle | 计算机体系结构:取指—译码—执行周期
Question: Describe the roles of the Control Unit and the ALU during the fetch‑decode‑execute cycle. Mention the registers that are involved.
问题: 描述控制单元和算术逻辑单元在取指—译码—执行周期中的作用,并说明所涉及的寄存器。
During the fetch stage, the Control Unit copies the address from the Program Counter to the Memory Address Register and issues a read signal; the instruction is fetched into the Memory Data Register and then moved to the Current Instruction Register. The Program Counter is incremented.
在取指阶段,控制单元将程序计数器中的地址复制到内存地址寄存器并发出读信号;指令被取入内存数据寄存器,然后移入当前指令寄存器。程序计数器随后递增。
In the decode phase, the Control Unit interprets the opcode and operands, enabling the necessary circuits. During execution, the ALU performs arithmetic or logical operations as dictated by the instruction. Registers such as the Accumulator, General‑Purpose Registers, and Status Register may be involved.
在译码阶段,控制单元解析操作码和操作数,激活相应电路。执行阶段,算术逻辑单元根据指令完成算术或逻辑运算。累加器、通用寄存器和状态寄存器等可能参与其中。
4. Operating System Functions | 操作系统功能
Question: Explain two key functions of a modern operating system. Provide a concrete example for each.
问题: 解释现代操作系统的两个关键功能,并各举一个具体例子。
Memory management: The OS allocates and tracks memory space for processes, preventing conflicts. For instance, when you open a web browser and a word processor simultaneously, the OS ensures each application uses distinct RAM regions.
内存管理:操作系统为进程分配并跟踪内存空间,防止冲突。例如,当你同时打开浏览器和文字处理软件时,操作系统确保每个程序使用互不重叠的内存区域。
Interrupt handling: The OS responds to hardware or software interrupts by suspending the current task, saving its state, and executing an interrupt service routine. An example is pressing a key on the keyboard: the keyboard controller sends an interrupt, and the OS immediately reads the key code.
中断处理:操作系统通过挂起当前任务、保存其状态并执行中断服务程序来响应硬件或软件中断。例如,按下键盘按键时,键盘控制器发出中断,操作系统立即读取键码。
5. Networking: Circuit Switching vs Packet Switching | 网络:电路交换与分组交换
Question: Compare circuit switching and packet switching in terms of connection setup, resource usage, and typical applications.
问题: 从连接建立、资源利用和典型应用三个角度比较电路交换与分组交换。
Circuit switching establishes a dedicated physical path before data transfer begins, guaranteeing constant bandwidth. It is used in traditional telephone networks. No other traffic can use the link while the call is active.
电路交换在数据传输前建立专用物理通路,保证恒定带宽,用于传统电话网络。通话期间其他流量无法使用该链路。
Packet switching divides data into packets that travel independently through shared links. No dedicated path is pre‑allocated, so bandwidth is used more efficiently. The Internet and VoIP applications are common examples.
分组交换将数据拆分为独立传输的分组,通过共享链路发送。无需预先分配专用路径,带宽利用率更高。互联网和 VoIP 应用是典型例子。
6. Binary Search Algorithm and Efficiency | 二分查找算法及其效率
Question: Write pseudocode to perform a binary search on a sorted array of integers. State the worst‑case time complexity using Big‑O notation.
问题: 编写对有序整数数组执行二分查找的伪代码,并用大 O 表示法给出最坏时间复杂度。
Pseudocode:
伪代码:
low ← 0
high ← length(array) – 1
while low ≤ high do
mid ← (low + high) DIV 2
if array[mid] = target then return mid
else if array[mid] < target then low ← mid + 1
else high ← mid – 1
endwhile
return –1
low ← 0
high ← length(array) – 1
while low ≤ high do
mid ← (low + high) DIV 2
if array[mid] = target then return mid
else if array[mid] < target then low ← mid + 1
else high ← mid – 1
endwhile
return –1
The array is halved each iteration, so the worst case requires at most log₂(n) comparisons. The complexity is O(log n), where n is the number of elements.
每次迭代数组减半,最坏情况需要至多 log₂(n) 次比较。时间复杂度为 O(log n),其中 n 为元素个数。
7. Legal Issues: Computer Misuse Act | 法律伦理:计算机滥用法
Question: Discuss the main offences created by the Computer Misuse Act and their relevance to computer users.
问题: 论述计算机滥用法规定的主要罪行及其对计算机使用者的意义。
The Act criminalises unauthorised access to computer material (e.g., hacking into someone’s email), unauthorised access with intent to commit further offences (e.g., using stolen credentials to transfer money), and unauthorised acts with intent to impair the operation of a computer (e.g., launching a denial‑of‑service attack). It makes users accountable for obtaining consent and discourages malicious activities.
该法将未经授权访问计算机资料(如入侵他人邮箱)、意图进一步犯罪的未经授权访问(如利用窃取的凭证转账)以及意图破坏计算机运行的未经授权行为(如发起拒绝服务攻击)定为犯罪。这使得使用者必须获得授权,从而遏制恶意行为。
8. Data Structures: Stack Operations | 数据结构:栈操作
Question: Using a diagram‑like sequence, explain the push and pop operations on a stack with the following instructions: PUSH 5, PUSH 10, POP, PUSH 8. What will be the final top value?
问题: 以类似示意图的顺序说明栈的推入(push)和弹出(pop)操作,指令序列为:PUSH 5, PUSH 10, POP, PUSH 8。最终的栈顶值是什么?
Initially the stack is empty. After PUSH 5 → top = 5. After PUSH 10 → top = 10, with 5 underneath. POP removes 10, now top = 5. PUSH 8 places 8 on top, so the final top value is 8. The stack content from bottom to top is 5, 8.
初始栈为空。PUSH 5 → 栈顶 = 5。PUSH 10 → 栈顶 = 10,5 在下层。POP 移除 10,栈顶恢复为 5。PUSH 8 将 8 置于顶部,最终栈顶值为 8。栈内由底至顶为 5, 8。
9. Error Detection: Parity Bit | 错误检测:奇偶校验位
Question: Given the 8‑bit data byte 10110101, compute the even parity bit that would be appended. Explain how a single‑bit error can be detected.
问题: 给定 8 位数据字节 10110101,计算应附加的偶校验位。解释如何检测单比特错误。
Count the number of 1s: 10110101 contains five 1s, an odd count. For even parity, the parity bit must make the total number of 1s even, so we set the parity bit to 1. The transmitted 9‑bit block would be 10110101 1 (parity bit added).
统计 1 的个数:10110101 含有五个 1,奇数个。偶校验要求总 1 个数为偶数,因此需设校验位为 1。发送的 9 位块为 10110101 1(附加校验位)。
At the receiver, the number of 1s in the 9‑bit block is re‑counted. If a single‑bit flips, the total becomes odd (for example, five 1s become four or six, still an odd count? wait: correct count is 6 ones, if one bit flips from 1 to 0, 6 becomes 5, odd, detected). Even parity detects any odd number of bit errors; a single‑bit error is always caught.
接收端重新统计 9 位块中 1 的个数。若发生单比特翻转,总数变为奇数(例如正确的 6 个 1 减为 5),由此检出错误。偶校验可检测任意奇数个比特错误,单比特错误总能被捕捉。
10. Assembly Language and Addressing Modes | 汇编语言与寻址方式
Question: Consider the assembly code: LOAD R1, #5; ADD R1, #3; STORE R1, 200. Explain the purpose of each instruction and identify the addressing mode where values are part of the instruction.
问题: 考虑汇编代码:LOAD R1, #5; ADD R1, #3; STORE R1, 200。解释每条指令的作用,并指出数值直接出现在指令中的寻址方式。
LOAD R1, #5 uses immediate addressing: the operand 5 is part of the instruction and is copied directly into register R1. ADD R1, #3 again uses immediate addressing, adding 3 to the contents of R1. After ADD, R1 holds 8.
LOAD R1, #5 采用立即寻址:操作数 5 是指令的一部分,直接复制到寄存器 R1。ADD R1, #3 同样使用立即寻址,将 3 与 R1 的内容相加。执行后 R1 的值为 8。
STORE R1, 200 uses direct (absolute) addressing: the value in R1 is stored into the memory location at address 200. Immediate addressing is indicated by the # symbol.
STORE R1, 200 使用直接寻址:将 R1 中的值存入内存地址 200 处。立即寻址由 # 符号标识。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导