CodeRunner Documentation (V3.3.0)

7.1 The Twig QUESTION variable

The template variable QUESTION is an object containing all the fields of the PHP question object. Some of the other QUESTION fields/attributes that might be of interest to authors include the following.

  • QUESTION.questionid The unique internal ID of this question.
  • QUESTION.questiontext The question text itself
  • QUESTION.answer The supplied sample answer (null if not explicitly set).
  • QUESTION.language The language being used to run the question in the sandbox, e.g. "Python3".
  • QUESTION.useace '1'/'0' if the ace editor is/is not in use.
  • QUESTION.sandbox The sandbox being used, e.g. "jobesandbox".
  • QUESTION.grader The PHP grader class being used, e.g. "EqualityGrader".
  • QUESTION.cputimelimitsecs The allowed CPU time (null unless explicitly set).
  • QUESTION.memlimitmb The allowed memory in MB (null unless explicitly set).
  • QUESTION.sandboxparams The JSON string used to specify the sandbox parameters in the question authoring form (null unless explicitly set).
  • QUESTION.templateparams The JSON string used to specify the template parameters in the question authoring form. (Normally the question author will not use this but will instead access the specific parameters as in the previous section).
  • QUESTION.resultcolumns The JSON string used in the question authoring form to select which columns to display, and how to display them (null unless explicitly set).

Most of these are effectively read only - assigning a new value within the template to the cputimelimitsecs attribute does not alter the actual run time; the assignment statement is being executed in the sandbox after all resource limits have been set. The question author can however directly alter all the above question attributes directly in the question authoring form.