Year 13 AQA Computer Science: Unit Test Mock Exam Walkthrough | AQA 计算机 Year 13 单元测试模拟卷解析

📚 Year 13 AQA Computer Science: Unit Test Mock Exam Walkthrough | AQA 计算机 Year 13 单元测试模拟卷解析

This comprehensive walkthrough dissects a typical Year 13 AQA A-level Computer Science unit test. Each question is analysed with detailed explanations, covering data structures, algorithms, programming paradigms, theory of computation, and systems architecture. Designed to mirror the depth and style of actual AQA Paper 1 and Paper 2 questions, this mock exam review strengthens conceptual understanding and exam technique.

这份详细的解析针对一套典型的 AQA A-level 计算机科学 Year 13 单元测试模拟卷。我们逐一拆解题目,配以详尽的解释,覆盖数据结构、算法、编程范式、计算理论及系统架构。模拟卷在深度和风格上贴近真实的 AQA Paper 1 和 Paper 2 题目,旨在帮助考生巩固概念理解和应试技巧。


1. Data Structures: Stack Operations | 数据结构:栈操作解析

Question: A program uses a stack to reverse a string. The string ‘TutorHao’ is pushed character by character. Show the state of the stack after each push and after each pop.

题目: 一个程序用栈来反转字符串。字符串 ‘TutorHao’ 被逐字符压入栈中。试给出每次压入及每次弹出后栈的状态。

Initially, the stack is empty. Pushing ‘T’ → Stack: [‘T’]. Pushing ‘u’ → [‘T’,’u’]. Continuing: [‘T’,’u’,’t’], [‘T’,’u’,’t’,’o’], [‘T’,’u’,’t’,’o’,’r’], [‘T’,’u’,’t’,’o’,’r’,’H’], [‘T’,’u’,’t’,’o’,’r’,’H’,’a’], [‘T’,’u’,’t’,’o’,’r’,’H’,’a’,’o’]. For reversal, we pop each character: first pop returns ‘o’, then ‘a’,’H’,’r’,’o’,’t’,’u’,’T’, producing the reversed string ‘oaHrotuT’.

初始栈为空。压入 ‘T’ → 栈:[‘T’]。压入 ‘u’ → [‘T’,’u’]。继续:[‘T’,’u’,’t’],[‘T’,’u’,’t’,’o’],[‘T’,’u’,’t’,’o’,’r’],[‘T’,’u’,’t’,’o’,’r’,’H’],[‘T’,’u’,’t’,’o’,’r’,’H’,’a’],[‘T’,’u’,’t’,’o’,’r’,’H’,’a’,’o’]。为了反转,我们逐字符弹出:首次弹出得到 ‘o’,然后是 ‘a’,’H’,’r’,’o’,’t’,’u’,’T’,生成反转字符串 ‘oaHrotuT’。

This exercise tests understanding of LIFO (Last-In, First-Out) behaviour. In an exam, clarity in drawing stack diagrams earns full marks – label the top pointer and indicate the direction of growth.

本题考察对 LIFO(后进先出)特性的理解。在考试中,清晰绘制栈示意图即可得满分——要标注栈顶指针并指明增长方向。


2. Algorithm Analysis: Time Complexity of Recursion | 算法分析:递归的时间复杂度

Question: Consider a recursive function that calculates the nth Fibonacci number as F(n) = F(n−1) + F(n−2) with base cases F(0)=0, F(1)=1. Determine its worst-case time complexity and explain why.

题目: 某递归函数按 F(n) = F(n−1) + F(n−2) 计算第 n 个斐波那契数,基线条件为 F(0)=0, F(1)=1。试确定其最坏时间复杂度并解释原因。

The naive recursive implementation has time complexity O(2ⁿ). This is because each call to F(n) makes two calls to F(n−1) and F(n−2), leading to an exponential tree of calls. The depth of the tree is n, and the number of nodes doubles at each level, resulting in roughly 2ⁿ nodes. No memoisation is used, so overlapping subproblems are recomputed exponentially many times.

朴素的递归实现时间复杂度为 O(2ⁿ)。这是因为每次对 F(n) 的调用会引发对 F(n−1) 和 F(n−2) 的两次调用,形成指数级的调用树。树的深度为 n,每层节点数加倍,因此大约有 2ⁿ 个节点。由于没有使用记忆化技术,重叠的子问题会被重复计算指数多次。

A more efficient approach using dynamic programming or iteration achieves O(n) time. In an AQA exam, you may be asked to derive recurrence relations or compare complexities.

使用动态规划或迭代的更高效方法可达到 O(n) 时间复杂度。在 AQA 考试中,你可能需要推导递推关系或比较不同复杂度。


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

Question: A base class ‘Vehicle’ has a method ‘move()’. Derived classes ‘Car’ and ‘Boat’ override ‘move()’. Given an array of Vehicle references pointing to instances of Car and Boat, explain how polymorphism allows correct method invocation at runtime.

题目: 基类 ‘Vehicle’ 拥有一方法 ‘move()’。派生类 ‘Car’ 和 ‘Boat’ 重写了 ‘move()’。给定一个 Vehicle 引用数组,其元素指向 Car 和 Boat 实例,解释多态如何在运行时实现正确的方法调用。

Polymorphism enables a single interface to represent different underlying forms. In languages like Java or C#, when a method is declared as ‘virtual’ (or all methods are virtual by default), the actual method called is determined by the runtime type of the object, not the reference type. This is implemented via a virtual method table (vtable) for each class. The array holds references of type Vehicle, but each object’s vtable points to the overridden ‘move()’. Thus, iterating over the array and calling ‘move()’ on each element invokes Car’s move() for Car objects and Boat’s move() for Boat objects. This promotes extensibility – new vehicle types can be added without modifying existing code.

多态允许单一接口代表不同的底层形式。在 Java 或 C# 这类语言中,当方法声明为 ‘virtual’(或者默认所有方法都是虚方法)时,实际调用的方法由对象的运行时类型决定,而非引用的类型。这通过每个类的虚方法表(vtable)实现。数组持有 Vehicle 类型的引用,但每个对象的 vtable 指向重写的 ‘move()’。因此,遍历数组并对每个元素调用 ‘move()’ 时,Car 对象调用 Car 的 move(),Boat 对象调用 Boat 的 move()。这提升了可扩展性——新增车辆类型无需修改现有代码。


4. Theory of Computation: Finite State Machines (FSM) | 计算理论:有限状态机

Question: Design a deterministic finite state machine (DFA) that accepts binary strings containing an even number of 1s. Provide the state transition diagram and explain the acceptance condition.

题目: 设计一个确定性有限状态机(DFA),接受含有偶数个 1 的二进制字符串。给出状态转换图并解释接受条件。

We use two states: S0 (even number of 1s, also the start state and accept state) and S1 (odd number of 1s). Transitions: from S0 on input ‘0’ stay in S0; on input ‘1’ go to S1. From S1 on ‘0’ stay in S1; on ‘1’ go to S0. The machine starts in S0, the accepting state, because zero 1s is even. After processing the entire input, if the machine ends in S0, the string is accepted; otherwise it is rejected.

使用两个状态:S0(已有偶数个 1,同时为初始状态和接受状态)和 S1(已有奇数个 1)。转换规则:从 S0 接收 ‘0’ 仍留在 S0;接收 ‘1’ 转入 S1。从 S1 接收 ‘0’ 留 S1;接收 ‘1’ 转回 S0。机器从 S0(接受状态)启动,因为 0 个 1 是偶数。处理完整输入字符串后,若机器停在 S0,则接受该字符串;否则拒绝。

This is a classic exercise in AQA theory questions. You should be able to draw the state diagram with labelled transitions and indicate the start/accept states clearly.

这是 AQA 理论题中的经典练习题。你要能够绘制带标记转换的状态图,并清晰地标注初始状态与接受状态。


5. Databases: SQL Queries and Normalisation | 数据库:SQL 查询与规范化

Question: Given a table Orders(OrderID, CustomerName, Product, Price, CustomerAddress). Write SQL to find the total revenue per customer and identify normalisation issues.

题目: 给定表 Orders(OrderID, CustomerName, Product, Price, CustomerAddress)。编写 SQL 查询每位客户的总收入,并指出规范化问题。

SQL:

SELECT CustomerName, SUM(Price) AS TotalRevenue
FROM Orders
GROUP BY CustomerName;

SQL 查询:

SELECT CustomerName, SUM(Price) AS TotalRevenue
FROM Orders
GROUP BY CustomerName;

The table suffers from insertion, update, and deletion anomalies because it is not in 2NF. CustomerName and CustomerAddress are functionally dependent on OrderID partially if we assume a composite key or no proper key. A better design would separate into Customers(CustomerID, CustomerName, Address) and Orders(OrderID, CustomerID, Product, Price). This eliminates redundancy and potential update anomalies – for example, changing a customer’s address requires updating multiple rows in the original table, but only one row in the normalised Customers table.

该表存在插入、更新和删除异常,因为它未达到第二范式(2NF)。CustomerName 和 CustomerAddress 部分依赖于 OrderID,如果我们假设组合键或没有合适主键的话。更好的设计是将表分解为 Customers(CustomerID, CustomerName, Address) 和 Orders(OrderID, CustomerID, Product, Price)。这消除了冗余和潜在更新异常——例如,修改客户地址时,原表需要更新多行,而在规范化后的 Customers 表中只需更新一行。


6. Computer Architecture: Pipelining and Hazards | 计算机体系结构:流水线与冲突

Question: Explain how pipelining improves CPU performance and describe one type of hazard that can occur, with a possible solution.

题目: 解释流水线如何提升 CPU 性能,并描述一类可能发生的冲突及其可能的解决方法。

Pipelining divides instruction execution into stages (e.g., fetch, decode, execute, memory, write-back) and overlaps the processing of multiple instructions. This increases throughput – ideally, one instruction completes every clock cycle after the pipeline is filled. However, hazards break the ideal flow. A data hazard occurs when an instruction depends on the result of a previous instruction still in the pipeline. For example:

ADD R1, R2, R3   // R1 = R2 + R3
SUB R4, R1, R5   // needs R1 from previous instruction

The SUB instruction tries to read R1 before ADD has written back the result. A solution is data forwarding (also called bypassing), where the ALU result from the execute stage of ADD is directly fed to the execute stage of SUB, avoiding the stall. Alternatively, the compiler can reorder instructions to insert independent instructions between them (delay slots).

流水线将指令执行划分为多个阶段(如取指、译码、执行、访存、写回),并重叠执行多条指令。这提高了吞吐量——理想情况下,流水线填满后每个时钟周期完成一条指令。然而,冲突会破坏这种理想流程。数据冲突 发生在一条指令依赖于仍在流水线中的先前指令的结果时。例如:

ADD R1, R2, R3   // R1 = R2 + R3
SUB R4, R1, R5   // 需要使用前一条指令产生的 R1

SUB 指令试图在 ADD 写回结果之前读取 R1。解决方法之一是数据前递(又称旁路),将 ADD 执行阶段产生的 ALU 结果直接送往 SUB 的执行阶段,从而避免停顿。此外,编译器可通过指令重排在二者之间插入独立指令(延迟槽)。


7. Networking: TCP/IP Protocol Stack and Packet Switching | 网络:TCP/IP 协议栈与分组交换

Question: Describe the role of the Transport layer in the TCP/IP stack and explain how TCP ensures reliable data transfer.

题目: 描述 TCP/IP 协议栈中传输层的角色,并解释 TCP 如何确保可靠的数据传输。

The Transport layer (layer 4) provides end-to-end communication services for applications. TCP (Transmission Control Protocol) establishes a connection-oriented session and guarantees reliable delivery through several mechanisms: sequence numbers to order packets, acknowledgements (ACKs) to confirm receipt, retransmission on timeout, and flow control via a sliding window. Additionally, TCP uses a three-way handshake to set up connections and a four-way handshake to tear them down, ensuring both sides are synchronised.

传输层(第四层)为应用程序提供端到端的通信服务。TCP(传输控制协议)建立面向连接的会话,并通过多种机制保证可靠交付:用序列号对分组排序,用确认(ACK)证实收到,超时重传,以及通过滑动窗口进行流量控制。此外,TCP 使用三次握手建立连接,四次握手拆除连接,确保双方同步。

Packet switching works alongside TCP by breaking data into packets that may take different routes to the destination, where TCP reassembles them in order. This contrasts with circuit switching used in traditional telephony.

分组交换与 TCP 协同工作,将数据拆分为分组,分组可能经过不同路由到达目的地,由 TCP 按序重组。这与传统电话使用的电路交换形成对比。


8. Programming Paradigms: Recursion vs Iteration | 编程范式:递归与迭代

Question: Compare recursion and iteration for solving the factorial function n! = n × (n−1) × … × 1. Discuss memory usage and efficiency.

题目: 比较递归与迭代求解阶乘函数 n! = n × (n−1) × … × 1 的方法,讨论内存使用与效率。

Iterative approach:

int result = 1;
for (int i = 1; i <= n; i++) result *= i;

This uses O(1) additional space (constant memory) and runs in O(n) time. It is generally more efficient because it avoids function call overhead.

迭代方法:

int result = 1;
for (int i = 1; i <= n; i++) result *= i;

该方法仅使用 O(1) 额外空间(常数额内存),运行时间为 O(n)。由于避免了函数调用开销,通常效率更高。

Recursive approach:

if (n == 0) return 1;
else return n * factorial(n-1);

Each recursive call adds a new stack frame, leading to O(n) space complexity. Deep recursion may cause stack overflow. However, recursion can be more intuitive for problems with a naturally recursive structure, like tree traversals. In AQA exams, you might be asked to convert recursive algorithms to iterative ones or trace recursion.

递归方法:

if (n == 0) return 1;
else return n * factorial(n-1);

每次递归调用都会添加一个新的栈帧,导致空间复杂度为 O(n)。深度递归可能引发栈溢出。然而,对于具有天然递归结构的问题(如树的遍历),递归往往更直观。AQA 考试中,你可能需要将递归算法转换为迭代算法,或跟踪递归过程。


9. Ethical and Legal Issues: Digital Copyright and AI | 伦理与法律议题:数字版权与人工智能

Question: Discuss the ethical implications of training large language models on copyright-protected text without explicit permission.

题目: 讨论未经明确许可使用受版权保护的文本训练大语言模型的伦理影响。

Training AI models on copyrighted material raises significant ethical and legal concerns. Creators may lose control over their original work, and the models could reproduce verbatim excerpts, infringing on copyright. Ethically, it challenges the principle of consent and fair compensation. While some argue that such use falls under ‘fair dealing’ for research or text and data mining exceptions (as seen in some jurisdictions), others contend that commercial AI systems profit from copyrighted content without due reward to authors. The AQA specification expects students to weigh stakeholder interests, including creators, users, and technology companies, and consider the impact on society and the economy.

利用受版权保护的材料训练 AI 模型引发了重大的伦理与法律问题。创作者可能失去对自己原创作品的控制,而模型可能逐字重现片段,构成版权侵权。从伦理角度看,这挑战了知情同意与公平报酬原则。尽管有人认为此种使用属于“合理处理”或文本与数据挖掘的例外(如某些司法管辖区所规定),但其他人主张商业 AI 系统从版权内容中获利,却未给予作者应有的回报。AQA 考纲要求学生权衡创作者、用户和技术公司等利益相关者的利益,并考量对社会和经济的影响。

A strong answer would mention the need for transparency, licensing models, and the development of opt-out mechanisms for data owners.

一份出色的答案应提及透明度的必要性、许可模式以及为数据所有者开发退出机制的诉求。


10. Abstract Data Types: Queues in Simulation | 抽象数据类型:仿真中的队列

Question: A printer spooler uses a queue to manage print jobs. Jobs arrive at times 0, 2, 4 with processing times 5, 2, 3 units respectively. Simulate the queue and calculate average waiting time.

题目: 某打印假脱机程序使用队列管理打印任务。任务在时刻 0、2、4 到达,所需处理时间分别为 5、2、3 个时间单位。仿真该队列并计算平均等待时间。

Assuming a single printer, First-Come-First-Served order. Job 1 starts at time 0, finishes at 5. Job 2 arrives at 2 but must wait until 5, finishes at 7. Job 3 arrives at 4, starts at 7, finishes at 10. Waiting times: Job 1 = 0, Job 2 = 5 – 2 = 3, Job 3 = 7 – 4 = 3. Average waiting time = (0+3+3)/3 = 2 units.

假设只有一台打印机,采用先来先服务顺序。任务 1 于时刻 0 开始,时刻 5 结束。任务 2 在时刻 2 到达,但须等待至 5,于时刻 7 结束。任务 3 在时刻 4 到达,时刻 7 开始,时刻 10 结束。等待时间:任务 1=0,任务 2=5−2=3,任务 3=7−4=3。平均等待时间 = (0+3+3)/3 = 2 个时间单位。

Queue simulations often appear in AQA applied algorithms questions. They test understanding of FIFO behaviour, utilisation, and perhaps starvation avoidance if priority queues were introduced.

队列仿真常见于 AQA 应用算法题中。它们考察对 FIFO 特性、利用率(以及如果引入优先级队列,则可能考虑饥饿避免)的理解。


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