Question algorithm parameters
WIRIS quizzes admits the possibility to add parameters to question algorithms. This may be useful if we want to do several questions about the same mathematical expression, if we want to chain some questions (in the sense that some output from a question is used in the algorithm of the following one) or other uses. It is also useful to translate strings in the algorithm and therefore have a multilanguage question.
This feature is available through the WIRIS quizzes generic integration library. Therefore the author will be able to use this feature only if the platform integration provides a way to do it. And the way it must be used will heavily depend on the integration.
Parameters must be defined in algorithms using the keyword parameter.
Then, once instantiated the question, the platform integration may use the API function QuestionInstance.setParameter to overwrite the values of the parameters. The integration needs to manage where to store and find the actual parameter values for each question instance.
Following the same example, we could have the code in the platform integration:
... QuizzesBuilder builder = QuizzesBuilder.getInstance(); Question question = ... QuestionInstance instance = builder.neWIRIS QUIZZESuestionInstance(question); instance.setParameter("p1", "<ms>Polinomio lineal</ms>"); instance.setParameter("p2", "<ms>Polinomio no lineal</ms>"); instance.setParameter("p3", "<mrow><mi>x</mi><mo>+</mo><mn>1</mn></mrow>"); ...
When the algorithm evaluates, the values of the parameters defined in the algorithm will be overriden by the values specified by the integration. If some parameters are not specified, the values deined in the algorithm will be used.