-
MathType
-
Wiris Quizzes
-
Learning Lemur
-
CalcMe
-
MathPlayer
-
Store FAQ
-
VPAT for the electronic documentation
-
MathFlow
-
BF FAQ
Compound answers
Reading time: 1minWe can also create grading functions in the case of compound answer questions. All we need to do is use a separate argument for each answer blank. So, if there are three blanks to fill in, the grading function should look like gf(x,y,z). The first argument corresponds to the first blank, and the second argument corresponds to the second blank, etc. Let's see a simple example.
The question will be a standard exercise in introductory calculus:
For this, the following grading function could be used:
As opposed to ordinary compound answers, the advantage, in this case, is that we don't need to worry about the order in which the student answers. It also allows virtually infinite answers (here, any solution of the form 8k+1 with k an integer was valid). However, much more complex behaviour can be programmed, as is easily readily
Empty answer from the student
Imagine that we are working with a compound answer like in the previous example. The student might leave a box empty and just answer some questions, which could crash the validation algorithm, resulting in all grades being 0 even if some were correct.
If you want to grade the answers he had submitted, you need to modify the algorithm and test that all boxes are not empty with the command not_null?
. For instance, following the same example above, the algorithm should be as follows.
Tip
The not_null? is a precaution you need to use if you want to do something complex with your answer that might crash the program if the response were null. If you are making simple comparisons, you technically don't need it, but we strongly recommend systematically including it to avoid undesired situations.