Question types: CodeRunner

Maintained by Picture of Richard Lobb Richard Lobb, Tim at Lone Pine Koala Sanctuary Tim 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 3.4.0

Release notes


28 April 2018. 3.4.0

  • Add randomisation capabilities so that students can be presented with a randomly generated question variant when they start a question in a quiz. Randomisation is achieved by the use of Twig expansion of the template parameters field (assumed to include at least one call to the Twig random function) followed by Twig expansion of all other question fields using the expanded template parameters as a Twig environment. For details see here.
  • Add a Reset answer button to the student question answer page if the answer box contains preloaded content.
  • Add function set_random_seed to Twig for use with the question randomisation, e.g. to ensure that a student always sees the same variant of a question no matter how often they attempt it.
  • Add id field to the Twig STUDENT variable, e.g. for use with the above.
  • Use Ace editor for template-parameters field.
  • Add Twig All and Hoist template parameters checkboxes to the authoring interface for use with randomisation and to simplify template authoring in general.
  • Add fontsize parameter to the GraphUI plugin.
  • Fix a long-standing bug that caused questions to be flagged as incomplete after earlier having been marked correct even though the answer had not been altered. This turned out to occur if the student's answer began with a blank line.
  • Improve question author feedback in the event of Twig errors.
  • Miscellaneous code-cleaning and minor bug fixes.

18 February 2018. 3.3.0

  • Add multilanguage program question type to base set, plus various changes to UI-handling code to allow student to select a language in such questions.
  • Allow UTF-8 output from programs, if Jobe server is configured to allow this.
  • Implement UI plugin architecture to allow different JavaScript plugins to manage the question answer textarea and related textareas in the question authoring form.
  • Incorporate the GraphUI plugin from Emily Price into the new plugin architecture (thanks Emily).
  • Add directed and undirected graph prototypes to the built-in prototype set.
  • Fix bug with the auto-correcting of test cases that fail during validation. If the author changed the ordering of testcases via the "ordering" field, the wrong test case was getting updated. Resolved by preventing re-ordering during validation, deferring it until question is finally saved.
  • Fixed bug in IdeoneSandbox - language name strings were no longer appropriate. However, this sandbox should be regarded as deprecated and will be removed some time in the future.

3 December 2017. 3.2.2

  • Incorporate changes from abautu (Andrei Bautu) to allow question authors to update test case 'expected' fields directly from a table of test failures generated by running the sample answer during validation of the question author form. Thanks Andrei.

  • Added an experimental script /question/type/coderunner/downloadquizattempts.php to dump the database info on all student quiz activity to a spreadsheet. The data includes the submitted answers to both prechecks and checks, with timestamps. The export format is experimental and may change in the future. A Python module is included too and is the recommended way to deal with the quiz attempt download spreadsheet.

  • Bug fix: a submitted answer of '0' (an edge case that might be possible when student answer is not code) was being rejected as an empty response, due to the use of PHP's empty function. Thanks to David Bowes for the fixes here.

  • Added SQL prototype and 2 simple samples (experimental).

  • Bug fix: testsplitterre and allowmultiplestdin fields of author form were not being correctly initialised when a new combinator question type was downloaded with AJAX.

Moodle 3.0, 3.1, 3.2, 3.3, 3.4, 3.5

Version information

Version build number
Version release name
Stable version
MD5 Sum
Supported software
Moodle 3.0, Moodle 3.1, Moodle 3.2, Moodle 3.3, Moodle 3.4, Moodle 3.5

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