Pre-U CAIE Computer Science Unit Test Mock Paper Analysis | Pre-U CAIE 计算机单元测试模拟卷解析

📚 Pre-U CAIE Computer Science Unit Test Mock Paper Analysis | Pre-U CAIE 计算机单元测试模拟卷解析

This article presents a mock unit test tailored for the Cambridge Pre-U Computer Science syllabus. It covers key topics including data representation, Boolean algebra, algorithms, networking, and operating systems. For each question, a detailed solution and exam-focused commentary are provided, helping you reinforce core concepts and hone your assessment technique. Use this resource to self-test your understanding before tackling full past papers.

本文为剑桥 Pre-U 计算机科学课程量身设计了一份模拟单元测试卷。试卷覆盖数据表示、布尔代数、算法、网络和操作系统等核心主题。每道题目均配有详细解答与紧扣考试的点评,帮助巩固核心概念并提升应试技巧。请在正式刷历年真题前利用本文进行自我检测。


1. Question 1: Two’s Complement of -23 | 第1题:-23 的补码表示

The question asks for the 8-bit two’s complement representation of the decimal integer -23. Two’s complement is the standard way of encoding signed integers in modern computers, allowing addition and subtraction to be performed by the same hardware circuit. To obtain the representation, start by writing the binary of the positive magnitude: 23 in 8-bit unsigned binary is 00010111.

题目要求写出十进制整数 -23 的 8 位二进制补码。补码是现代计算机存储有符号整数的标准方式,使得加减法运算可由同一硬件电路完成。首先写出正数绝对值的二进制形式:23 的 8 位无符号二进制为 00010111。

Next, invert all bits (one’s complement) to obtain 11101000. Then add 1 to the least significant bit, giving 11101001. This final pattern is the two’s complement representation of -23. In hexadecimal, 1110₂ is E and 1001₂ is 9, so -23 is E9 in hex. A common mistake is to forget adding 1 after inversion; another is to treat the most significant bit merely as a sign flag rather than a value bit of negative weight (-2⁷).

接下来,将所有位取反(得到反码)11101000,再在最低位加 1,结果为 11101001。这就是 -23 的补码形式。用十六进制表示,1110₂ 对应 E,1001₂ 对应 9,因此 -23 的十六进制表示为 E9。常见错误包括取反后忘记加 1,或者将最高位仅视为符号位,而忽略了其负权值 (-2⁷)。


2. Question 2: Simplifying a Boolean Expression | 第2题:布尔表达式化简

The expression to simplify is (A + B) · (A + C). Using the distributive law of Boolean algebra, this expands to A·A + A·C + B·A + B·C. Since A·A = A, we obtain A + A·C + A·B + B·C. By the absorption law, A + A·C = A, so the expression reduces to A + A·B + B·C. Apply absorption again: A + A·B = A, leaving A + B·C. Therefore, (A + B)(A + C) simplifies to A + (B AND C). Many students mistakenly attempt to cancel terms as in ordinary algebra, but Boolean algebra has distinct laws — recognising absorption is key.

待化简的表达式为 (A + B) · (A + C)。根据布尔代数的分配律展开,得到 A·A + A·C + B·A + B·C。由于 A·A = A,表达式变为 A + A·C + A·B + B·C。利用吸收律 A + A·C = A,进一步化简为 A + A·B + B·C。再次使用吸收律 A + A·B = A,最终得到 A + B·C。所以 (A + B)(A + C) 等价于 A + (B AND C)。许多学生容易照搬普通代数法则进行消项,但布尔代数有独特的公理 — 识别吸收律是解题要害。


3. Question 3: Time Complexity of Binary Search | 第3题:二分查找的时间复杂度

Binary search operates on a sorted array by repeatedly dividing the search interval in half. In the worst case, the algorithm continues until the interval size becomes 1. Starting with n elements, after k steps the remaining size is n / 2ᵏ. Setting n / 2ᵏ = 1 gives k = log₂ n. Hence the worst-case time complexity of binary search is O(log n). The space complexity is O(1) if implemented iteratively. It is important to state the base of the logarithm explicitly in explanations, although in Big-O notation bases are omitted because they differ only by a constant factor.

二分查找在有序数组上通过反复将搜索区间对半分来工作。最坏情况下,算法持续直至区间大小变为 1。初始有 n 个元素,经过 k 步后剩余大小为 n / 2ᵏ。令 n / 2ᵏ = 1 解得 k = log₂ n。因此二分查找最坏时间复杂度为 O(log n)。若采用迭代实现,空间复杂度为 O(1)。解释时最好明确指对数的底数,尽管 Big-O 表示法中底数被省略,因为不同底数仅相差常数因子。


4. Question 4: File Transfer Protocol Identification | 第4题:文件传输协议识别

The question asks which protocol is used for reliable file transfer over the internet. Among the options FTP, SMTP, HTTP, and TCP, the correct answer is FTP (File Transfer Protocol). FTP uses a control connection and a data connection, typically operating on ports 21 and 20. SMTP is for sending emails, HTTP is for transferring hypertext, and TCP is a transport-layer protocol that provides reliable delivery but is not an application-layer file transfer service. In Pre-U exams, distinguishing between application-layer protocols and lower-layer protocols is frequently tested.

题目询问哪种协议用于互联网上的可靠文件传输。在 FTP、SMTP、HTTP 和 TCP 选项中,正确答案是 FTP(文件传输协议)。FTP 使用控制连接与数据连接,通常工作在 21 和 20 端口。SMTP 用于发送电子邮件,HTTP 用于传输超文本,而 TCP 是提供可靠传输的传输层协议,并非应用层文件传输服务。Pre-U 考试常考应用层协议与较低层协议的区分。


5. Question 5: Purpose of a Page Table in Virtual Memory | 第5题:虚拟内存中页表的作用

In a virtual memory system, a page table is a data structure maintained by the operating system to map virtual addresses to physical addresses. Each process has its own page table, which translates virtual page numbers to physical frame numbers. The page table also stores status bits such as present/absent, dirty, and protection bits. When a virtual address is referenced, the memory management unit (MMU) consults the page table; if the page is not in physical memory, a page fault occurs and the OS loads the page from secondary storage. This mechanism enables processes to use more memory than physically available and provides process isolation.

在虚拟内存系统中,页表是操作系统维护的用于将虚拟地址映射到物理地址的数据结构。每个进程拥有自己的页表,实现虚拟页号到物理帧号的转换。页表还存储存在位、脏位和保护位等状态信息。当虚拟地址被访问时,内存管理单元(MMU)查询页表;若页面不在物理内存中,则发生缺页异常,操作系统从二级存储载入页面。这一机制使进程能够使用比物理内存更大的地址空间,并提供了进程隔离。


6. Question 6: Interrupt Handling by the CPU | 第6题:CPU 如何处理中断

When an interrupt occurs, the CPU suspends the current program after completing the current instruction (if it is maskable). The processor saves the program counter (PC) and processor status register (PSR) onto the stack, ensuring it can resume later. It then uses the interrupt vector to determine the address of the corresponding interrupt service routine (ISR). The ISR executes: it may save additional register contents, service the device, clear the interrupt flag, and restore registers before returning. Finally, a special return-from-interrupt instruction restores the PC and PSR, resuming the original program. Pre-U answers should highlight the sequence: suspend, save context, vector to ISR, execute ISR, restore context, return.

当中断发生时,CPU 在执行完当前指令(若为可屏蔽中断)后挂起当前程序。处理器将程序计数器和状态寄存器压栈保存,确保之后能恢复。随后利用中断向量确定对应中断服务例程(ISR)的入口地址。ISR 执行过程中可能保存更多的寄存器内容,服务外部设备,清除中断标志,并在返回前恢复寄存器。最后,一条特殊的从中断返回指令恢复 PC 和 PSR,继续执行原程序。Pre-U 答题应突出顺序:挂起、保存上下文、向量跳转至 ISR、执行 ISR、恢复上下文、返回。


7. Question 7: Symmetric vs. Asymmetric Encryption | 第7题:对称加密与非对称加密

Symmetric encryption uses the same secret key for both encryption and decryption. It is fast and suitable for bulk data encryption; an example is AES (Advanced Encryption Standard). Asymmetric encryption, also known as public-key cryptography, uses a pair of keys — a public key for encryption and a private key for decryption. It is slower but solves the key distribution problem. RSA is a widely used asymmetric algorithm. In practice, hybrid systems employ asymmetric encryption to securely exchange a symmetric session key, which then encrypts the actual data.

对称加密使用同一密钥进行加密和解密,速度快,适合大量数据加密;AES(高级加密标准)是一个典型例子。非对称加密亦称公钥密码,使用一对密钥——公钥加密、私钥解密。其速度较慢,但解决了密钥分发难题。RSA 是应用广泛的非对称算法。实际操作中,混合系统先用非对称加密安全交换一个对称会话密钥,再用该对称密钥加密实际数据。


8. Question 8: Subnetting with Mask 255.255.255.240 | 第8题:子网掩码 255.255.255.240 的子网划分

A Class C network has a default mask of 255.255.255.0, which uses 24 bits for the network portion. The given mask 255.255.255.240 in CIDR notation is /28, meaning 4 extra bits are borrowed for subnetting. The number of subnets created is 2⁴ = 16. The remaining host bits are 4, giving 2⁴ – 2 = 14 usable host addresses per subnet (the all-zero host ID is the subnet address and the all-one is the broadcast address). Always subtract 2 for valid host IPs per subnet. Answers should clearly show the working: borrowed bits = 4, subnets = 2⁴, hosts per subnet = 2⁴ – 2.

C 类网络默认掩码为 255.255.255.0,网络位占 24 位。给定的掩码 255.255.255.240 对应 CIDR 标记 /28,意味着借用了 4 位作为子网位。产生的子网数目为 2⁴ = 16。剩余的主机位为 4 位,因此每个子网可用的主机地址数为 2⁴ – 2 = 14(全 0 主机 ID 为子网地址,全 1 为广播地址)。计算每个子网有效 IP 时务必减去 2。解答需清晰展示过程:借用位 = 4,子网数 = 2⁴,每子网主机数 = 2⁴ – 2。


9. Question 9: Insertion Sort Pseudocode and Complexity Analysis | 第9题:插入排序伪代码及复杂度分析

Insertion sort works by building a sorted portion of the array from left to right. For each element starting from the second, it is compared with elements in the sorted section and inserted in the correct position by shifting larger elements rightwards. The pseudocode can be outlined as:

插入排序通过从左到右逐步构建有序部分来工作。从第二个元素开始,每个元素与有序部分的元素比较,并通过将较大元素右移来插入到正确位置。伪代码可概括为:

  1. For i = 2 to n
  2. key = A[i]
  3. j = i – 1
  4. While j > 0 and A[j] > key
  5. A[j+1] = A[j]
  6. j = j – 1
  7. A[j+1] = key

In the best-case scenario, the array is already sorted; the inner while loop condition fails immediately for each i, so the outer loop simply traverses the array, resulting in O(n) time. In the worst case, the array is reverse-sorted, and each insertion requires shifting all previously sorted elements, leading to 1 + 2 + … + (n-1) = n(n-1)/2 comparisons and shifts, which is O(n²). Average case is also O(n²). Insertion sort is stable and adaptive, making it efficient for small or partially sorted datasets.

在最好情况下,数组已有序;内层 while 循环每次立即失败,外循环仅遍历数组,时间复杂度为 O(n)。最坏情况下,数组逆序排列,每次插入都需要移动所有已排序元素,比较和移动总次数为 1 + 2 + … + (n-1) = n(n-1)/2,即 O(n²)。平均情况同为 O(n²)。插入排序是稳定且自适应的,对小规模或部分有序的数据集十分高效。


10. Exam Tips and Summary | 考试技巧与总结

Mock papers are most valuable when you treat them as real examinations: time yourself, write answers in full, and then compare with the solutions. Focus on showing working steps clearly — CAIE Pre-U examiners award marks for method as well as the final answer. Pay close attention to terminology; for instance, differentiate between ‘subnet mask’ and ‘CIDR notation’, or ‘two’s complement’ and ‘sign-and-magnitude’. Practise writing pseudocode with proper indentation and unambiguous variable names. Review the syllabus regularly to ensure all units are covered.

若将模拟卷当作真实考试对待——计时、完整书写答案、再与解析对比——则价值最大。要着力清晰展示解题步骤,CAIE Pre-U 考官既给最终答案分,也给方法分。注意术语准确性,例如区分“子网掩码”与“CIDR 标记”,或“补码”与“符号-数值表示”。练习书写缩进规范、变量名清晰的伪代码。定期对照考纲检查所有单元是否复习到位。

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