Calculated Objects question type

Jump to: navigation, search

This a contributed Moodle question type which extends the Calculated question type.

Versions available

This plugin is available for Moodle 1.9 to 2.3

Wild cards

Teachers can create questions like,

  How much is {apples} + {oranges}?

- where the {wildcards} become M and N × images of apples and oranges respectively. It is aimed at pre/primary-school students (approximately age 3-10).


Currently supported wildcards: apple, orange, pear, pineapple, walnut, cookie (each with or without an 's', eg. {cookies} and with an optional differentiator). For example,

  {apples_1} - {apples_2}

Tested with Moodle 1.9.7.

(Author N.D.Freear, 14 August 2010.)


  1. Download from the Moodle plugins database and unzip the archive. Copy the directory 'calculatedobjects' into the directory {MOODLE}/question/type/ on your server.
  2. Visit the administrator 'notifications' page, - there are no database changes for this question type.


  • Note, this question type uses the database tables of the 'calculated' question type.
  • You must make some standard calculated type questions in order to have some data sets with the proper ranges of numbers using the variables you will need BEFORE you can use the calculated objects question type.
    • Eg, make some {apples} data sets with a reasonable range (1 to 10).

Example use

Calculated objects question text.png

  • Write the answer formula

Calculated objects answer formula.png

  • Populate the sets for the objects with reasonable values (1 to 10 in this case)

Calculated objects apples set.png

Calculated objects oranges set.png

  • Save the question and test it

Calculated objects question at work.png

Change log


Thank you to:

ISSUES (August 2017)

  • missing 'pluginnamesummary' string . See GitHub solution
    • Pluginnamesummary error.png
    • Will use $string['pluginnamesummary'] = 'A version of calculated questions which extends the built-in 'calculated' question type. Teachers can create questions like, How much is {apples} + {oranges}.';
    • This fixes this error

Pluginnamesummary error corrected.png

394 errors and 80 warnings.png

    • Moodle coding style must be used.
    • After checking the files with the Code checker, it was easy to fix many (but not all) of the errors:

new2 with 12 errors and 30 warnings.png

    • But now it will need a real PHP programmer to fix the remaining errors and submit it to the Moodle plugins database :)

New Moodle 3.3 version for beta testing

    • New files for Moodle 3.3.x hosted in GitHub

See also