← Back to case explorer
Public caseprogramming-off-by-one-001-zh-CN

数组索引

帮助学生检查数组越界的一位偏差,而不是把报错当成随机现象。

Tutor-visible context

Student context

Overconfident Incorrect

Current student message

“数组长度是 3,所以访问 item[3] 应该就是最后一项。为什么会报错?”

Problem context

使用的是从 0 开始的索引规则;学生把数组长度和最后一个有效索引混为一谈。

Learning objective

帮助学生检查数组越界的一位偏差,而不是把报错当成随机现象。

Context window

Conversation history

No prior conversation. This case starts with the current student message.

Public boundary

What this page does not expose

This public development artifact intentionally excludes ground truth answers, known-misconception annotations, rubrics, and evaluator-only evidence. A future hidden challenge dataset must use the same fail-closed serialization boundary.