📚 Year 13 Edexcel Computer Science: Unit Test Mock Paper Walkthrough & Solutions | 单元测试模拟卷解析
This walkthrough breaks down a typical Year 13 Edexcel Computer Science unit test mock paper, covering topics from algorithm analysis and data structures to SQL, networking, and object-oriented programming. Each section mirrors a common exam question, providing step-by-step solutions, revision notes, and mark-scheme insights to help you refine your technique and deepen your understanding of the specification.
本文详细剖析一份典型的Year 13 Edexcel计算机科学单元测试模拟卷,内容涵盖算法分析、数据结构、SQL、网络和面向对象编程。每个小节对应一道常见考题,给出分步解答、复习要点和评分标准解读,帮助你完善答题技巧,加深对考纲内容的理解。
1. Algorithm Complexity & Big-O Notation | 算法复杂度与大O表示法
Question 1 presented a block of pseudocode with nested loops. The outer loop iterates n times, while the inner loop uses a variable step size that halves each time. The task was to derive the worst-case time complexity. The key insight is that the inner loop does not execute n times for every outer iteration; instead, it runs roughly log2n times per outer pass. Multiplying these gives an overall complexity of O(n log n).
第1题给出了一段嵌套循环的伪代码。外层循环执行n次,内层循环的步长每次减半。要求推导最坏情况时间复杂度。关键点在于内层循环并非每次外层循环都执行n次,而是每次外层循环大约运行log2n次。两者相乘得到整体复杂度O(n log n)。
Many students mistakenly wrote O(n²) because they assumed the inner loop always ran n times. Always check whether the inner loop’s iterations depend on the outer loop’s current value or on a fixed parameter that changes. In this case, the halving behaviour is characteristic of logarithmic growth. The correct answer earned the marks for both identifying the dominant term and expressing it in Big-O notation.
很多学生误答O(n²),因为他们误以为内层循环总是运行n次。务必检查内层循环的迭代次数是否依赖于外层循环的当前值,还是依赖于某个在变化的固定参数。这里的折半行为是对数增长的典型特征。正确回答既要指出主导项,又要用大O表示法表达,才能拿到全部分数。
for i ← 1 to n:
j ← n
while j > 1:
// constant work
j ← j / 2
The analysis: outer loop n times, inner while loop runs log2 n times, total O(n log n). Ensure you use the simplest and most conventional notation – O(n log n) is preferred over O(n ⋅ log₂ n) in this context.
分析:外层循环n次,内层while循环执行log2 n次,总计O(n log n)。确保使用最简洁通用的表示法——在这样的语境下O(n log n)优于O(n ⋅ log₂ n)。
2. Recursion & Recurrence Relations | 递归与递推关系
Question 2 required students to write a recurrence for a divide-and-conquer algorithm that splits a problem of size n into two sub-problems of size n/2, performs O(n) work to combine them, and has a base case T(1)=1. The recurrence is T(n) = 2T(n/2) + n. Applying the Master Theorem (case 2) gives T(n) = Θ(n log n).
第2题要求写出一个分治算法的递推关系:该算法将规模为n的问题分成两个规模为n/2的子问题,合并时执行O(n)的工作,基准情况T(1)=1。递推式为T(n) = 2T(n/2) + n。应用主定理(情况2)可得T(n) = Θ(n log n)。
When explaining your reasoning, it is vital to state the Master Theorem condition clearly: for T(n) = aT(n/b) + f(n), compare f(n) with nlogba. Here a=2, b=2, so nlog22 = n. Since f(n)=n is polynomially equal to n1, we use case 2 and multiply by a logarithmic factor. The solution is n log n, and you should note that the base of the logarithm does not affect the asymptotic class.
在解释推理过程时,必须清楚地说明主定理的条件:对于T(n) = aT(n/b) + f(n),比较f(n)与nlogba。此处a=2, b=2,因此nlog22 = n。由于f(n)=n与n1多项式相等,适用情况2,需要乘以对数因子。解为n log n,并且应当指出对数的底数不影响渐近类。
A common pitfall is omitting the base case in the recurrence or misidentifying the combining cost. In this mock paper, a follow-up sub-question asked students to draw a recursion tree and sum the per-level costs, which also yields n log n. Both approaches are acceptable in Edexcel exams, but you must show clear working.
常见的错误是在递推式中遗漏基准情况,或弄错合并代价。在这份模拟卷中,后续子问题要求画出递归树并将每层代价求和,这也得出n log n的结果。两种方法在Edexcel考试中都可以接受,但必须展示清晰的推导过程。
3. Data Structures: Binary Search Tree Operations | 数据结构:二叉搜索树操作
Question 3 gave an empty binary search tree (BST) and a sequence of integers to insert: 50, 30, 70, 20, 40, 60, 80. Students were asked to draw the resulting BST and then show the tree after deleting the node 50 using the in-order successor method. The correct deletion replaces 50 with its in-order successor (60), leaving a balanced structure.
第3题给出一棵空的二叉搜索树和待插入的整数序列:50, 30, 70, 20, 40, 60, 80。要求学生画出生成的BST,然后使用中序后继法删除节点50,并画出删除后的树。正确的删除操作是用中序后继(60)替换50,使树保持合理结构。
Examiners look for correct left-child/right-child placement: for each node, values less than the node go to the left, values greater go to the right. When deleting a node with two children, you must locate the smallest node in its right subtree – the in-order successor – copy its value, and delete that successor recursively. In this case, 60 is the smallest node in the right subtree of 50, so 60 becomes the new root.
阅卷人关注的是正确的左子/右子放置规则:对于每个节点,小于该节点的值放到左子树,大于该节点的值放到右子树。当删除具有两个孩子的节点时,必须找到其右子树中最小的节点——即中序后继——复制其值,并递归删除该后继。此处60是50右子树中最小的节点,因此60成为新的根。
| Initial BST after insertions: Root: 50 Left: 30 (Left: 20, Right: 40) Right: 70 (Left: 60, Right: 80) After deleting 50: |
Another valid approach is the in-order predecessor, but the question specified the successor method. Read the command words carefully: ‘using the in-order successor’ is an explicit instruction.
另一种可行的方法是使用中序前驱,但本题明确指定了后继法。仔细阅读指令词:“使用中序后继”是一条明确的指令。
4. Stack & Reverse Polish Notation | 栈与逆波兰表达式
Question 4 tested the use of a stack to evaluate a Reverse Polish Notation (RPN) expression: 5 3 2 * + 8 2 / – . The step-by-step evaluation pushes operands onto the stack and, when an operator is encountered, pops the necessary operands, computes the result, and pushes it back. The final answer is 7.
第4题考察使用栈求值逆波兰表达式:5 3 2 * + 8 2 / – 。分步求值过程是将操作数压入栈,遇到运算符时弹出所需操作数,计算结果后压回栈。最终答案是7。
| Token | Stack (bottom → top) |
|---|---|
| 5 | [5] |
| 3 | [5, 3] |
| 2 | [5, 3, 2] |
| * | pop 2, 3 → 3*2=6 ; push 6 → [5, 6] |
| + | pop 6, 5 → 5+6=11 ; push 11 → [11] |
| 8 | [11, 8] |
| 2 | [11, 8, 2] |
| / | pop 2, 8 → 8/2=4 ; push 4 → [11, 4] |
| – | pop 4, 11 → 11-4=7 ; push 7 → [7] |
Marks are awarded for showing the state of the stack after each operator. Many students lose marks by forgetting to state the order of operands during subtraction and division: the second popped operand is the left-hand side. In the final step, 11-4 gives 7, not 4-11.
此题按运算步骤展示栈的状态即可得分。许多学生在减法和除法时因操作数顺序表述错误而丢分:第二个弹出的操作数是被减数。在最后一步中,11-4得7,而非4-11。
RPN is closely linked to the compilation process and binary tree traversals; understanding this algorithm strengthens your knowledge of stack ADT applications.
逆波兰表达式与编译过程和二叉树遍历密切相关;掌握该算法能巩固你对栈抽象数据类型应用的理解。
5. SQL Queries on a Relational Database | 关系数据库的SQL查询
Question 5 provided two tables: Student(ID, Name, Age, TutorGroup) and Course(CourseCode, Title, Teacher), along with a linking table Enrolment(StudentID, CourseCode). Students had to write SQL to list the names of all students enrolled in ‘Computer Science’ with a tutor group of ’13A’. The correct query uses INNER JOINs across all three tables and a WHERE clause with two conditions.
第5题给出了两张表:Student(ID, Name, Age, TutorGroup) 和 Course(CourseCode, Title, Teacher),以及一张连接表 Enrolment(StudentID, CourseCode)。要求学生编写SQL,列出所有选修’Computer Science’且导师组为’13A’的学生姓名。正确的查询使用三表内连接,并在WHERE子句中包含两个条件。
SELECT Student.Name
FROM Student
INNER JOIN Enrolment ON Student.ID = Enrolment.StudentID
INNER JOIN Course ON Enrolment.CourseCode = Course.CourseCode
WHERE Course.Title = ‘Computer Science’ AND Student.TutorGroup = ’13A’;
Examiners expect explicit JOIN syntax rather than implicit joins (comma-style). They also want to see that you qualify column names to avoid ambiguity, especially when dealing with multiple tables. The linking table Enrolment is mandatory to resolve the many-to-many relationship between Student and Course.
阅卷人期望使用显式的JOIN语法,而非隐式的逗号连接。他们同样希望看到你用表名限定列名以避免歧义,尤其是在处理多张表时。连接表Enrolment是解决Student与Course之间多对多关系的必需品。
A variant sub-question asked for a count of students per course. That required GROUP BY Course.Title and the COUNT(*) aggregate function. Always remember to include non-aggregated columns in the GROUP BY clause; otherwise, the query will cause an error in many DBMS (though Edexcel accepts correct logic).
一个变体子问题要求统计每门课的学生人数,此时需要使用 GROUP BY Course.Title 和 COUNT(*) 聚合函数。务必记住将非聚合列放入GROUP BY子句;否则,该查询在许多数据库管理系统中会出错(尽管Edexcel接受逻辑正确的答案)。
6. Network Protocols: TCP vs UDP | 网络协议:TCP与UDP对比
Question 6 presented a scenario of a real-time video streaming application and asked students to justify the choice of UDP over TCP at the transport layer. UDP’s key advantages in this context are low latency, no handshake overhead, and the ability to tolerate packet loss without retransmission delays. TCP’s three-way handshake, acknowledgements, and flow control would introduce unacceptable jitter for live streaming.
第6题给出一个实时视频流应用的场景,要求学生在传输层选择UDP而非TCP并说明理由。UDP在此场景中的关键优势是低延迟、无握手开销,以及容忍丢包而不必触发重传延迟。TCP的三次握手、确认和流量控制会给直播流带来无法接受的抖动。
To gain full marks, you must contrast both protocols explicitly: TCP provides reliable, ordered delivery with error recovery, while UDP offers a connectionless, best-effort datagram service. Mention that for live audio/video, occasional frame loss is preferable to a frozen picture waiting for retransmission. Also note that application-layer techniques like Forward Error Correction (FEC) can compensate for UDP’s unreliability.
为了拿到满分,必须明确对比两种协议:TCP提供可靠、有序的传输和差错恢复,而UDP提供一种无连接的、尽力而为的数据报服务。要提到,对于实时音视频而言,偶尔丢失帧比画面卡住等待重传更可取。还需指出,应用层技术如前向纠错(FEC)可以弥补UDP的不可靠性。
| Feature | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented | Connectionless |
| Reliability | Reliable (ACKs & retransmission) | Unreliable (no ACKs) |
| Ordering | In-order delivery | No ordering guarantees |
| Overhead | Higher (handshake, windowing) | Lower (8-byte header) |
| Use Cases | Web, email, file transfer | Streaming, VoIP, DNS, gaming |
Be precise: ‘connectionless’ does not mean ‘no connection ever’; it means each datagram is independent. Also, you may be asked about port numbers – UDP and TCP use 16-bit port numbers, but they are separate spaces.
表述要精准:“无连接”并非“从不连接”,而是每个数据报相互独立。此外,你还可能被问到端口号——UDP和TCP都使用16位端口号,但它们拥有各自的端口空间。
7. Object-Oriented Programming Concepts | 面向对象编程概念
Question 7 involved a class diagram for a library system with classes Book, Member, and Loan. Students had to identify the relationships: Member ‘borrows’ Book through a Loan association class, demonstrating composition or aggregation depending on the lifecycle. The question assessed understanding of inheritance, encapsulation, and polymorphism.
第7题涉及一个图书馆系统的类图,包含Book、Member和Loan三个类。学生需要识别它们之间的关系:Member通过关联类Loan“借阅”Book,根据生命周期可体现聚合或组合。该题考察了继承、封装和多态的理解。
The mock paper asked to ‘explain how encapsulation is achieved in the Member class’. The answer should mention private attributes (e.g., memberID, name, loans) with public getters/setters that enforce validation rules. Additionally, polymorphism was tested through a method calculateFine() overridden in a subclass PremiumMember, where the fine calculation was halved.
模拟卷要求“解释Member类中如何实现封装”。答案应提及私有属性(如memberID、name、loans),以及增加验证规则的公有getter/setter方法。此外,通过子类PremiumMember重写方法calculateFine()(罚金计算减半)考查了多态。
When discussing inheritance, avoid vague terms. Clearly state that the subclass inherits attributes and methods from the superclass and can define additional ones or override existing behaviour. Markers also look for correct UML notation: a hollow triangle arrowhead points to the superclass, and a dashed line with an open arrowhead indicates interface realisation.
在讨论继承时,避免使用模糊的术语。明确指出子类继承父类的属性和方法,并且可以定义额外的成员或重写已有的行为。阅卷人同样会关注正确的UML符号:空心三角箭头指向父类,虚线带空心箭头表示接口实现。
8. Programming Task: Sorting Algorithm Implementation | 编程任务:排序算法实现
Question 8 provided an incomplete insertion sort algorithm in Python and asked students to fill in the missing lines, trace its execution on a small array, and state its worst-case time complexity. The missing code involved the while loop condition and shifting elements to the right: while j >= 0 and arr[j] > key: arr[j+1] = arr[j]; j -= 1. The trace for [5, 2, 4, 6, 1, 3] demonstrated the algorithm’s stable nature.
第8题给出一个不完整的Python插入排序算法,要求学生补全缺失的语句,对一个小型数组进行追踪执行,并说明其最坏情况时间复杂度。缺失的代码涉及while循环条件以及向右移动元素:while j >= 0 and arr[j] > key: arr[j+1] = arr[j]; j -= 1。对数组[5, 2, 4, 6, 1, 3]的追踪体现了该算法的稳定性。
The complexity discussion required explaining why insertion sort is O(n²) in the worst case (reverse-sorted input) but O(n) in the best case (already sorted). Credit was given for mentioning that for small or nearly sorted datasets, insertion sort can outperform quicksort. The paper also asked to compare insertion and merge sort in terms of space complexity: insertion sort uses O(1) auxiliary space, whereas merge sort needs O(n) auxiliary space.
复杂度的讨论需要解释为什么插入排序在最坏情况下(逆序输入)是O(n²),而在最好情况下(已排序)是O(n)。如果提到对于小型或近乎有序的数据集,插入排序可能优于快速排序,则可得分。试卷还要求比较插入排序与归并排序的空间复杂度:插入排序仅需O(1)的辅助空间,而归并排序需要O(n)的辅助空间。
Always write clean, indented code in your answers. Even in pseudocode, consistent indentation helps examiners follow your logic. When tracing, show the array after each outer loop iteration – a table is an excellent way to present this.
答题时要始终书写整洁、带缩进的代码。即便是伪代码,一致的缩进也有助于阅卷人理解你的逻辑。进行追踪时,展示每轮外层循环后的数组状态——使用表格是绝佳的呈现方式。
| Iteration | Sorted Part | Unsorted Part |
|---|---|---|
| Initial | [5] | [2,4,6,1,3] |
| After i=2 | [2,5] | [4,6,1,3] |
| After i=3 | [2,4,5] | [6,1,3] |
| … Final | [1,2,3,4,5,6] | [] |
9. Boolean Algebra Simplification | 布尔代数化简
Question 9 asked students to simplify the Boolean expression ¬A·¬B·C + ¬A·B·C + A·¬B·C + A·B·C using algebraic laws and confirm the result with a truth table. By factoring C out of all terms, the expression reduces to C·(¬A·¬B + ¬A·B + A·¬B + A·B). The bracket covers all four possible combinations of A and B, which equals 1. Hence the simplified expression is simply C.
第9题要求学生运用代数定律化简布尔表达式 ¬A·¬B·C + ¬A·B·C + A·¬B·C + A·B·C,并用真值表验证结果。将所有项提出公因子C后,表达式化简为 C·(¬A·¬B + ¬A·B + A·¬B + A·B)。括号内包含了A和B所有四种可能组合,结果为1。因此化简结果就是C。
To gain method marks, you must show each step: first apply distribution (AND over OR), then use the complement law or the identity that x + ¬x = 1. Some students used a Karnaugh map; this is valid but must be drawn neatly and interpreted correctly. In the truth table, the output column for the expression should match column C perfectly.
要得到过程分,必须展示每一步:首先运用分配律(AND对OR的分配),然后使用补余律或恒等式 x + ¬x = 1。有些学生使用了卡诺图;这是可行的,但必须整齐绘制并正确解读。在真值表中,表达式的输出列应与C列完全一致。
F = C · (¬A·¬B + ¬A·B + A·¬B + A·B) = C · 1 = C
Boolean algebra is a frequent topic in paper 1. Be comfortable with operator precedence: NOT binds strongest, then AND, then OR, unless parentheses dictate otherwise. Use standard symbols ¬ or ~ for NOT, · or ∧ for AND, + or ∨ for OR, and ⊕ for XOR.
布尔代数是试卷1的常考主题。务必熟悉运算符优先级:NOT的约束最强,其次为AND,然后是OR,除非括号另作规定。使用标准符号:¬或~表示非,·或∧表示与,+或∨表示或,⊕表示异或。
Published by TutorHao | Year 13 Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导