Programming exams with automatic grading
Assessing programming on paper measures little; on a computer, without care, it measures ChatGPT. A good programming exam gives students a real editor, runs their code in an isolated environment and grades it with tests, some of them hidden.
By Christophe Soares, university lecturer and creator of Clausa ·
What a programming exam needs
- An in-browser editor with syntax highlighting, with nothing to install apart from the exam’s locked-down environment.
- Code execution in an isolated sandbox, with time and memory limits, so that no program can affect the server or other students.
- Visible tests, so students understand what is being asked, and hidden tests, so a program cannot simply hard-code the examples.
- Clear verdicts: accepted, wrong answer, time limit exceeded, compilation or runtime error.
- A locked-down environment, because an editor next to ChatGPT no longer assesses the student.
How to design the tests
- Start with the simple cases from the problem statement, visible to students.
- Add hidden edge cases: empty input, large values, duplicates, reverse order.
- Use time limits to tell an efficient solution from brute force, when that is part of what you assess.
- Award partial marks per test, so an almost-correct solution is not worth zero.
- Review borderline cases by hand: automatic grading is a starting point, not the final word.
With Clausa
Clausa grew out of real programming exams. Students write code in an in-browser editor (the same engine as Visual Studio Code), run the visible tests and submit; the code runs in an isolated sandbox and is graded against visible and hidden tests.
It supports C, Java, Python, PHP, JavaScript (Node.js), Go and SQL, multi-file problems and mixed exams, with multiple-choice or open questions in the same exam. With Safe Exam Browser, students never leave the exam editor; and teachers can adjust the grade of each answer after reading the code.
Frequently asked questions
- Which programming languages are supported?
- In Clausa: C, Java, Python, PHP, JavaScript (Node.js), Go and SQL (SQLite), each with its own compiler or interpreter in an isolated sandbox.
- Can students see the hidden tests?
- No. They see the results of the visible tests while they work; the hidden ones only count towards the grade.
- Can it be used for programming contests?
- Yes. The same automatic grading works for contests, with a public scoreboard and tests organised by efficiency level.
More guides
- How to stop students using ChatGPT in computer-based examsWhat works to stop ChatGPT and other AI in computer-based exams: a locked-down environment, live monitoring and a different exam for each student.Read the guide →
- Safe Exam Browser: how to run secure exams on computersA Safe Exam Browser (SEB) guide for teachers: what it is, installing it, the .seb file, the Config Key and making sure the exam only runs locked down.Read the guide →
- Digital tests in secondary schools: how to run them securelyHow to run computer-based tests in secondary schools, in computer rooms or on students’ laptops: preparation, questions, security and automatic marking.Read the guide →
- Remote exams with live camera proctoringHow to run remote online exams with integrity: a locked-down environment, live camera proctoring, absence logs and data protection considerations.Read the guide →
- Import Moodle questions in GIFT formatHow to export questions from Moodle in GIFT format and import them into another exam platform: supported question types, examples and things to watch out for.Read the guide →