advanced topics
Consecutive errors
The automatic correction of generic TeX problems can take into account consecutive errors. This feature is only
available for questions of type input.number
or input.function
.
Consider a problem with several questions, all of them of type input.number
or type input.function
.
Assume the solution of the nth question depends on the solution of the mth question for some question numbers $$m$$,$$n$$
with $$m < n$$. Say the student's solution of the mth question was wrong. Then the student used a wrong input for the
nth question. Assume that, apart from starting with a wrong input, the student solved the nth question correctly.
This is what we call a consecutive error.
Taking into account consecutive errors means the student doesn't get the points for the mth question, but the solution
of the nth question is counted as correct and the points are awarded.
Taking into account consecutive errors works as follows. The questions are corrected one after the other.
For each question, the following happens:
 First, the question is corrected normally, meaning the student's solution is compared to the correct solution.
 If the student's solution coincide with the correct solution, everything is ok and the correction proceeds to the
next question.
 Otherwise, the correction of this question is repeated with certain variables bound to student answers of previous
questions. This is called conditional correction. Which variable is bound to which answer is controlled by the author
using the \earlierAnswer
command described below.
 The score resulting from the conditional correction is compared to that of the normal correction. The correction
with the higher score counts.
The \earlierAnswer
command has the following form:
\earlierAnswer{VARIABLE}{QUESTION_NUMBER,ANSWER_NUMBER}
where VARIABLE
is the name of the variable defined on global (not question) level, QUESTION_NUMBER
the number of the question and ANSWER_NUMBER
the number of the answer.
You can also use 1 for the QUESTION_NUMBER
to refer to the same question (see below)
The \earlierAnswer
command is only allowed in the "variables" environment of a question.
Do not use the command \earlierAnswer
to refer to an earlier question in a problem that has
\randomquestionpool
enabled! This can cause unwanted behaviour.
Problems with random question pools should only use \earlierAnswer
for subtasks within the same question, by using the value 1 for the question number.
\earlierAnswer
doesn't work in combination with \permuteAnswers
.
Below is a complete example of a problem. The problem is trivial: a random number Q is given, and the student has to
compute $$x = Q + 1$$ in the first question, $$y = x + 1$$ in the second, and $$z = y + 1$$ in the third. The second
and third question depend on the solutions of previous questions. To take this into account, we added \earlierAnswer
commands to bind variables to earlier answers. In the second question, for example, we bound x to the first answer of
question 1.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62  \begin{problem}
\begin{variables}
\randint{Q}{4}{4}
\function{x}{Q+1}
\function{y}{x+1}
\function{z}{y+1}
\end{variables}
\begin{question}
\text{\textbf{Step 1}\\ \textit{Let Q = $\var{Q}$. Compute x = Q + 1:}}
\explanation{Simply add one}
\type{input.number}
\precision{3}
\field{real}
\begin{answer}
\text{ x = }
\solution{x}
\end{answer}
\end{question}
\begin{question}
\begin{variables}
\earlierAnswer{x}{1,1}
\end{variables}
\text{\textbf{Step 2}\\ \textit{Compute y = x + 1:}}
\explanation{Simply add one}
\type{input.number}
\precision{3}
\field{real}
\begin{answer}
\text{ y = }
\solution{y}
\end{answer}
\end{question}
\begin{question}
\begin{variables}
\earlierAnswer{x}{1,1}
\earlierAnswer{y}{2,1}
\end{variables}
\text{\textbf{Step 3}\\ \textit{Compute z = y + 1:}}
\explanation{Simply add one}
\type{input.number}
\precision{3}
\field{real}
\begin{answer}
\text{ z = }
\solution{z}
\end{answer}
\end{question}
\end{problem}

Here you find a more advanced example in WebMiau with consecutive errors with text answers:
Example 1
Example 2
Consecutive errors within one question
You can also set the QUESTION_NUMBER
to 1 to refer to a previous answer in the same question:
\earlierAnswer{VARIABLE}{1,ANSWER_NUMBER}
When you use \randomquestionpool
(see Randomquestionpool) at the begin of
a problem to make a selection, this is the only case of \earlierAnswer
that you can use.
Warning:
If you use \earlierAnswer{VARIABLE}{1,ANSWER_NUMBER}
, be aware of the correction procedure described above.
Wrong use:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  \begin{problem}
\begin{variables}
\randint{Q}{4}{4}
\function{x}{Q+1}
\function{y}{x+1}
\end{variables}
\begin{question}
\begin{variables}
\earlierAnswer{x}{1,1}
\end{variables}
\text{Let Q = $\var{Q}$.}
\type{input.number}
\begin{answer} % this answer will always be marked as correct!!
\text{Compute x = Q + 1:}
\solution{x}
\end{answer}
\begin{answer}
\text{Compute y = x + 1:}
\solution{y}
\end{answer}
\end{question}
\end{problem}

In this line of code, the student will always get full score for the first answer. Indeed, if
the answer is wrong, the correction will be repeated with x
being the student's first answer,
and so evaluate the first answer as conditionally correct.
The correct way is given by using a copy of the variable x
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28  \begin{problem}
\begin{variables}
\randint{Q}{4}{4}
\function{x}{Q+1}
\function{xc}{x}
\function{y}{xc+1}
\end{variables}
\begin{question}
\begin{variables}
\earlierAnswer{xc}{1,1}
\end{variables}
\text{Let Q = $\var{Q}$.}
\type{input.number}
\begin{answer}
\text{Compute x = Q + 1:}
\solution{x}
\end{answer}
\begin{answer}
\text{Compute y = x + 1:}
\solution{y}
\end{answer}
\end{question}
\end{problem}

Now the solution x
of the first answer is not affected by the \earlierAnswer
command,
but the solution y
of the second answer will.
Weighting the score of answers
By default the user obtains the same amount of points for every correct answer within a problem.
An exception is the case where an answer is not evaluated directly (compare the example for CheckFunctionForZero ).
This default can be changed by using the \score
command.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  \usepackage{mumie.genericproblem}
\title{Different Score Weights Per Answer}
\begin{problem}
\begin{variables}
\number{a}{1}
\number{b}{2}
\end{variables}
\begin{question}
\text{1 or 2?}
\explanation{}
\type{input.number}
\field{real}
\begin{answer}
\text{$1\cdot 1=$}
\solution{a}
% by default the score is 1.
\end{answer}
\begin{answer}
\text{$1\cdot 2=$}
\solution{b}
\score{2} % default score is 1
\end{answer}
\end{question}
\end{problem}

In the example above, the second answer is given the score weight 2.
Hence, if the total amount of points for the problem is 6, a correct first answer gives 2 points, a correct second answer 4 points.
This also works with answers in multiple questions.
Remark: The total amount of points for a problem is set in the "Settings" of a course in which it is used, and can change from course to course.
Partial score for an answer
If a student's answer was only partially incorrect, you may want to award partial credit for the response.
You can achieve this by using the command \partialScore[condition]{score}
within an answer environment. Specify the condition that must be met to receive the points. You can use the command multiple times within an answer environment. Make sure that the sum of possible partial scores earned at the same time does not exceed the maximum score (default: 1).
An example for answer type input.number:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  \begin{variables}
\randint{a}{5}{2}
\randint{b}{6}{9}
\function[calculate]{sol}{a*b}
\end{variables}
\begin{answer}
\type{input.number}
% maximum score is 2 (default: 1)
\score{2}
% +0.25 partial score, if the student tried to answer at all
\partialScore{0.25}{edited(ans)}
% +1 partial score, if the absolute value of the student's answer ist at least correct
\partialScore{1}{equal(sol,ans)}
\solution{sol}
% give an explanation for the partial scores (not mandatory)
\explanation[edited(ans)]{+0.25 point, at least you tried it}
\explanation[equal(ssol,ans)]{+1 point, absolute value correct}
\end{answer}

So far partial scores can be used for the following answer types: input.number
, input.function
, input.text
, input.interval
.
The condition syntax is similar to the one used for the optional condition in explanations.
For answer type input.matrix
only the very basic equal comparison is for now implemented.
1 2 3 4 5 6 7 8 9 10  \begin{variables}
\matrix{m}{1&0\\0&1}
\end{variables}
\begin{answer}
\type{input.matrix}
% ...
\partialScore{0.5}{equal(m,ans)}
% ...
\end{answer}

For partial scores for answer types mc.multiple
and mc.matrix
see: MC Score Types.