📚 Year 12 WJEC Computer Science: Case Study Practical Exercises | Year 12 WJEC 计算机:案例分析实战演练
Case study questions in WJEC AS Computer Science challenge you to apply theoretical knowledge to realistic scenarios, from designing algorithms to evaluating system solutions. This guide walks through a series of hands-on exercises that mirror the style and depth of examination tasks, helping you build confidence and analytical skill.
WJEC AS 计算机科学中的案例分析题要求你将理论知识应用于真实场景,无论是设计算法还是评估系统方案。本指南将通过一系列实战练习,还原考试中的题型与深度,帮助你建立自信和分析能力。
1. Understanding the Case Study Format | 理解案例分析题形式
A typical WJEC case study presents a narrative about an organisation, its computing needs, and constraints. You will then be asked to analyse the problem, propose solutions, and justify design choices.
典型的 WJEC 案例分析题会描述一个组织、其计算需求及约束条件。接着要求你分析问题、提出解决方案并论证设计选择。
Questions often combine programming logic, data structures, system architecture, and ethical considerations. For example, a local library wants a new borrowing system; the scenario includes user requirements, existing hardware, and budget limits.
题目通常融合编程逻辑、数据结构、系统架构和伦理考量。例如,当地图书馆想要一个新借阅系统;题干包含用户需求、现有硬件和预算限制。
Marks are awarded for clear reasoning, correct use of terminology, and practical feasibility. Always read the scenario twice before attempting any sub-question.
分数依据清晰的推理、术语的正确使用和实际可行性来分配。在作答任何小问前一定要把题干读两遍。
2. Exercise 1: Requirement Analysis and Abstraction | 练习 1:需求分析与抽象
Scenario: A sports centre wants a digital check-in system. Members swipe a card, and the system logs entry time, checks membership validity, and alerts staff if a membership has expired or the centre is at capacity.
场景:一家体育中心想要一套数字签到系统。会员刷卡后,系统记录入场时间、核实会员资格有效,并在资格过期或场馆满员时提醒工作人员。
Task: List five functional requirements and two non-functional requirements. Then create a simple abstraction by drawing an input-process-output table (you may sketch it mentally).
任务:列出五项功能性需求和两项非功能性需求。然后通过画一张输入-处理-输出表格来进行简单抽象(可以在脑中画)。
Sample functional requirements: 1. Read membership card ID. 2. Validate membership against database. 3. Record check-in timestamp. 4. Update occupancy count. 5. Display alert if capacity is exceeded.
功能性需求示例:1. 读取会员卡 ID。2. 依据数据库验证会员资格。3. 记录签到时间戳。4. 更新在场人数。5. 超出容量时显示警报。
Non-functional requirements: The system must respond within 2 seconds (performance); member data must be encrypted (security). Always separate what the system does from how it does it.
非功能性需求:系统必须在 2 秒内响应(性能);会员数据必须加密(安全)。始终区分系统做什么和怎么做。
3. Exercise 2: Algorithm Design with Flowcharts and Pseudocode | 练习 2:用流程图和伪代码设计算法
Using the check-in scenario, design an algorithm that decides whether to allow entry. Use structured English or pseudocode, then represent it as a flowchart (text-based description accepted in exam).
使用签到场景,设计一个决定是否允许入场的算法。使用结构化英语或伪代码,然后表示为流程图(考试中接受文字描述)。
Pseudocode example:
IF membership is valid THEN
IF current occupancy < max_capacity THEN
Allow entry
Increment occupancy by 1
ELSE
Display 'Centre full'
ENDIF
ELSE
Display 'Membership expired'
ENDIF
伪代码示例:若会员有效,则检查当前人数是否小于最大容量;是则允许入场,人数加 1;否则显示“场馆已满”;若会员无效则显示“会员过期”。
This demonstrates sequence, selection, and iteration (if we add looping for multiple check-ins). Focus on clarity and logical completeness.
这展示了顺序、选择和迭代(如果加上多次签到循环的话)。重点在于清晰和逻辑完整。
4. Exercise 3: Data Structure Selection | 练习 3:数据结构选择
A vet clinic needs to store pet records: name, species, owner, and treatment history. Which data structures would you use for fast retrieval by pet name and by owner? Justify your choice.
一家兽医诊所需要存储宠物记录:名字、物种、主人和治疗历史。你会使用什么数据结构来按宠物名和按主人快速检索?请说明理由。
A hash table (or dictionary) keyed by pet ID could give O(1) average lookup, while an array of records allows sequential storage. For owner-based searches, a separate index (e.g., a hash map from owner ID to list of pet IDs) works well.
用宠物 ID 作为键的哈希表(或字典)可以实现平均 O(1) 查找,而记录数组允许顺序存储。对于基于主人的搜索,单独的索引(如从主人 ID 到宠物 ID 列表的哈希映射)效果很好。
Explain time complexity: searching an unsorted array takes O(n), while a binary search on a sorted array is O(log n). The choice depends on the type of queries and frequency of updates.
解释时间复杂度:在未排序数组中搜索需要 O(n),而在已排序数组中的二分搜索是 O(log n)。选择取决于查询类型和更新频率。
5. Exercise 4: Programming Constructs and Dry-Run | 练习 5:编程结构与干运行
Given a small program snippet, perform a dry-run to trace variable values. Example snippet in a C-family pseudocode:
给出一小段程序,进行干运行跟踪变量值。示例用类 C 伪代码:
total = 0
FOR i = 1 TO 5
IF i MOD 2 = 0 THEN
total = total + i
ELSE
total = total - 1
ENDIF
ENDFOR
OUTPUT total
total = 0; i 从 1 到 5: i=1 奇数 total=-1; i=2 偶数 total=1; i=3 奇数 total=0; i=4 偶数 total=4; i=5 奇数 total=3。输出 3。
Dry-running helps detect logical errors. Show a trace table with columns for iteration, condition, and variable values. This is a low-stakes way to verify algorithm correctness.
干运行有助于发现逻辑错误。制作跟踪表,列出迭代次数、条件和变量值。这是验证算法正确性的低成本方法。
6. Exercise 6: Error Handling and Testing | 练习 6:错误处理与测试
Extend the check-in algorithm to handle invalid card reads and database connection failures. What test data would you use? Identify normal, boundary, and erroneous test cases.
扩展签到算法以处理读卡无效和数据库连接故障。你会使用什么测试数据?识别正常、边界和错误测试用例。
apacity. Erroneous: unreadable card, expired card, database timeout. Add exception handling: TRY...CATCH for database errors, output 'System temporarily unavailable'.
正常:有效卡,场馆半满。边界:有效卡且当前人数 = 最大容量-1,以及等于最大容量时。错误:无法读取的卡、过期卡、数据库超时。添加异常处理:TRY...CATCH 用于数据库错误,输出“系统暂时不可用”。
Testing should cover all branches of selection statements. Use a testing table with test ID, input, expected output, actual output, and pass/fail.
测试应该覆盖选择语句的所有分支。使用测试表,包含测试 ID、输入、预期输出、实际输出和通过/失败。
7. Exercise 7: System Design and Architecture | 练习 7:系统设计与架构
Propose a high-level architecture for a school's homework submission platform. Describe client-server model, choice of database, and how web servers handle requests.
为一所学校的作业提交平台提出高层架构。描述客户端-服务器模型、数据库选型以及 Web 服务器如何处理请求。
A three-tier architecture: presentation layer (web browser), application logic (server-side scripts), and data layer (SQL database). Use RESTful API for communication. The server validates user, stores files, and records submission timestamps.
三层架构:表示层(Web 浏览器)、应用逻辑层(服务器端脚本)和数据层(SQL 数据库)。使用 RESTful API 进行通信。服务器验证用户、存储文件并记录提交时间戳。
Consider scalability: use load balancer if submissions spike near deadlines. Mention security: HTTPS, input sanitisation, and authentication. Diagrams earn marks even if hand-drawn and described in words.
考虑可扩展性:如果临近截止日期提交激增,则使用负载均衡器。提到安全:HTTPS、输入清理和身份验证。即便手绘并用文字描述,图表也能得分。
8. Exercise 8: Ethical and Legal Implications | 练习 8:伦理与法律影响
The homework platform stores student submissions and grades. What are the implications under GDPR? What measures ensure compliance and ethical use?
该作业平台存储学生提交内容和成绩。根据 GDPR 有哪些影响?什么措施确保合规与道德使用?
Under GDPR, personal data must be processed lawfully, transparently, and for specified purposes. The school must obtain consent (or rely on legitimate interest) and provide access rights. Students have the right to data erasure after leaving.
根据 GDPR,个人数据必须合法、透明且用于特定目的。学校必须获得同意(或依赖合法权益)并提供访问权。学生离校后有权要求数据删除。
Technically: implement role-based access, encryption at rest, and audit logs. Ethically, avoid algorithmic bias in automated grading and seek fairness.
技术上:实现基于角色的访问控制、静态数据加密和审计日志。伦理上,避免自动评分中的算法偏见,追求公平。
9. Exercise 9: Object-Oriented Analysis (Class Diagrams) | 练习 9:面向对象分析(类图)
Model a music streaming service with classes: User, Song, Playlist, and Subscription. Identify attributes, methods, and relationships (inheritance, association).
用类 User、Song、Playlist 和 Subscription 建模一个音乐流媒体服务。识别属性、方法和关系(继承、关联)。
User class could have premium user subclass. Playlist contains list of Song objects (aggregation). Subscription class linked to User (composition). Methods: play(), addToPlaylist(), calculateFee(). Cardinality (1 user has many playlists) must be marked.
User 类可以有 PremiumUser 子类。Playlist 包含 Song 对象列表(聚合)。Subscription 类与 User 关联(组合)。方法:play()、addToPlaylist()、calculateFee()。必须标注基数(1 个用户有多个播放列表)。
Draw the class diagram using proper UML notation. This tests your ability to abstract real-world concepts into software blueprints.
使用正确的 UML 符号绘制类图。这考察你将现实概念抽象为软件蓝图的能力。
10. Exercise 10: Database Design and Normalisation | 练习 10:数据库设计与规范化
Design a relational database for the music streaming service. Create an entity-relationship diagram (ERD) and normalise to 3NF. Show tables with primary and foreign keys.
为音乐流媒体服务设计关系数据库。创建实体关系图(ERD)并规范化至第三范式(3NF)。展示带有主键和外键的表。
Tables: Users(userID PK, name, email), Subscriptions(subID PK, userID FK, plan, startDate), Songs(songID PK, title, artist, album, duration), Playlists(playlistID PK, userID FK, name), PlaylistSongs(playlistID FK, songID FK) as junction table for M:N relationship.
表:Users(userID 主键, name, email), Subscriptions(subID 主键, userID 外键, plan, startDate), Songs(songID 主键, title, artist, album, duration), Playlists(playlistID 主键, userID 外键, name), PlaylistSongs(playlistID 外键, songID 外键) 作为连接多对多关系的中间表。
No repeating groups, no partial dependencies, no transitive dependencies ensure 3NF. Write SQL queries to retrieve songs from a given playlist.
无重复组、无部分依赖、无传递依赖确保 3NF。编写 SQL 查询从给定播放列表检索歌曲。
tist FROM Songs s JOIN PlaylistSongs ps ON s.songID = ps.songID WHERE ps.playlistID = 123;
11. Exercise 11: Evaluation of Solutions | 练习 11:解决方案评估
Compare two search algorithms (linear vs binary) for a phone book app. Evaluate time efficiency, memory usage, and suitability when data is frequently updated.
比较电话簿应用的两种搜索算法(线性与二分搜索)。评估时间效率、内存使用以及在数据频繁更新时的适宜性。
Linear search: O(n), works on unsorted data, simple to implement. Binary search: O(log n) but requires sorted data; sorting adds overhead O(n log n). If the phone book is static (rare changes), binary search is superior; if dynamic with many insertions, linear search or a balanced tree could be preferable.
线性搜索:O(n),可在未排序数据上工作,实现简单。二分搜索:O(log n) 但要求数据有序;排序带来 O(n log n) 的开销。如果电话簿是静态的(极少更改),二分搜索更优;如果动态且插入多,线性搜索或平衡树可能更好。
Justify with a table of pros and cons, linking to the scenario's constraints. Evaluation questions often ask for reasoned conclusions, not just descriptions.
用优缺点表格结合场景约束进行论证。评估题通常要求给出有理由的结论,而不仅仅是描述。
12. Bringing It All Together: A Mini-Case Study | 综合实战:一个小型案例研究
Scenario: A small charity manages volunteers and donations. They need a system to track volunteer hours, donation amounts, and generate thank-you letters. Produce a requirements list, a class diagram, a database design, and an algorithm to find the top donor of the month.
场景:一家小型慈善机构管理志愿者和捐赠。他们需要一个系统来记录志愿时长、捐赠金额并生成感谢信。请产出一份需求列表、一个类图、数据库设计,以及找出月度最佳捐赠者的算法。
Requirements: store volunteer info, log hours, record donations with date, generate letters as PDF. Algorithm: scan donation records for current month, find maximum donation amount, output donor name. Use a loop with a variable maxDonation initialised to 0, update when a larger value found.
需求:存储志愿者信息、记录时长、记录带日期的捐赠、生成 PDF 感谢信。算法:扫描当月捐赠记录,找到最大捐赠金额,输出捐赠者姓名。使用循环,将变量 maxDonation 初始化为 0,发现更大值时更新。
This exercise mimics the synthesis required in exam final parts, connecting analysis, design, implementation, and testing.
本练习模拟考试最后部分所需的综合能力,将分析、设计、实现和测试连接起来。
Published by TutorHao | WJEC Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

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