UCL Logo

UCL Moodle Guides


Moodle Resource Centre - home

General links

Moodle Home
E-Learning services for staff
Quickscan Dyslexia Screening Tool

Moodle Resources

Page tree
Skip to end of metadata
Go to start of metadata

Keywords: quiz, question, mathematics, science, exam, multiple choice, e-exam, e-assessment, summative, formative, instant feedback


What is it?

STACK is a world-leading open-source (GPL) system for mathematical and scientific assessment. A STACK question is one of the question types that can be included in a Moodle quiz to formatively or summatively assess your students. 

Why use it?

  • Separate validation and assessment allowing for complex formative feedback and line by line evaluation of student responses.
  • Multi-part questions.
  • Dynamic plots for question text and student feedback.
  • Randomly generated questions.
  • Support for scientific units and significant figures.
  • Students type in mathematical expressions using a syntax called Maxima.

To see a variety of example STACK questions, request access to the STACK demonstration course by emailing digi-ed@ucl.ac.uk.

Who can use it?

  • Tutors can create mathematical and scientific questions, and create response trees to provide detailed feedback to help students learn.
  • Students can enter mathematical and scientific responses, see a preview of their answer before they submit, and receive feedback and grades for their working out.

Before I start...

Think about:

  • Is the question text clear to students?
  • Will students know how to input an answer? How familiar will my students be with Maxima?
    • Could a "syntax hint" or "validation" help the student?
  • Do I want to apply a penalty for wrong answers?
  • What are the likely responses to my question and how would I evaluate each in turn?
  • Do I want to randomise my questions?

Meeting the baseline

The UCL E-Learning Baseline suggests the following for Orientation:

  • 2.2 Explain participation requirements:
    • Identify which activities are compulsory and optional.
    • Provide an indicator of effort (such as timings or page counts) for all compulsory tasks.
    • Explain how students are expected to use UCL and external e-learning tools. This PowerPoint Induction template provides a starting point. Wholly online courses might provide this information as a screen-cast video, with a voice over.
    • Link to instructions for any e-learning tools that students are expected to use.
  • 2.8 Outline the Intended Learning Outcomes for every activity and resource in the description and provide a clear overview of what the student is expected to do.

The Assessment category suggests that you should:

  • 4.1 Provide an assessment outline with a clear description of the module assessment, including schedule, criteria and submission details. To avoid duplication this might include a link to a module webpage.

How do I set one up?

The STACK question type is quite complex, but the three main steps are:

  1. Add question
  2. Configure Potential Response tree
  3. Test questions

The team behind STACK have created a series of videos that explain the basics of authoring STACK questions, the first video is provided below:

You can find further videos and guidance in the STACK Authoring quick guide and Digital education recommends completing this guide before running your first STACK question on UCL Moodle. 

Step 1: Add a STACK question (minimal requirements)

Within a question bank or quiz:

  1. Click Add.. and New Question
  2. Select STACK
  3. Give the Question a meaningful and unambiguous Question name.
  4. Define any Question variables using the notation: 'variable: value' e.g. exp: 3*(x-1)^(-4)'. It is essential to include a colon to assign the value to the variable. Avoid single-character names as they are meant for student input. 
  5. In the Question text, provide the question as clearly as possible. You can call Question variables with the notation: {@variable@} e.g. {@exp@}.
  6. Position the [[input: ans1]] tag appropriately. This is where the student puts their answer.
  7. Position the [[validation: ans1]] tag appropriately. This is where any feedback related to the validity of ans1 will appear.
  8. Under Input: ans1, enter a Model Answer.
  9. Under Potential response tree: prt1, set
    1. Answer test to AlgEquiv
    2. Student Answer(SAns) to ans1
    3. Teacher Answer(TAns) to the Model answer (you may have this stored as a variable or you can enter the expression directly.
    4. Set Score or Penalty.
  10. Click Save changes and continue editing

Step 2: Configure Potential Response tree

Consider the likely mistakes a student would make.

For every answer test, create a node:

  1. Click Add another node.
  2. Set Answer test.
  3. Set SAns, TAns and Test option.
  4. Set Score or Penalty.
  5. Set Next value to achieve the desired traversal of tests. Note. You can click Save changes and continue editing to refresh the preview of the response tree, as pictured below:

STACK response tree diagram showing the order in which nodes are connected

Step 3: Test questions

You can test questions by deploying random variants, and adding test cases.

Deploy Random variants:

  1. Return to the top of the Quiz settings page, and click Question tests & deployed variants
  2. Where random variables have been used, you can check randomisation results in appropriate questions. Next to Attempt to automatically deploy the following number of variants, enter the number of variants you would like and click Go. You can preview results and either exclude variants, or return to the quiz question settings to revise the randomisation you have used in the question.

Add test cases:

  1. Click Add a test case
  2. Provide a test input, and the expected outcome.
  3. Click Save changes
  4. Clik Run all tests on all deployed variants to run the test on all the deployed variants of your question.

Further help

Further guidance on STACK questions is available on the STACK Documentation page.

If you find any inaccurate or missing information you can even update this yourself (it's a communal wiki).

If you have a specific question about the tool please contact the Digital Education team.


  • STACK allows students to use standard mathematical functions including sin, cos, and int for integration. For integration questions, you need to add 'int' as a forbidden word or else students can enter 'int' and Moodle will perform the integration for the student.
  • Students will need to be instructed on how to enter Mathematical equations correctly. Digital Education recommends having a formative or practice quiz to familiarise students with the process of completing and submitting a STACK question. Guidance on Maxima can be found on the STACK documentation page, and in the Maxima manual.
  • When using randomization, ensure you run question tests to ensure the difficulty of the question is consistent. See the STACK documentation page on Randomisation for more details.

Examples and case studies

Coming soon

Questions & Answers

How do I add plots and graphics to my question?

Please read the STACK guidance on plots and graphics.

Further information

This guide was adapted from the STACK Documentation website, which provides a detailed walk-through with examples and videos for the STACK question type. Accessed on the 14th February 2020.



  • No labels