## Quiz

I am trying to write chemistry quiz questions, where the student must balance an equation by filling in integer numbers (coefficients) in front of products and reactants in an equation.

For example:

1 CH4 + 2 O2 --> 1 CO2 + 2 H2O

the cloze type works, but I want to give an all or nothing grade.  The student either balanced it correctly or they didn't.  I cannot find any way to grade them together as an all or nothing fill-in-the-blank,  I've searched the forums and have only found a few ideas for other question types i'll be needing soon, but nothing useful for this. I am using Moodle 2.6.

Does anyone have any ideas?

Average of ratings: -

I can't think of a good way to do this using any of the standard question types. Sorry.

STACK question type could do it, but that is major overkill. https://moodle.org/plugins/view/qtype_formulas might also be able to do it, but I am not sure.

Average of ratings: -

Yes I think that the formulas question type could do the job if you only use one subpart with multiple coordinates.

I will try to post an example using the equation you provided.

Average of ratings: -

I have written a couple question behaviour plugins to do this adaptiveallnothing and deferredallnothing.  They will work with cloze as long as all questions in the quiz are supposed to be all or nothing with one of these behaviours.

Average of ratings: Useful (2)

Thanks for making that Daniel, and sharing it. It is really neat. I nice example of what you can do with with a new behaviour plugin, and a very small amount of code.

If I might offer some unsolicited code-review, I think there is a slightly better way to do it. Instead of copying the whole method from qbehaviour_deferredfeedback to modify it, you could also do

class qbehaviour_deferredallnothing extends qbehaviour_deferredfeedback {
public function process_finish(question_attempt_pending_step $pendingstep) {$keep = parent::process_finish($pendingstep); if ($keep == question_attempt::KEEP &&
$pendingstep->get_fraction($fraction) != 1) {
$pendingstep->set_fraction(0); } return$keep;
}
}

The reason for preferring this method, is that it is more likely to go on working correctly even if the deferred feedback method is changed a bit (e.g. to fix a bug).

I am also failing to work out what the disregarded_info method in the renderer is for. Please can you put my out of my misery by explaining.

Average of ratings: Useful (1)

Oops! I may have missed something important. The if statement may also need to check

&& $pendingstep->get_fraction($fraction) !== null

Average of ratings: Useful (1)

Thanks Tim

The formula question type was an excellent suggestion.  I was initially very enthusiastic about it.  It works exactly the way I would like with one exception.  The input boxes are so large, that a simple 2 inch formula wraps onto 2 or 3 lines.  I couldn't find any way to make the inputs smaller, even by altering the css styles for the different formula types.  I did find a workaround, which was to add 'size' => 3, in render.php.

This is of course a horrible idea, and breaks the type for everything else it was intended for.  I thought about adding a new type.  Formula has "number", "numeric"... etc.  Maybe if I added "integer", I could add a switch to reduce the size of the input box.  It's too bad there isn't some way to make the question input more wysisyg.

I'm looking forward to working with Daniel's question behaviors.  They may be good for some other things I'm looking for.  Chemistry equations are a bit like some of these math enhancements there and in the formula question type.

Anyone up for a challenge?

Average of ratings: -