Entering variables for quiz questions

Entering variables for quiz questions

by Paul Devlin -
Number of replies: 5

I'm fairly new to Moodle. I would like to create a quiz question where students enter a number (define a variable) and must then calculate an answer based on that number. This just requires simple maths (addition, multiplication etc).
It was suggested to me that insterting php code might allow this. However, before I begin learning about php I waned to check if this is correct.
Alternatively, is there a free or relatively cheap plug-in that I could try to persuade my university to buy in order to build this sort of question without specialist knowledge?

Average of ratings: -
In reply to Paul Devlin

Re: Entering variables for quiz questions

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
What you want does exist in the Moodle Quiz questions types already: use the Calculated Question type!
In reply to Joseph Rézeau

Re: Entering variables for quiz questions

by Paul Devlin -

Thanks for your reply.
As I understood it, a calculated question allows a random number to be generated for a variable (or I could predfine a variable myslef)  but I could not find a way for students to put in variables.
How would this be done?

In reply to Paul Devlin

Re: Entering variables for quiz questions

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Sorry, Paul, I had read your original post too fast and had not noticed that you wanted the students to put in variables. I wonder why you would want to do that. Can you give us a real-world example, please?
In reply to Joseph Rézeau

Re: Entering variables for quiz questions

by Paul Devlin -

Hi Joseph, My students complete a lab practical counting numbers of plants that inherit particular genetic traits. They then test whether the numbers they obtain fit to a predicted ratio. They must calculate a probability that any variation from this predicted ratio is due to chance using a chi squared test. Each student will have their own data that they will want to process.
Currently I run this as a Moodle exercise but the students can't use their own data. After using Moodle to check that the students obtained numbers within an acceptable range for their own observations, I then give the students new "randomly generated" numbers that they can do the calculations with.
This is something a lot of my colleagues would like to do with their own practicals so any suggestions would be greatly appreciated.
Calculating biochemical reaction rates based on colour changes of an indicator dye caused by the reaction would be another example where each student will have their own data.

In reply to Paul Devlin

Re: Entering variables for quiz questions

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Paul,
Thanks for clarifying. Actually that kind of activity would be "auto-testing with individual input of numerical values". It is certainly not possible to do it in Moodle questions at the moment and I doubt it could be feasible. I expect the "calculated question" specialist, Pierre Pichet, will be able to comment on this thread any time soon.
Joseph