📚 Year 12 SQA Computing: Unit Test Mock Paper Walkthrough | SQA 12年级计算机:单元测试模拟卷解析
This article provides a complete walkthrough of a mock paper designed for the Software Design and Development unit of the SQA Higher Computing Science course. It breaks down typical question types, offers model answers in SQA Reference Language pseudocode, and highlights common pitfalls. Whether you are preparing for an end-of-unit test or brushing up on your programming fundamentals, this analysis will help you understand exactly what examiners expect.
本文提供了一份专为 SQA 高级计算机科学“软件设计与开发”单元设计的模拟卷完整解析。文中拆解了典型题型、给出了 SQA 参考语言伪代码的标准答案,并重点列出了常见错误。无论你是在准备单元末测试,还是在巩固编程基础,这篇分析都能帮你精准把握考官的评分要求。
1. Mock Paper Overview | 模拟卷概述
This mock assessment mirrors the style and difficulty of a real SQA unit test for Software Design and Development. It lasts 45 minutes and carries a total of 40 marks distributed across seven questions. The topics range from basic variable declarations to algorithm analysis and testing strategies, covering all key knowledge points required at Higher level.
本模拟评估在风格和难度上均还原了 SQA 软件设计与开发单元的真实测试。考试时长45分钟,满分40分,共七道大题。考点涵盖从基本的变量声明到算法分析与测试策略,覆盖了 Higher 级别所需的所有核心知识点。
Examiners expect candidates to demonstrate not only correct syntax in pseudocode but also an understanding of data structures, modular design, input validation, and thorough testing. Marks are awarded for precise use of programming constructs, proper initialisation, and logical completeness.
考官不仅要求考生在伪代码中展现正确的语法,还期望考生展示对数据结构、模块化设计、输入验证及全面测试的理解。分数将根据编程结构的准确使用、正确的初始化以及逻辑的完整性进行评判。
2. Mock Paper Structure and Scoring Breakdown | 模拟卷结构与分值分布
The paper is structured as follows: Question 1 – Variables and Data Types (4 marks), Question 2 – Selection and Iteration (6 marks), Question 3 – Predefined Functions and Modularity (5 marks), Question 4 – Array Operations (8 marks), Question 5 – Record Type (7 marks), Question 6 – Testing and Error Types (5 marks), and Question 7 – Computational Thinking and Algorithm Efficiency (5 marks). Each question targets specific skills within the course specification.
试卷结构如下:题目1 – 变量与数据类型(4分),题目2 – 选择与循环结构(6分),题目3 – 预定义函数与模块化(5分),题目4 – 数组操作(8分),题目5 – 记录类型(7分),题目6 – 测试与错误类型(5分),题目7 – 计算思维与算法效率(5分)。每一题都精准对应课程规范中的特定技能。
Questions increase in complexity, moving from simple declarations to designing complete algorithms and evaluating efficiency. The mark allocation reflects the depth of understanding required: array manipulation and record handling carry higher weights because they integrate multiple programming concepts.
试题难度逐步递增,从简单的声明推进到完整算法设计与效率评估。分值的分配体现了所需理解的深度:数组操作与记录处理占分更高,因为它们整合了多个编程概念。
3. Question 1 – Variables and Data Types | 题目1 – 变量与数据类型
The first question presents a scenario: a payroll program must store an employee ID (integer), full name (string), and hourly rate of pay (real number). Candidates are required to write declaration and initialisation statements using SQA Reference Language.
第一题给出一个场景:一个工资程序需要存储雇员ID(整型)、全名(字符串)和小时工资率(实数)。考生需用 SQA 参考语言写出声明与初始化语句。
DECLARE employeeID AS INTEGER INITIALLY 0
DECLARE fullName AS STRING INITIALLY ""
DECLARE hourlyRate AS REAL INITIALLY 0.0
The model answer earns full marks (4 marks) by selecting the correct data types and by safely initialising the variables: the integer starts at 0, the string is empty, and the real number is set to 0.0. Failing to initialise, or using an inappropriate type such as STRING for the ID, will lose marks.
参考答案通过选择正确的数据类型并安全地初始化变量,获得满分(4分):整型初始为0,字符串为空,实数设为0.0。如果未初始化,或对ID使用了不合适的类型(如STRING),将会失分。
Examiners also look for the exact keyword INITIALLY. Writing a separate assignment statement after a plain DECLARE would not be accepted as a proper initialisation in this context.
考官同时要求使用精确的关键词 INITIALLY。如果只写了简单的 DECLARE,而后再用一条赋值语句,在此题的上下文中将不被视作正确的初始化。
4. Question 2 – Selection and Iteration | 题目2 – 选择与迭代
Candidates must write an algorithm that allows the user to enter 10 temperature values and then displays the number of days on which the temperature was 20 degrees or above. The solution should combine a fixed loop and a conditional statement.
考生需编写一个算法,允许用户输入10个温度值,然后显示温度达到或超过20度的天数。解答应结合使用固定循环和条件语句。
DECLARE temp AS REAL
DECLARE count AS INTEGER INITIALLY 0
FOR counter FROM 1 TO 10 DO
SEND "Enter a temperature:" TO DISPLAY
RECEIVE temp FROM KEYBOARD
IF temp >= 20 THEN
SET count = count + 1
END IF
END FOR
SEND count TO DISPLAY
correctly formulated IF condition (temp >= 20). The final output statement is essential; omitting it would lose a mark.
这道6分题考查的要点包括:正确的循环结构(FOR counter FROM 1 TO 10)、交互用到的 RECEIVE 与 SEND 的正确使用,以及条件表达式(temp >= 20)的准确编写。最后的输出语句至关重要,如果遗漏则会损失1分。
A common mistake is to write the condition as temp > 20, which excludes exactly 20.0. Another slip is forgetting to initialise count to 0, causing unpredictable behaviour. Always trace your algorithm with a few test values to avoid such off-by-one errors.
一个常见错误是将条件写成 temp > 20,这样会排除恰好等于20.0的情况。另一个失误是忘记将 count 初始化为0,导致行为不可预测。务必用几个测试值手动跟踪算法,以避免此类边界错误。
5. Question 3 – Predefined Functions and Modularity | 题目3 – 预定义函数与模块化
This two-part question asks students to explain two benefits of modular programming and to write a short procedure that generates a random whole number between 1 and 6 using the RANDOM and ROUND predefined functions.
本题分为两部分,要求说明模块化编程的两点好处,并使用 RANDOM 和 ROUND 两个预定义函数编写一个生成1到6之间随机整数的小程序。
Modularity improves code readability and allows teams to work on separate modules concurrently. It also enables code reuse, because a well-designed module can be called multiple times or imported into other programs. These points should be explained succinctly.
模块化提升了代码可读性,并允许团队成员并行开发不同模块。它还能实现代码重用,因为一个设计良好的模块可以被多次调用或导入到其他程序中。这些要点需要简洁阐明。
For the pseudocode, a correct answer is:
DECLARE dice AS INTEGER INITIALLY ROUND(RANDOM() * 5 + 1, 0)
The built-in function RANDOM() returns a real number between 0 and 1. Multiplying by 5 scales the range to 0–5, adding 1 shifts it to 1–6, and ROUND(value, 0) rounds to the nearest integer with zero decimal places. This compact statement earns all 3 available marks for the coding segment.
内置函数 RANDOM() 返回一个在0到1之间的实数。乘以5使范围变为0–5,加1使范围移至1–6,ROUND(value, 0) 则四舍五入到零位小数的整数。这条紧凑的语句能拿到编码部分的全部3分。
Students sometimes write RANDOM * 6, which produces 0–6, or forget to round the result, leading to a real number like 3.78. Remember that the ROUND function requires both the number and the number of decimal places as arguments.
学生有时会写成 RANDOM * 6,这样就生成了0–6的范围,或者忘记对结果进行舍入,导致出现如3.78这样的实数。切记 ROUND 函数需要数值和小数位数两个参数。
6. Question 4 – Array Operations | 题目4 – 数组操作
Given an array marks of 30 integers, candidates must write an algorithm to calculate the average mark and then display how many students scored above this average. This tests array traversal, accumulation, and the distinction between a counting and a summing loop.
题目给了一个包含30个整数的数组 marks,要求编写算法计算平均分,然后显示有多少名学生的分数高于该平均值。此题考查数组的遍历、累加,以及计数循环和求和循环之间的区别。
DECLARE marks[30] AS INTEGER INITIALLY [0,0,...]
DECLARE total AS INTEGER INITIALLY 0
DECLARE avg AS REAL
DECLARE above AS INTEGER INITIALLY 0
FOR i FROM 0 TO 29 DO
SET total = total + marks[i]
END FOR
SET avg = total / 30
FOR j FROM 0 TO 29 DO
IF marks[j] > avg THEN
SET above = above + 1
END IF
END FOR
SEND above TO DISPLAY
Full marks (8) are allocated for correct array declaration, two independent loops, a precise average calculation, and the final output. Using a single loop to attempt both tasks would result in computing a running average that changes each iteration—a conceptual error that costs heavily.
满分(8分)的分配标准包括:正确的数组声明、两个独立的循环、精确的平均值计算以及最终的输出。如果试图只用一个循环同时完成两项任务,就会导致平均值随着迭代不断变化,这是一个概念性错误,失分会非常严重。
Note that the average must be a REAL, because an integer division TOTAL/30 would truncate the decimal part. SQA expects a REAL variable for the average to maintain accuracy. Also, the array index runs from 0 to 29, not 1 to 30.
需注意,平均值必须声明为 REAL 类型,因为如果用整型除法 TOTAL/30 会截断小数部分。SQA 希望平均值使用 REAL 以保持精度。此外,数组索引从0到29,而非1到30。
7. Question 5 – Record Type | 题目5 – 记录类型
This question introduces a record structure. Candidates must define a StudentRecord type with fields forename, surname (both STRING) and prelimMark (INTEGER). They then declare an array of 20 such records and write an algorithm to find and display the full name of the student with the highest prelimMark.
此题引入记录结构。考生需定义一个 StudentRecord 类型,包含字段 forename、surname(均为 STRING)和 prelimMark(INTEGER)。然后声明一个包含20个此类记录的数组,并编写算法找出 prelimMark 最高的学生,显示其全名。
TYPE StudentRecord IS
STRING forename
STRING surname
INTEGER prelimMark
END TYPE
DECLARE students[20] AS StudentRecord
DECLARE highestIndex AS INTEGER INITIALLY 0
FOR k FROM 1 TO 19 DO
IF students[k].prelimMark > students[highestIndex].prelimMark THEN
SET highestIndex = k
END IF
END FOR
SEND students[highestIndex].forename & " " & students[highestIndex].surname TO DISPLAY
The solution initialises highestIndex to 0, assuming the first record holds the highest mark until another is found. The loop compares every subsequent record, updating the index when a higher mark is encountered. String concatenation uses the ampersand operator (&), as specified in SQA Reference Language.
该解法将 highestIndex 初始化为0,假定第一个记录保存着最高分,直到发现更高的分数。循环逐一比较后续记录,并在遇到更高分时更新索引。字符串连接使用 SQA 参考语言中指定的与号运算符 (&)。
A typical mistake is to store the highest mark in a separate variable and then try to retrieve the corresponding name without keeping the index. This makes it impossible to output the name unless you search the array again. Keeping the index is more efficient and demonstrates sound design thinking.
一个典型错误是单独用一个变量存储最高分,然后试图获取相应的姓名却不保留索引。这样除非重新搜索整个数组,否则无法输出姓名。保留索引不仅更高效,也体现了良好的设计思维。
8. Question 6 – Testing and Error Types | 题目6 – 测试与错误类型
Here candidates are asked to explain normal, boundary, and exceptional test data, and then to design a set
Published by TutorHao | Year 12 Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

或截图后用「扫一扫 → 相册」选择本图