Question types ::: qtype_coderunner
Maintained by Richard Lobb, Tim at Lone Pine Koala SanctuaryTim Hunt
A question type that allows question authors to set programming questions in which the student answer is code in some programming language, which is graded by running it. More generally it can handle any question to which the answer is text that can be graded by a computer program written by the question author.

CodeRunner 4.0.1

Moodle 3.8, 3.9, 3.10
Released: Wednesday, March 17, 2021, 6:34 AM


Version: 4.0.1 March 2021

Authors: Richard Lobb, University of Canterbury, New Zealand. Tim Hunt, The Open University, UK

For the full documentation of this plugin, see here.

NOTE: A few sample quizzes containing example CodeRunner questions are available at There's also a forum there, where you can post CodeRunner questions, such as requests for help if things go wrong, or are looking for ideas on how to write some unusual question type.

Changes since V3.7.9+ (October 2020):

  • Add a template parameter preprocessing capability that allows uses of languages other than Twig for generating the JSON template parameter set. [Experimental feature. Has potential to overload Jobe server at the start of tests and exams if misused.]
  • Separate UI-plugin parameters from template parameters and provide an improved UI that lists all available UI parameters and their meanings for the currently selected UI.
  • Update Twig to the latest version (3.1).
  • Add QUESTION.stepinfo to the Twig environment. This is a record with attributes preferredbehaviour, numchecks, numprechecks and fraction allowing authors to provide more elaborate feedback according to quiz mode and previous submissions.
  • Add a macro ___textareaId___ to the HTML-UI that gets replaced by the id of the textarea element that the HTML-UI is operating on.
  • Add special __twigprefix__ template parameter that, if defined in a question’s prototype, provides content (e.g. Twig macros) that is inserted at the start of all Twig-expanded question fields.
  • Reduce unnecessary calls to the Jobe server to get its list of supported languages when there is only one sandbox available (the usual case nowadays).
  • Bug fix: UI plugins other than Ace and GraphUI were not syncing changed answers back to the server when a quiz timed out and the student hadn't Checked or Prechecked their answer.
  • Bug fix: nodejs programs in ESM style were breaking. So changed filename extension to .js
  • Bug fix: Ace plugin was generating duplicate (and wrong) ids when multiple ace editors were present in a form.
  • Bug fix: Ace editor was not being initialised to the correct language with multilanguage questions for which a default language was specified.
  • Bug fix: some non-inherited fields were being mistakenly loaded from the prototype when changing question type via Ajax.
  • Bug fix: %h formats for columns were being ignored in the “For example” table.

Version information

Version build number
Version release name
Stable version
MD5 Sum
Supported software
Moodle 3.8, Moodle 3.9, Moodle 3.10

Version control information

Version control system (VCS)
VCS repository URL
VCS tag

Default installation instructions for plugins of the type Question types

  1. Make sure you have all the required versions.
  2. Download and unpack the module.
  3. Place the folder (eg "myquestiontype") in the "question/type" subdirectory.
  4. Visit to finish the installation