Identify what the question tests
A programming question may test syntax, algorithm design, data structures, complexity, dry-run reasoning or debugging. The rubric should say which of these matters and how marks are distributed.
Do not compare every response with one exact code listing; many correct solutions use different variable names or control structures.
Review code OCR carefully
Operators, brackets, semicolons, indentation and character case can be misread. Display extracted code in a monospaced view next to the original answer and highlight uncertain tokens.
Pseudocode and explanatory text should be separated from executable code before analysis.
Score by criteria
Possible criteria include understanding, algorithm choice, correctness, edge cases, complexity, syntax and explanation. The teacher should define maximum marks and acceptable alternatives.
AI can suggest evidence for each criterion, but faculty should decide whether a syntax mistake is minor or changes the entire solution.
Handle incomplete answers
A partially written program may still demonstrate a correct approach. Rubric-level suggestions are more useful than a binary correct/incorrect output.
When missing code prevents certainty, the system should state the limitation rather than invent the student’s intended logic.
Avoid unsafe automatic execution
Handwritten code was produced for an examination, not necessarily for execution. If execution is required, use a hardened sandbox with strict resource and network limits.
For many paper-based assessments, static review against the rubric is sufficient and easier to govern.
Validate with faculty examples
Create a small set of high, medium and low-scoring answers with teacher-approved marks. Include alternate correct methods and common mistakes.
Compare criterion-level suggestions and record where OCR or reasoning fails before expanding use.
Example criterion structure
For a ten-mark programming question, a teacher might allocate marks to problem understanding, algorithm choice, core logic, edge cases, complexity and explanation. The exact distribution must come from the paper setter. This structure lets an incomplete program receive justified partial credit without pretending it would compile.
Each suggested criterion score should quote or point to evidence in the extracted answer. If the evidence depends on an uncertain operator or indentation level, the system should request faculty review.
Build a coding-answer validation set
Include correct alternate solutions, pseudocode, code with minor syntax mistakes, wrong algorithms that look similar, dry runs, complexity explanations and nearly blank answers. Ask more than one faculty member to resolve disputed examples. Re-test when adding a new language or changing the code-extraction process.