Question types ::: qtype_stack
Maintained by Christopher Sangwin, TimTim Hunt
Part of set STACK.
The STACK question type adds a sophisticated assessment in mathematics and related disciplines, with emphasis on formative assessment underpinned by computer algebra.
Latest release:
2097 sites
92 fans
Current versions available: 2

The STACK system is a computer aided assessment package for mathematics, which provides a question type for the Moodle quiz. In computer aided assessment (CAA), there are two classes of question types.

  • Selected response questions
    In these questions, a student makes a selection from, or interacts with, potential answers which the teacher has selected. Examples include multiple choice, multiple response and so on.
  • Student-provided answer question
    In these questions the student's answer contains the content. It is not a selection. Examples of these are numeric questions.

STACK concentrates on student-provided answers which are mathematical expressions. For example, a student might respond to a question with a polynomial or matrix. Essentially STACK asks for mathematical expressions and evaluates these using computer algebra. The prototype test is the following pseudo-code.

  simplify(student_answer-teacher_answer) = 0
  mark = 1,
  mark = 0.

STACK uses a computer algebra system (CAS) to implement these mathematical functions. A CAS provides a library of functions with which to manipulate students' answers and generate outcomes such as providing feedback. Establishing algebraic equivalence with a correct answer is only one kind of manipulation which is possible.

Using CAS can also help generate random yet structured problems, and corresponding worked solutions.

In STACK a lot of attention has been paid to allowing teachers to author and manage their own questions. The following are the key features.

  • Question versions are randomly generated within structured templates.
  • There are many different kinds of inputs. These are, for example, where the student enters a mathematical expression, or makes a true/false selection.
  • Mathematical properties of students' answers are established using answer tests within the CAS Maxima.
  • Feedback is assigned on the basis of these properties using a potential response tree. This feedback includes:
    1. Textual comments for the student.
    2. A numerical mark.
    3. Answer notes from which statistics for the teacher are compiled.

These broadly correspond to formative, summative and evaluative functions of assessment. Which of these outcomes is available to the student, and when, is under the control of the teacher.

  • Multi-part mathematical questions are possible: each question may have any number of inputs and any number of potential response trees. There need not be a one-to-one correspondence between these.
  • Partial credit is possible when an expression only satisfies some of the required properties.
  • Plots can be dynamically generated and included within any part of the question, including feedback in the form of a plot of the student's expression.


Screenshot #0


Christopher Sangwin (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Carlos Ruiz
    Sun, Jul 31, 2022, 6:42 AM
    Good afternoon.

    Thank you for this great plugin, It basically change the way I teach and evaluate my students.
    I have a strange issue since the last update: the score of any question is assign incorrectly. For example, in a cuestionary with 3 questions with 6, 6 and 8 points respectively (20 points), random scores are assigned to each question so the total score could be more or less than 20. The same thing happens if Iry to recalculate the grade of past cuestionaries.

    Any advice would be welcome.

    Best regards
  • Carlos Ruiz
    Wed, Aug 3, 2022, 11:34 AM
    Good evening.

    I think I know what is happening. In questions with multiple answers, no matter what score I assign to each answer, STACK always assign 1 point to each one. For example, if my question of 8 points has 4 parts with 20%, 20%, 30% and 30% score for each part, I set 2, 2, 3, 3 points in order to calculate these percentages; STACK assign 1 point to each part; therefore if a student answer the question correctly, the score he gets is (1+1+1+1)/(2+2+3+3) * 8 =3.2.

    If any of you gets the same behaviour please let me know.

    Best regards
  • Christian Milani
    Mon, Aug 22, 2022, 4:15 PM
    we have the same problem as Carlos. Moodle 3.11.8+ and STACK 2022071300.
    I will open a new issue on github.
  • Al Spay
    Fri, Aug 26, 2022, 2:42 PM
    Good afternoon!
    Installed STACK plugins in MOODLE 3.11. Maxima is installed on a separate server. I can't connect STACK and Maxima. I did not find a step-by-step instruction on how to do this in the documentation (for beginners). What settings should be in maxim, what in the plugin... etc.
  • Carlos Ruiz
    Wed, Aug 31, 2022, 1:08 AM
    Good afternoon.

    Christian Milani, the last update solves the issue.

    Best regards
  • Carlos Ruiz
    Wed, Aug 31, 2022, 1:09 AM
    Good afternoon.

    I am reluctant to upgrade my Moodle to 4.0 version because of this excellent plugin. Anyone would be so kind to comment the use of Stack in Moodle 4.0.

    Best regards
  • Tim
    Mon, Sep 5, 2022, 7:41 PM
    Latest version of STACK works with Moodle 4.0 in our testing.
  • Vardaan Solia
    Mon, Apr 10, 2023, 8:16 PM
    Hello team, I was hoping if you could share more info about the found TIMEOUT issue that is encountered in the Question Variables text column.
  • Dominic Feldmann
    Mon, Jun 19, 2023, 7:31 PM
    Hello Team,
    like Vardaan Solia, I get the same error (TIMEDOUT) after I have entered a sample solution. I have oriented my procedure 1 to 1 on the tutorial of the University of Bochum, but even so it does not work.

    Is this a bug or does it have to do with a non-existent integration of maxima, I read about it in the comment from Al Spay?
  • Simon CHARBIT
    Fri, Jun 23, 2023, 5:43 PM
    Hello I am physics teacher and I would like to use stack in Moodle

    I try to follow the instruction of this page to install Stack :

    If I understand correctly I have to install gcc, gnuplot and Maxima on my server and I imagine I cannot do that from Moodle.

    My Moodle version is 3.11.15+ and my Moodle is hosted on a Plesk Server so I don’t think that I have the ability to install things.
    Do you know if there is a way to be able to use Stack on a Plesk server ? Contact the support of my server (what should I ask them to do ?)
    Otherwise what should I consider changing my hosting ? If yes what can you recommend me for people who want to run stack on a server and Moodle who are not an expert in linux and php...

    Thank you very much
  • Florian Rowedder
    Tue, Aug 15, 2023, 6:58 PM
    We just upgraded our Moodle to version 4.1 and the Stack plugin to version 4.4.5.
    We did not change the Maxima version.
    However, now when using Stack, we get an error message (trying to translate into english):
    "Die verwendete Version der STACK-Maxima-Bibliotheken (2022082900) stimmt nicht mit der von dieser Version des STACK-Fragetyps erwarteten (2023072101) überein."
    "The version used of the STACK-Maxima-Libraries (2022082900) does not correspond to the one expected by this version of the STACK question type (2023072101)."

    However, I am pretty sure that the correct Maxima version (44.0) is selected in the plugin settings.
    What do I miss?

    Thank you very much!
  • Christopher Sangwin
    Tue, Aug 15, 2023, 7:33 PM
    How to resolve this is documented here:
    Some how it looks like you have either not upgraded the plugin DB correctly, or have newer code.
  • Carlos Ruiz
    Tue, Aug 15, 2023, 8:25 PM
    Good morning Florian. It happened to me any time I do an upgrade. You just need to run the healthcheck script and recreate the Maxima image (Create Maxima image). Perhaps you also need to, temporarily, increase the CAS connection timeout to 50.
    Please let me know if it worked.

    Best regards
  • Josh Joubert
    Sat, Feb 3, 2024, 11:51 PM
    Hello to the devs and maintainers. I have an issue that I hope I'll be able to get assistance with.

    I just installed STACK for the first time without issues. I enabled all the necessary PHP features, and all the extra dependencies were successfully installed. During my experimentation, I've been unable to successfully create and save any STACK question, however.

    The error that keeps plaguing me is "CAS failed to return any data due to timeout.", and is displayed for the input model answer field. Note that I have no question variables. Changing the "CAS connection timeout" value (qtype_stack | castimeout) unfortunately doesn't resolve the problem; nor does changing the Maxima version.

    I'm using Moodle 4.3.2 (Build: 20231222) on a Linux server with PHP 8.2. Furthermore, I'm using STACK 4.5.0 for Moodle 3.9+
  • Christopher Sangwin
    Sun, Feb 4, 2024, 12:11 AM
    John, I've encountered this problem occasionally depending on which version of Maxima you have. The very fist time Maxima runs on the server it loads a lot of text-based lisp code and compiles this on the server. That's all perfectly normal. STACK uses the "timeout" and if this is too low this crucial first execution will not finish. If you can, first load Maxima on the command line and execute a non-trivial command (e.g. diff(x^2/(1+x^2), x); then quit(); ) Then up the timeout on the plugin page and try again. If this works you can return the timeout to a lower level in production. If this does not work, follow these docs:
1 2 3 4 5 6 7
Please login to post comments