📚 Case Study Practical Exercise | 案例分析实战演练
In the Cambridge IGCSE Computer Science (0478/0984) examination, the case study question assesses your ability to apply theoretical knowledge to a real-world scenario. This article provides a practical walkthrough of a typical case study – a ‘Homework Submission and Grading System’ for a school. By following the step-by-step analysis, you will learn how to identify requirements, design data structures, develop algorithms, draw flowcharts, and create test plans, all essential skills for scoring high in the paper.
在剑桥IGCSE计算机科学(0478/0984)考试中,案例分析题考查你将理论知识应用于真实场景的能力。本文将以一个典型的案例——学校“作业提交与评分系统”——进行实战演练。通过逐步分析,你将学会如何确定需求、设计数据结构、开发算法、绘制流程图以及制定测试计划,这些都是考试中取得高分的必备技能。
1. Understanding the Case Study Scenario | 理解案例场景
A secondary school wants to implement a digital system to manage homework assignments. Teachers can create a new assignment with a title, description, and deadline. Students log in to view pending assignments and submit their answers (text only). The system records the submission date and time. After the deadline, teachers can grade each submission on a scale of 0 to 100 and add a short comment. Students can view their own grades and feedback. The system must be secure: students cannot see other students’ submissions, and only teachers can enter grades. The school expects the system to handle up to 500 students and 50 teachers.
一所中学希望建立一个数字化系统来管理家庭作业。教师可以创建新作业,包含标题、描述和截止日期。学生登录后可查看待提交的作业并提交答案(纯文本)。系统记录提交的日期和时间。截止日期过后,教师可对每份提交按0至100分评分,并添加简短评语。学生可以查看自己的成绩和反馈。系统必须安全:学生无法查看他人的提交,只有教师才能录入成绩。学校预期该系统最多可处理500名学生和50名教师。
2. Identifying System Requirements | 确定系统需求
From the scenario we extract functional and non-functional requirements. Functional requirements describe what the system does; non-functional cover qualities like security and capacity.
从场景中我们可以提取功能需求和非功能需求。功能需求描述系统做什么;非功能需求涵盖安全性和容量等品质。
Functional Requirements:
功能需求:
- Allow teachers to create a new assignment (title, description, deadline).
- Allow students to view a list of available assignments.
- Accept a student’s textual submission for an assignment.
- Record the date and time of each submission.
- Check if the submission is after the deadline; if so, mark it as late.
- Allow teachers to view all submissions for their assignments.
- Allow teachers to enter a mark (0–100) and a comment for each submission.
- Let students see their own mark and feedback.
- Ensure a student can only access his/her own submissions and marks.
- 允许教师创建新作业(标题、描述、截止日期)。
- 允许学生查看可用作业列表。
- 接收学生对某作业的文本提交。
- 记录每次提交的日期和时间。
- 检查提交是否在截止日期之后;若是,标记为迟交。
- 允许教师查看其布置的作业的所有提交。
- 允许教师为每份提交录入分数(0–100)和评语。
- 允许学生查看自己的分数和反馈。
- 确保学生只能访问自己的提交和成绩。
Non-functional Requirements:
非功能需求:
- The system must support up to 500 students and 50 teachers concurrently.
- Passwords must be stored securely (hashed).
- The user interface should be intuitive for both staff and Year 7–13 students.
- Response time for any operation should be under 2 seconds.
- 系统需支持最多500名学生和50名教师同时使用。
- 密码必须安全存储(经哈希处理)。
- 用户界面应方便教职员工及7至13年级学生使用。
- 任何操作的响应时间应低于2秒。
3. Designing the User Interface | 设计用户界面
We sketch a simple menu-driven text interface suitable for IGCSE level. The system presents options after login.
我们构思一个简单的菜单驱动文本界面,适合IGCSE水平。登录后系统显示选项。
Teacher menu after login:
教师登录后的菜单:
1. Create a new assignment 2. View all my assignments 3. Grade submissions for an assignment 4. Logout Enter choice: _
1. 创建新作业 2. 查看我的所有作业 3. 为某作业的提交评分 4. 退出 请输入选择:_
Student menu after login:
学生登录后的菜单:
1. View available assignments 2. Submit an assignment 3. View my grades 4. Logout Enter choice: _
1. 查看可提交的作业 2. 提交作业 3. 查看我的成绩 4. 退出 请输入选择:_
For each action, the system prompts for necessary data. For instance, when creating an assignment, the teacher enters title, description, and deadline; the system stores them with an auto-generated assignment ID.
对于每一项操作,系统提示输入必要数据。例如,创建作业时,教师输入标题、描述和截止日期;系统储存时自动生成作业编号。
4. Data Structures and Storage | 数据结构与存储
At IGCSE level, data is often modelled using records and arrays stored in files. We design record structures for the main entities.
在IGCSE阶段,数据通常用记录和数组建模,并存储在文件中。我们为主要实体设计记录结构。
Assignment record:
作业记录:
TYPE Assignment DECLARE AssignmentID : INTEGER DECLARE TeacherID : INTEGER DECLARE Title : STRING DECLARE Description : STRING DECLARE Deadline : STRING // Format 'YYYY-MM-DD HH:MM' ENDTYPE
类型 Assignment 声明 AssignmentID : 整型 声明 TeacherID : 整型 声明 Title : 字符串 声明 Description : 字符串 声明 Deadline : 字符串 // 格式 'YYYY-MM-DD HH:MM' 结束类型
Submission record:
提交记录:
TYPE Submission DECLARE SubmissionID : INTEGER DECLARE AssignmentID : INTEGER DECLARE StudentID : INTEGER DECLARE Answer : STRING DECLARE SubmitDateTime : STRING // 'YYYY-MM-DD HH:MM' DECLARE IsLate : BOOLEAN DECLARE Mark : INTEGER DECLARE Comment : STRING ENDTYPE
类型 Submission 声明 SubmissionID : 整型 声明 AssignmentID : 整型 声明 StudentID : 整型 声明 Answer : 字符串 声明 SubmitDateTime : 字符串 // 'YYYY-MM-DD HH:MM' 声明 IsLate : 布尔型 声明 Mark : 整型 声明 Comment : 字符串 结束类型
User credentials are stored in a separate array:
用户凭证存储在另一个数组中:
TYPE User DECLARE UserID : INTEGER DECLARE Role : STRING // 'Teacher' or 'Student' DECLARE Username : STRING DECLARE PasswordHash : STRING ENDTYPE
类型 User 声明 UserID : 整型 声明 Role : 字符串 // '教师' 或 '学生' 声明 Username : 字符串 声明 PasswordHash : 字符串 结束类型
Files used: ‘Assignments.dat’ (array of Assignment), ‘Submissions.dat’ (array of Submission), ‘Users.dat’ (array of User). For simplicity, we assume the program reads all records into arrays at startup and writes back on exit.
使用的文件:“Assignments.dat”(作业数组)、“Submissions.dat”(提交数组)、“Users.dat”(用户数组)。为简单起见,我们假设程序启动时将所有记录读入数组,退出时写回文件。
5. Algorithm Design with Pseudocode | 用伪代码设计算法
We develop a key algorithm: recording a student submission. The system must check the deadline and set the late flag.
我们开发一个关键算法:记录学生提交。系统需检查截止日期并设置迟交标记。
Algorithm in pseudocode (CIE style):
伪代码算法(CIE 风格):
PROCEDURE SubmitAssignment(StudentID, AssignmentID, AnswerText)
DECLARE CurrentDateTime : STRING
CurrentDateTime ← GetSystemDateTime() // e.g. '2025-04-10 15:30'
// Find the assignment record
Found ← FALSE
FOR i ← 1 TO LEN(AssignmentArray)
IF AssignmentArray[i].AssignmentID = AssignmentID THEN
Found ← TRUE
DeadLineDt ← AssignmentArray[i].Deadline
ENDIF
NEXT i
IF Found = FALSE THEN
OUTPUT 'Assignment not found.'
RETURN
ENDIF
// Create new submission
NewSub ← NEW Submission
NewSub.SubmissionID ← NextSubmissionID()
NewSub.AssignmentID ← AssignmentID
NewSub.StudentID ← StudentID
NewSub.Answer ← AnswerText
NewSub.SubmitDateTime ← CurrentDateTime
// Compare dates (string comparison works if format is YYYY-MM-DD HH:MM)
IF CurrentDateTime > DeadLineDt THEN
NewSub.IsLate ← TRUE
ELSE
NewSub.IsLate ← FALSE
ENDIF
NewSub.Mark ← -1 // -1 indicates not yet graded
NewSub.Comment ← ''
APPEND SubmissionArray WITH NewSub
OUTPUT 'Submission recorded successfully.'
IF NewSub.IsLate THEN
OUTPUT 'Warning: this submission is late.'
ENDIF
ENDPROCEDURE
过程 SubmitAssignment(StudentID, AssignmentID, AnswerText)
声明 CurrentDateTime : 字符串
CurrentDateTime ← 获取系统日期时间() // 例如 '2025-04-10 15:30'
// 查找作业记录
Found ← FALSE
FOR i ← 1 TO LEN(AssignmentArray)
IF AssignmentArray[i].AssignmentID = AssignmentID THEN
Found ← TRUE
DeadLineDt ← AssignmentArray[i].Deadline
EXIT FOR
ENDIF
NEXT i
IF Found = FALSE THEN
OUTPUT '作业未找到。'
RETURN
ENDIF
// 创建新提交
NewSub ← 新 Submission
NewSub.SubmissionID ← 下一个提交编号()
NewSub.AssignmentID ← AssignmentID
NewSub.StudentID ← StudentID
NewSub.Answer ← AnswerText
NewSub.SubmitDateTime ← CurrentDateTime
// 比较日期(格式为 YYYY-MM-DD HH:MM 时可直接用字符串比较)
IF CurrentDateTime > DeadLineDt THEN
NewSub.IsLate ← TRUE
ELSE
NewSub.IsLate ← FALSE
ENDIF
NewSub.Mark ← -1 // -1 表示尚未评分
NewSub.Comment ← ''
将 NewSub 追加到 SubmissionArray
OUTPUT '提交已成功记录。'
IF NewSub.IsLate THEN
OUTPUT '警告:此提交已迟交。'
ENDIF
结束过程
Notice the use of string comparison for dates. This works because the format ‘YYYY-MM-DD HH:MM’ ensures chronological order matches lexicographical order. The NEW keyword creates a record; NEXT advances a counter to generate unique IDs.
注意这里使用了字符串比较日期。因为格式“YYYY-MM-DD HH:MM”能保证时间顺序与字典顺序一致。NEW 关键字创建记录;NEXT 则通过递增计数器生成唯一编号。
6. Flowchart Representation | 流程图表示
Flowcharts help visualise the control flow of an algorithm. Below is a textual description of a flowchart for the submission procedure; in the exam you would draw the symbols.
流程图有助于可视化算法的控制流程。下面是对提交过程流程图的文字描述;在考试中你需要画出相应符号。
Start → Input StudentID, AssignmentID, AnswerText → Get current date/time → Loop to search assignment array: decision ‘Found?’ → if no: output ‘Not found’, end; if yes: create new Submission object → fill fields → decision ‘CurrentDateTime > Deadline?’ → yes: set IsLate = TRUE; no: set IsLate = FALSE → append to SubmissionArray → output success message → if IsLate: output warning → End.
开始 → 输入学生编号、作业编号、答案文本 → 获取当前日期时间 → 循环查找作业数组:判断“是否找到?”→ 若否:输出“未找到”,结束;若是:创建新提交对象 → 填充字段 → 判断“当前日期时间 > 截止日期?”→ 是:设置 IsLate 为 TRUE;否:设置 IsLate 为 FALSE → 追加到提交数组 → 输出成功消息 → 若 IsLate 为 TRUE,则输出警告 → 结束。
The symbol mapping is standard: oval for Start/End, parallelogram for Input/Output, rectangle for process, diamond for decision. Arrows show flow.
符号映射是标准的:椭圆形表示开始/结束,平行四边形表示输入/输出,矩形表示处理步骤,菱形表示判断。箭头指示流程方向。
7. Test Plan and Trace Tables | 测试计划与跟踪表
A test plan validates the algorithm with normal, boundary, and erroneous data. We design test cases for SubmitAssignment.
测试计划用正常数据、边界数据和错误数据来验证算法。我们为 SubmitAssignment 设计测试用例。
| Test ID | Input Description | Expected Outcome |
|---|---|---|
| 1 | Valid student, valid assignment before deadline | Submission stored, IsLate=FALSE, success message |
| 2 | Valid student, valid assignment, current time 1 min after deadline | Submission stored, IsLate=TRUE, warning displayed |
| 3 | Invalid AssignmentID (does not exist) | ‘Assignment not found’ message, no submission created |
| 4 | Empty answer string | Submission stored with empty answer (acceptable) |
| 5 | Deadline exactly matches current time | IsLate=FALSE (boundary – on time) |
| 测试编号 | 输入描述 | 预期结果 |
|---|---|---|
| 1 | 有效学生、有效作业,提交在截止前 | 提交被存储,IsLate=FALSE,成功消息 |
| 2 | 有效学生、有效作业,当前时间晚于截止1分钟 | 提交被存储,IsLate=TRUE,显示警告 |
| 3 | 无效的作业编号(不存在) | 显示“作业未找到”,不创建提交 |
| 4 | 空答案字符串 | 提交被存储,答案为空(可接受) |
| 5 | 截止日期与当前时间完全相等 | IsLate=FALSE(边界——准时) |
Now we use a trace table to dry-run Test 2: StudentID=101, AssignmentID=5, Answer=’My answer’, current datetime ‘2025-04-10 15:31’, deadline ‘2025-04-10 15:30’.
现在我们用跟踪表对测试用例2进行人工执行:学生编号=101,作业编号=5,答案=’我的答案’,当前日期时间“2025-04-10 15:31”,截止日期“2025-04-10 15:30”。
| Step | Found | DeadLineDt | CurrentDateTime | NewSub.IsLate | Output |
|---|---|---|---|---|---|
| Initialize | FALSE | — | ‘2025-04-10 15:31’ | — | — |
| After FOR loop (found) | TRUE | ‘2025-04-10 15:30’ | ‘2025-04-10 15:31’ | — | — |
| After date comparison | TRUE | ‘2025-04-10 15:30’ | ‘2025-04-10 15:31’ | TRUE | ‘Submission recorded successfully.’ then ‘Warning: late.’ |
| 步骤 | Found | DeadLineDt | CurrentDateTime | NewSub.IsLate | 输出 |
|---|---|---|---|---|---|
| 初始化 | FALSE | 更多咨询请联系16621398022(同微信)
CommentsMore posts |
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply