6.20 Question Chaining Variables - Maple T.A. 2016 Help
Maple T.A. Online Help

Search Maple T.A. 2016 Help:

6.20 Question Chaining Variables

Question chaining is an authoring technique in which you create reference objects in one question that are called into display in the next question. By using question chaining, you can capture a student's response to the first question in an assignment, and then include that response as part of other questions in the same assignment.

To use question chaining, you must:

  1. Author questions that use the special variables $response and/or $grade described below.
  1. Create assignments that use these questions in sequence.

Note: The questions that use chaining must have an algorithm. If this is not needed, you can define a dummy variable. This is demonstrated in the example. See the line qu.1.2.algorithm=$x=0;@

To use question chaining variables:

  • Use the id field. If one question has the id field set, then you can use the id tag to refer to the response the student provided to that question during an assignment.
  • To refer to the student response to one question in another question, use the variable $response.foobar., where foobar is the id field from the first question.


In this example, the first question has id=123456. The second question refers to this question (using $response.123456) in both the question field and answer field.

qu.1.topic=Question Chaining@

qu.1.1.name=Chaining Question 1@
qu.1.1.question=Pick a number between 1 and 7: <1> @
qu.1.1.blank.1=1, 2, 3, 4, 5, 6, 7@

qu.1.2.name=Chaining Question 2@
qu.1.2.question=What is the sum of $response.123456 and 17?@
qu.1.2.answer.num=${($response.123456 + 17)}@

Details on Question Chaining

The referring questions does not need to be in the same question bank, but they must use the correct ID code. The contents of $response.foobar is a string.

Note: $response.foobar can be used only in in-line dynamic text; it cannot be used in the algorithm section of a question because the algorithm is initialized before the assignment is started.

Questions frequently have multipart responses. For example, suppose foobar is a Blanks question with 5 blanks. You can access the blanks individually using $response.foobar.1, .., $response.foobar.5. In the case of a multipart question with parts (a),..(c), each of which holds a Blanks question with 5 blanks, you can access the responses using $response.foobar.1.1, ..., $response.foobar.3.5. You can have as many levels of depth as are needed.

In addition to accessing the raw text of the student response, you can also access the grade that is assigned to the current response, using $grade.foobar (or, as appropriate, $grade.foobar.3.5). This is a decimal number between 0.0 and 1.0. In the case that the question has not yet been answered, the grade is -1.0. (You should be careful revealing grade information, because that may undermine the intent of the instructor in setting the assignment.)

Note: $response and $grade can be used only in in-line expressions. You can use these variables inside only question statements and answer definitions and not inside algorithm statements because the algorithm field of the question is evaluated only once, when the question is first loaded at the time of initial assignment creation. To use the response object inside other variable calculations would require that the algorithm field be refreshed each time the question is presented, which would incorrectly update the other variable values in the algorithm field.

Question: How do I use the $grade variable to return a statement that tells the student on the following question "Your response was correct/incorrect" depending on the grade in the first question?

Answer: Try

${if(eq($grade.foo2, 1), "correct", "incorrect")}