Independent assessment A: parcel dispatch
独立考试工作坊
这些是全新的原创 AS 9618 考试风格题目。建议时间为 35 分钟。答题前阅读所有部分。一起提交所有答案;在提交之前,运行器和辅助工具保持不可用状态。
结构化检查为追踪赋值2分,边界测试赋2分,每个完整算法各赋6分。编程部分仅在所有用例均通过时才能获得分数。此练习基准独立于剑桥评分标准。
在推理框中说明选择循环的原因、拒绝时必须保持的状态以及每个参数的用途。提交后与范例答案进行比对。教师应审查解释并评定部分考试分数:输出检查无法做到这一点。
Available begins at 24. Process requests [12, 0, 12, 25]: accept positive requests no larger than Available and subtract accepted amounts. Give Available after EACH request.
Valid quantities for an unchanged stock of 6 are 1 to 6 inclusive. Give FOUR boundary values in ascending order, including the immediately invalid values.
For parcel dispatch, read non-negative Available, then NumberOfRequests (1 to 8), then NumberOfRequests integer requests. Accept a request only if positive and no greater than current Available. Output ok/no for every request, then final Available. Refused requests must not change it.
提交后显示反馈。
Write only FUNCTION CountLong(FileName : STRING, Limit : INTEGER) RETURNS INTEGER. Read the supplied text file, return how many lines have length at least Limit, and close it. The file may be empty.
提交后显示反馈。
Explain your choice of data structure and loop. Identify one boundary case and predict its result. For a subroutine, explain what is returned or changed in the caller.
本次答案保存在本浏览器。请自行或与老师复核;文字解释不自动评分。
按要点复核解释
- My types and data structure match the data and the question.
- I justified the loop and checked its first and last iterations.
- Initial values and rejected operations preserve the intended state.
- My test includes input, purpose and expected result.
- I distinguished returning a value from printing and changing caller state.
建议用时:35 分钟。完成全部题目后提交。提交前不能运行、检查或查看提示;提交后答案锁定供复习。