CodeLab Question Type: Programming Questions Graded with Tests
Students write a program in the code editor of VS Code. It is run on the teacher's tests on Jobe or the CodeLab runner, and graded by the weighted share of passed tests.
Live demo: try CodeLab on codelab.tsp.edu.rs as a guest (Python runs in the browser), or sign in with teacher or student (password Demo-2026) for every language, the debugger and SQL. Reset nightly.
What's New in v1.18.0
- Built-in CodeRunner Moodle XML importer: teachers can upload a CodeRunner XML export directly from the course menu (More → Import CodeRunner XML) and convert standard C, C++, Python, Java, C#, JavaScript, PHP, Pascal, SQL and other questions into native CodeLab questions.
- Static code constraints and penalties: teachers can optionally forbid or require specific keywords or functions outside comments and strings (for example forbidding
sort or eval, or requiring malloc) with a configurable grade penalty (0–100%).
Core features
- 26 server-graded languages: C, C++, Python, Java, C#, JavaScript, TypeScript, Pascal, PHP, SQL (MariaDB), Bash, Go, Rust, R, Ruby, Lua, Kotlin, Perl, Octave, Julia, Scheme, Dart, Scala, Elixir, Swift and Haskell.
- Flexible tests: input, expected output, input files, function test code or unit-test assertions, weights and hidden tests; empty expected outputs are filled from the model solution on save, which must pass the tests.
- Output comparison: exact, ignoring trailing spaces, numbers with a tolerance, a regular expression, or lines in any order for SQL.
- Check with penalties: in Interactive with multiple tries and Adaptive mode each wrong Check costs the penalty; a time limit per test shows slow solutions.
- In the attempt: Run with live input and Step with the debugger for C and C++ on the CodeLab runner, Python in the browser, and Run tests on the visible tests.
- Hidden code before and after the answer: wrap student functions or statements cleanly without showing boilerplate.
- Safe cached grading: grades are computed on the server only, results are cached across reviews and regrades, and side-by-side output diffs highlight the first differing line.
- Parsons problems: shuffled solution lines with distractors, optional fill-in gaps and Check order with partial credit.
- Class work and Analysis: live student answer cards, test pass rates, common wrong outputs, frequent compiler errors, grade distribution and local similarity pairs.
- Options and backup: time and memory limits, optional typing help and AI error hints per question, a page that checks the solutions of all questions of a course, and full backup and restore.
The CodeLab plugins
Requirements
- Moodle: 4.5 LTS to 5.3.
- CodeLab for TinyMCE: version 1.25.0 or newer, installed first, with Jobe or the CodeLab runner configured.
- Hosted runner (optional): paid monthly quota plan by Boban Blagojević (boban.blagojevic@tsp.edu.rs). Not required.
Privacy
Answers are stored like any quiz answer. Programs and input are sent to the configured Jobe or CodeLab runner server to compile and run. Submission similarity runs locally inside Moodle. Implements the Moodle Privacy API.
Developed by Boban Blagojević. 29 languages: en, sr_lt, sr_cr, de, fr, es, it, pt, pt_br, pl, hr, bs, sl, mk, sk, cs, tr, nl, ru, uk, ro, hu, bg, el, sq, ja, zh_cn, ko, ar.
Source and issues: github.com/blagojevicboban/moodle-qtype_codelab
Licensed under the GNU GPL v3 or later.