📚 CAIE AS Computer Science: Case Study Practice | CAIE AS 计算机:案例分析实战演练
Success in the CAIE AS Computer Science paper relies heavily on confident problem-solving and structured case study responses. This walkthrough guides you through a practical example — a Library Book Loan Manager — and explains each step, from breaking down a scenario to testing your final design. By working through this revision guide, you will learn how to apply decomposition, abstraction, algorithm design, and evaluation in a way the mark scheme rewards.
在 CAIE AS 计算机科学考试中,取得高分非常依赖自信的问题求解和结构化的案例分析作答。本文通过一个真实演练——图书馆借阅管理器——带你走遍每一个步骤,从拆解场景到测试最终设计。通过这份复习指南,你将学会如何运用分解、抽象、算法设计和评估,符合评分标准所奖励的方式。
1. Understanding the Case Study Task | 理解案例分析任务
Case study questions in CAIE AS Computer Science present a real-world scenario and ask you to design a solution. The scenario may describe a library requiring a system to manage books, borrowers, and loans. Your first job is to read the description carefully and identify exactly what the program must do. Underline functional requirements such as 'allow a student to borrow a book', 'prevent borrowing if the book is already on loan', and 'generate a report of overdue items'. Always distinguish between what is explicitly stated and what you might reasonably infer.
CAIE AS 计算机科学中的案例分析题会给出一个现实场景,并要求你设计一个解决方案。场景可能描述一个需要管理图书、借阅人和借阅记录的图书馆。你的首要任务是仔细阅读描述,准确识别程序必须做什么。划出功能性需求,例如“允许学生借书”、“如果图书已借出则阻止借阅”、“生成逾期项目报告”。务必区分明确陈述的要求和你可能合理推断的内容。
2. Problem Decomposition | 问题分解
Once the requirements are clear, break the problem into smaller, manageable modules. For the library system, you might decompose it into: Book Registration, Borrower Registration, Loan Processing, Return Processing, Overdue Detection, and Report Generation. Decomposition not only makes the design clearer but also helps you allocate marks efficiently. Each module will later become a procedure or a function in your pseudocode.
一旦需求明确,将问题分解为更小、可管理的模块。对图书馆系统而言,你可以分解为:图书登记、借阅人登记、借书处理、还书处理、逾期检测和报告生成。分解不仅让设计更清晰,还有助于你高效地分配分数。每个模块之后会成为伪代码中的一个过程或函数。
- Book Registration – add new books to the catalogue
- Borrower Registration – maintain a list of library members
- Loan Processing – record a loan only when conditions are met
- Return Processing – update availability and compute fines
- Overdue Detection – compare due dates with the current date
- Report Generation – list all overdue books for a librarian
- 图书登记 – 向目录添加新书
- 借阅人登记 – 维护图书馆成员列表
- 借书处理 – 仅在条件满足时记录借阅
- 还书处理 – 更新可用状态并计算罚款
- 逾期检测 – 比较到期日与当前日期
- 报告生成 – 为图书管理员列出所有逾期图书
3. Abstraction and Modelling | 抽象与建模
Abstraction means keeping only the details that are relevant to the problem and ignoring unnecessary complexity. For our library case study, a book can be abstracted to its ID, title, author, and loan status. A borrower becomes an ID, name, and contact. You do not need to model the physical location of books or the colour of the shelves. This simplified model allows you to focus on the logic without getting lost in real-world clutter.
抽象意味着只保留与问题相关的细节,忽略不必要的复杂性。对我们的图书馆案例分析来说,一本书可以抽象为图书 ID、书名、作者和借阅状态。借阅人则抽象为 ID、姓名和联系方式。你无需对图书的物理位置或书架颜色建模。这种简化模型让你能够专注于逻辑,而不会被现实世界的杂音干扰。
For example, a book record could be modelled as a composite data type with fields: BookID : Integer, Title : String, Author : String, OnLoan : Boolean, DueDate : Date. This abstraction is precise enough to support all required operations.
例如,一本图书记录可以建模为一个复合数据类型,包含字段:BookID : Integer, Title : String, Author : String, OnLoan : Boolean, DueDate : Date。这种抽象足够精确,可以支持所有要求的操作。
4. Identifying Inputs, Processes, and Outputs | 确定输入、处理和输出
Every system can be described in terms of IPO (Input-Process-Output). Draw an IPO chart to visualise what data enters each module, how it is transformed, and what results are produced. This step prevents you from overlooking necessary data validation and helps structure your pseudocode.
每个系统都可以用 IPO(输入-处理-输出)来描述。绘制 IPO 表格以可视化每个模块输入哪些数据、如何转换这些数据以及产生什么结果。这一步能防止你忽略必要的数据验证,也有助于组织伪代码的结构。
| Module (模块) | Input (输入) | Process (处理) | Output (输出) |
|---|---|---|---|
| Borrow Book | BookID, BorrowerID | Check availability, validate borrower, set loan status | Success message or error |
| Return Book | BookID, ReturnDate | Calculate fine if overdue, update status | Fine amount or confirmation |
| Overdue Report | Current date | Scan all loans, compare dates | List of overdue books |
When you define inputs and outputs clearly, your algorithm design becomes much more focused. Always consider exceptional inputs, such as an empty BookID or a borrower who has already reached the maximum loan limit.
当你清晰地定义了输入和输出,算法设计会变得更加集中。始终要考虑异常输入,比如空的图书 ID 或已经达到最大借阅数量的借阅人。
5. Data Structures and Storage | 数据结构与存储
Choosing the right data structures is critical. For a small library scenario, arrays or lists of records work well. You could declare an array of Book records and an array of Borrower records. Since the number of books may change, you might use a dynamic data structure such as a linked list in pseudocode, but arrays indexed by 1..max are acceptable in AS answers. You must also decide how loans are stored: a separate Loan record array that links BookID and BorrowerID, with a DueDate field.
选择正确的数据结构至关重要。对于一个图书馆小场景,记录数组或列表就很合适。你可以声明一个 Book 记录数组和一个 Borrower 记录数组。由于图书数量可能变化,你可以在伪代码中使用链表这类动态数据结构,但在 AS 答案中,索引从 1 到 max 的数组也是可以接受的。你还必须决定如何存储借阅记录:一个独立的 Loan 记录数组,关联 BookID 和 BorrowerID,并包含 DueDate 字段。
For example: TYPE Book DECLARE BookID : INTEGER, Title : STRING, Author : STRING, OnLoan : BOOLEAN, DueDate : DATE ENDTYPE. Then DECLARE Library : ARRAY[1:500] OF Book. This shows the examiner you have thought about how data will be held and accessed.
例如:TYPE Book DECLARE BookID : INTEGER, Title : STRING, Author : STRING, OnLoan : BOOLEAN, DueDate : DATE ENDTYPE。然后 DECLARE Library : ARRAY[1:500] OF Book。这向考官表明你已经考虑了数据的保存和访问方式。
6. Algorithm Design: Stepwise Refinement | 算法设计:逐步求精
Start with a high-level description and refine it into a detailed pseudocode algorithm. For example, the BorrowBook module begins as: 'Check if the book exists, check if it is available, check borrower eligibility, record the loan, set due date'. Then refine each condition: 'IF book not found THEN output error, ELSE IF book already on loan THEN output error, ELSE IF borrower has 3 books on loan THEN output error, ELSE update book status, create loan record, set due date to current date + 14 days'. This stepwise method ensures no logic is missed.
从高层次的描述开始,逐步细化为详细的伪代码算法。例如,BorrowBook 模块最初是:“检查图书是否存在,检查是否可借,检查借阅人资格,记录借阅,设置到期日”。然后细化每个条件:“IF 图书未找到 THEN 输出错误,ELSE IF 图书已借出 THEN 输出错误,ELSE IF 借阅人已借 3 本书 THEN 输出错误,ELSE 更新图书状态,创建借阅记录,设置到期日为当前日期 + 14 天”。这种逐步求精的方法确保没有遗漏任何逻辑。
PROCEDURE BorrowBook(BookID, BorrowerID)
IF NOT ValidBook(BookID) THEN OUTPUT 'Invalid Book'
ELSE IF Book[BookID].OnLoan = TRUE THEN OUTPUT 'Already on loan'
ELSE IF CountLoans(BorrowerID) >= 3 THEN OUTPUT 'Loan limit reached'
ELSE Book[BookID].OnLoan ← TRUE
Book[BookID].DueDate ← CurrentDate + 14
CreateLoan(BookID, BorrowerID, Book[BookID].DueDate)
OUTPUT 'Loan successful'
ENDIF
7. Flowcharts and Pseudocode | 流程图与伪代码
You may be asked to represent your design using a flowchart or structured English/pseudocode. A flowchart for the BorrowBook module would include decision diamonds for each validation check. Use standard symbols: ovals for start/end, parallelograms for input/output, rectangles for processes, and diamonds for decisions. Pseudocode should be clearly indented and use keywords like WHILE, REPEAT, IF...THEN...ELSE...ENDIF, and FOREACH if needed. Consistent style signals professionalism.
你可能需要用流程图或结构化英语/伪代码来表达你的设计。BorrowBook 模块的流程图将包含每个验证检查的决策菱形。使用标准符号:起点/终点用椭圆,输入/输出用平行四边形,处理用矩形,判断用菱形。伪代码应清晰缩进,并使用 WHILE、REPEAT、IF...THEN...ELSE...ENDIF 等关键字,必要时使用 FOREACH。一致的风格体现了专业性。
In an exam, you don't need to draw the perfect box; a neat, labelled sketch is enough. However, always ensure your flowchart corresponds exactly to the logic of your pseudocode. A mismatch between the two will lose marks.
在考试中,你不需要画出完美的方框;一个整洁、带标签的草图就足够了。但是,务必要确保流程图与伪代码的逻辑完全对应。两者不匹配将会丢分。
8. Test Plan and Boundary Cases | 测试计划与边界情况
lude normal, erroneous, and boundary test cases. For BorrowBook, normal test: valid BookID and BorrowerID with no loans → success. Erroneous test: non-existent BookID → error message. Boundary test: borrower with exactly 2 current loans → loan accepted (boundary of limit 3); borrower with 3 loans → denied. Also test dates: due date should be 14 days from today, even if the 14th day falls on a weekend (unless specified otherwise).
一个扎实的测试计划能证明你的解决方案正确无误。为每个模块创建一个表格,包含测试 ID、输入数据、预期结果和目的。要包括正常、错误和边界测试用例。对于 BorrowBook,正常测试:有效的 BookID 和 BorrowerID 且无借阅 → 成功。错误测试:不存在的 BookID → 错误消息。边界测试:借阅人当前有 2 本书 → 借阅被接受(限额 3 的边界);借阅人有 3 本书 → 被拒绝。还要测试日期:到期日应为今天起 14 天,即使第 14 天落在周末(除非另有说明)。
| Test ID | Input | Expected Outcome | Type |
|---|---|---|---|
| T1 | BookID=101, BorrowerID=1 (0 loans) | Loan recorded, due date Today+14 | Normal |
| T2 | BookID=999 (non-existent) | 'Invalid Book' message | Erroneous |
| T3 | BorrowerID=2 with 3 active loans | 'Loan limit reached' | Boundary |
9. Evaluation and Refinement | 评估与改进
After designing and testing, critically evaluate your solution. Consider how well it meets the original requirements. Does it handle all functional requirements? Is it efficient? For the library system, you might evaluate the choice of a static array: it limits the number of books and wastes memory if not full. A refinement could be to use an external file for persistent storage and load records dynamically. Discuss any limitations, such as the system not handling reservations or renewals, and suggest improvements for a future version.
在设计和测试之后,批判性地评价你的解决方案。考虑它在多大程度上满足原始需求。它是否处理了所有功能性需求?它是否高效?对图书馆系统而言,你可以评价选择静态数组:它限制了图书数量,且若未满会浪费内存。一项改进可以是使用外部文件进行持久存储,动态加载记录。讨论任何局限性,例如系统未处理预约或续借,并建议未来版本的改进方向。
Examiners value evaluation because it shows higher-order thinking. Mention how you could make the system more robust by adding input validation (e.g., checking that BookID is a positive integer) and by trapping runtime errors. This section can make the difference between a low A and a high A*.
考官看重评价,因为它展示了高阶思维。提到你可以如何通过增加输入验证(例如,检查 BookID 是否为正整数)和捕获运行时错误来使系统更健壮。这一部分可能是低 A 分和高 A* 分之间的区别。
10. Exam Technique Tips | 考试技巧
When tackling a case study question under timed conditions, follow a disciplined approach. Read the scenario twice, highlight keywords, and quickly sketch an IPO chart on the blank page. Allocate about 25% of the time to planning, 50% to writing the answer, and 25% to testing and review. Use the exact naming conventions given in the question; do not invent your own. If the question says 'MemberID', do not use 'BorrowerID'. Wherever appropriate, include comments in your pseudocode to explain your logic — they demonstrate understanding even if a small syntax slip occurs.
在限时条件下应对案例分析题时,要遵循有序的方法。阅读场景两遍,高亮关键词,并在空白页上快速画出 IPO 图表。分配大约 25% 的时间进行规划,50% 用于书写答案,25% 用于测试和检查。使用题目给出的准确命名约定;不要自己创造。如果题目说“MemberID”,就不要使用“BorrowerID”。在任何合适的地方,在伪代码中加入注释来解释你的逻辑——即便出现微小的语法失误,这些注释也能展示出你的理解。
- Always respond exactly to the command words: 'Describe', 'Explain', 'Design', mean different things.
- If asked to write code, present it in a clear, consistent indentation style.
- For 'Design a solution' questions, include data structures, algorithms, and a user interface sketch if relevant.
- Never leave a test plan empty — even three well-chosen tests can earn full marks.
- 始终精确回应指令词:“Describe”、“Explain”、“Design”各有不同含义。
- 如果要求编写代码,要以清晰、一致的缩进风格呈现。
- 对于“设计一个解决方案”类问题,要包括数据结构、算法,以及相关的用户界面草图。
- 绝不要让测试计划留空——即使只有三个精心选择的测试也能获得满分。
11. Worked Example: School Voting System | 完整示例:学校投票系统
To consolidate your skills, let us briefly step through another scenario: a school needs a program to run an election for Head Prefect. Voters enter their student ID, then select one candidate from a list. A student may vote only once. The program must count votes and display the winner. Decompose into modules: Voter Authentication, Vote Casting, Duplicate Prevention, Vote Counting, and Result Display. For data structures, you could have an array of Candidates (ID, Name, VoteCount) and a separate array of VoterIDs who have voted. This mirrors the library case study but with different validation rules.
为了巩固你的技能,让我们快速过一遍另一个场景:一所学校需要一个程序来运行级长选举。投票者输入他们的学号,然后从列表中选择一名候选人。一个学生只能投票一次。程序必须计票并显示获胜者。将其分解为模块:投票者身份验证、投票、防止重复投票、计票和结果显示。对于数据结构,你可以有一个候选人数组(ID、姓名、票数)和一个已投票学号的单独数组。这跟图书馆案例分析类似,只是验证规则不同。
Key differences help you recognise pattern parallels: preventing duplicate votes is like preventing a book from being borrowed twice; the maximum vote rule is analogous to the loan limit. Practising multiple scenarios builds your ability to transfer problem-solving patterns, which is exactly what examiners test.
关键的区别有助于你认识到模式的相似之处:防止重复投票就像防止一本书被重复借出;最大投票规则类似于借阅限额。多加练习多个场景能培养你迁移问题求解模式的能力,而这正是考官所要考察的。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

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