Calculated multiple choice quiz question

Prev Next

Calculated multiple choice questions operate much like the multiple choice question type, however the choices available are generated from a given formula, using wildcards and datasets.

For example, a question may be: 'Calculate the area of a square where it's width = {width} and the height = {height}.

The correct answer would be: 'The square's area is {={width}*{height}} cm2' 

An incorrect answer could be: ' The square's area is {={width}+{height}} cm2' 

The correct answer choice would display with the calculated answer, based on the values the system automatically generates.

Calculated quiz questions present a potential security risk in that they can be used to execute PHP code on the server, so you may want to limit who is able to add these quiz questions. The ability to add Calculated, Calculated simple and Calculated multiple choice quiz questions is controlled by the moodle/question:managecalculated capability. For upgraded sites this capability will be assigned to any users who already have the moodle/question:add capability. For new sites, this capability is not assigned to any roles by default. In either case, we recommend that Site Administrators review whether calculated quiz questions are required, and limit the capability to administrative roles where possible. No special role is required to use existing calculated questions in a quiz.

There are two courses in the Totara Academy about using quizzes in Totara Learn, Getting started with quizzes and Advanced quiz Using these courses you can learn more on how to use these features, see best practice, and give it a go yourself.


Join the Totara Community for more resources to help you get the most out of Totara. 


© Copyright 2025 Totara Learning Solutions. All rights reserved. Some content originally obtained via GPLv3 license and continues to be available under GPLv3. All other content is the sole copyright of Totara Learning Solutions.