Creating Quizzes with Grading[Quiz] - Maple Programming Help

The Quiz command in the Grading package offers an easy way to generate interactive tests in Maple.  This document describes the usage of the Quiz command and demonstrates the various kinds of quiz questions that can be created.

Note:  All examples assume the Grading package is loaded by executing the following command:

$\mathrm{with}\left(\mathrm{Grading}\right):$

Introduction

The simplest form of a quiz takes two arguments—the question and the answer.

 What is 1 + 1?

Because the above question is not algorithmic—given the input, there is no way to regenerate this and arrive at a different question—there is no way to practice variations of the same question.  The Algorithmic Questions section below demonstrates questions designed random variables that include a Try Another button.

The following example shows a different way of capturing the answer, rather than a generic input area, the response is to select a check box.

 Is 1 + 1 = 2?

Another style of question, multiplechoice requires an initial value to define the choices.  Note that the default is for those choices to appear in a scrambled order.   The grade value '3' refers to the third item in the list, denoting the index of the correct answer in the choice list.

What is 1 + 1?

Other question types can also be given an initial value, which can simplify the formatting of math expressions.  

 Calculate: =

Plots can be used as initial values.

Which of the following could be portions of the plot of sin(x)?

Algorithmic Questions

Algorithmic questions incorporate randomization so that a single source can generate an unlimited number of tests on the same topic.

To generate an algorithmic quiz, you need to supply an initialization procedure.

 Is the following number prime?

Note that when generating an algorithmic quiz, a Try Another button appears.  Clicking this button causes the question to be reinitialized, thus presenting a new variation of the question.

The initialization procedure will be passed all extra arguments given to the Quiz command.  Below we will add the parameter, r, to the initialization routine.  Calling Quiz with the extra argument, 100, will pass this along to the initializer, resulting in a different random number sequence.

 Is the following number prime?

This repeats the same command above, only changing the extra argument.

 Is the following number prime?

So far, the second parameter has been a fixed result.  For math-response questions, a procedure can be passed to grade the result.  The procedure accepts the following parameters:

 • The user response
 • The "answer" — as returned by the initialization procedure, which can be the correct answer, or could be data used to derive the correct answer

 Factor the expression completely: =

Using $Variables To Randomize the Question Text Random values can be inserted in the question text by naming variables with a$ prefix and placing them in the question text.

 Is  prime?

The Quiz:-Get command can be used to query the variable, and Quiz:-Set will set the value.   The variable named in calls to Set should be prefixed with a $to match the question text. The question text may reference$A or ${A}, but the Set and Get commands should always reference the form without curly brackets, as$A.  Also, since $is a special character in Maple, references to$ names in SetVar and GetVar must be enclosed in left single quotes (see "name").

Which is a plot of ?

The special variable, $RESPONSE, is automatically set to the value entered by the user. By using $RESPONSE in conjunction with other pre-defined variables, the grading procedure can be written to take no arguments, as is the situation for writing a grading procedure within Maple T.A.

 There are  balls of different colors in a sack. How many distinct combinations of  balls can you remove from the sack?

Preventing Simplification

For certain fundamental concepts it is necessary to "dumb down" Maple.  Sometimes Maple is too smart, and it will automatically do favors for you, such as collecting terms in a polynomial or adding constants.  The "InertForm" package gives you a way to represent expressions that won't be automatically simplified.  The Quiz command can make use of this inert-form notation for displaying expressions and grading responses.

Inert-form represents the core operators and functions in the following form:

 Standard Notation Inert Form A + B %+( A, B ) A - B %+( A, -B ) A * B %*( A, B ) A / B %/( A, B ) A ^ B %^( A, B ) f( A, B ) %f( A, B ) ( A + B ) * C %*( %+(A,B), C )

In the following question, we use this notation to prevent reduction of fractions.  We specify the 'inertform' option so that the Quiz command can apply appropriate formatting when displaying the question.

Which fractions are reduced to lowest terms?

This is also relevant to the response being graded in a free-form math question.

 Reduce this fraction to lowest terms:  =

Because the answer is being delivered to the grading procedure in inert form, there is no chance for automatic simplification to happen along the way.  You can't cheat by typing in the given expression and have it auto-simplify behind the scenes.

The grading code checks to see that the response was a divide form,%/, and that the operands of the response match the simplified operands of a reduced fraction equivalent.

Importing and Exporting Questions From Maple T.A

Maple T.A. is an easy-to-use web-based system for creating tests and assignments, and automatically assessing student responses and performance.  The "maple-graded" style of question can be imported into Maple and run via the Quiz command.

The MapleTA:-Import command will read a course module zip file and import all of its questions into a Record-based data structure that closely mirrors the XML in the course-module manifest.  A sample structure might look like the following (omitting optional fields):

TAQuestion := Record("name" = "  Quadratic Factor Question  ", "mode" = "Maple", "text" = "    Factor the following algebraic expression x<sup>2</sup> + ${A}x +${B}. Your answer should be in the form (x+a)(x+b).  ", "algorithm" = "  $a=rint(1,10);$b=rint(2,10);$A=int($a+$b);$B=int($a*$b);$factor=maple(\"factor(x^2+${A}*x+${B})\"); ", "mapleAnswer" = "$factor;  ",         "maple" =  "    evalb(($ANSWER)-($RESPONSE)=0);  "  ):

This imported structure is recognized by the Quiz command and it builds the appropriate question in Maple.

 Factor the following algebraic expression x2 + x + . Your answer should be in the form (x+a)(x+b).

A course module usually contains multiple questions.

$\mathrm{numelems}\left(\mathrm{cmquestions}\right);$

 ${18}$ (5.1)

 Convert  feet to meters. Answers require 4 significant digits.Do not include units in your response.

 Solve the expression x3 - x = 0. Enter only the expression for x, omitting "x =".



Similarly, all Quiz-based questions can be exported back to Maple T.A.   The Quiz command takes an 'output' = 'mapleta' option that will generate a Record structure as described above.  This Record can then be passed to the MapleTA:-Export command to generate a course module suitable for importing into Maple T.A.



As an example, let's define a question and see how it looks.

For which values of X does ( X mod ) = 1

Now, let's use the same question parameters, but specify the 'output' option.  We will also give the question a name so it can be easily identified inside Maple T.A.



 ${\mathrm{Record}}\left({\mathrm{mode}}{=}{"Multiple Selection"}{,}{\mathrm{name}}{=}{"Imported MS 15 \left(mod\right)"}{,}{\mathrm{algorithm}}{=}{"MAPLE_INIT = maple\left("randomize\left(\right): proc\left(\right) local r := \left(proc \left(\right) local p: p := nextprime\left(rand\left(2 .. 7\right)\left(\right)\right): Grading:-Quiz:-Set\left(\x24P = p\right): \left[p*rand\left(1 .. 2\right)\left(\right)+1, p*rand\left(3 .. 4\right)\left(\right)+1, p*rand\left(1 .. 2\right)\left(\right), p*rand\left(1 .. 2\right)\left(\right)+2, p*rand\left(1 .. 2\right)\left(\right)-1\right] end proc\right)\left(NULL\right): op\left(map\left(InertForm:-ToMathML,r\right)\right); end\left(\right); "\right); MCCHOICE1 = switch\left(0,MAPLE_INIT\right); MCCHOICE2 = switch\left(1,MAPLE_INIT\right); MCCHOICE3 = switch\left(2,MAPLE_INIT\right); MCCHOICE4 = switch\left(3,MAPLE_INIT\right); MCCHOICE5 = switch\left(4,MAPLE_INIT\right); P = switch\left(5,MAPLE_INIT\right);"}{,}{\mathrm{text}}{=}{"For which values of X does \left( X mod P\right) = 1"}{,}{\mathrm{type}}{=}{"formula"}{,}{\mathrm{answer}}{=}{"1, 2"}{,}{\mathrm{_attributes}}{=}{\mathrm{Record}}\left({\mathrm{...}}\right){,}{\mathrm{choices}}{=}{\mathrm{Record}}\left({\mathrm{...}}\right)\right)$ (5.2)

This can be exported as a course module: