Answer hash datatype specification
Each answer evaluator accepts a single input
from a student's answer, checks it and creates a reference to a hash %ans_hash with nine required entries.
Except for "score" the entries can be empty strings, but they must be defined or error messages will be generated.
Additional entries can be added for special purposes.
A new alternative (as of June 2000) is to use an object of type AnswerHash (defined at the end of PGanswermacros.pl). $ro_ans_hash = new AnswerHash creates
a reference to this object. The object is very simple and at the moment
consists only of an anonymous hash for storing the entries listed below.
The advantages of using an object, is that all of the
required entries are automatically initialized (even if more required
entries are added at some later date). We may also add methods to this
class for "AND"ing or "OR"ing two answer hashes.
The output of each answer evaluator consists of a reference to a hash %ans_hash with these entries:
$ans_hash{score} or $ro_ans_hash ->{score}
a number between 0 and 1 indicating whether the answer is correct.
Fractions allow the implementation partial credit for incorrect
answers.
$ans_hash{correct_ans}
The correct answer, as supplied by the instructor and then formatted.
$ans_hash{original_correct_ans}
The original_correct answer, as supplied by the instructor. This can be
viewed by the student after the answer date. If the
original_correct_ans is not defined, correct_ans will be used instead.
If this is given by the .pg problem as a string (e.g.
"${a}cos(${b}pi/11)"), the student will see the correct answer given
symbolically (e.g. 2cos(3pi/11)) which is usually much more meaningful
than a numerical answer.
$ans_hash{student_ans}
This is the student's answer, after reformatting; for example the
answer might be forced to capital letters for comparison with the
instructors answer. This is displayed in the section reporting the
results of checking the student's answers.
$ans_hash{ans_message}
Any error message, or hint provided by the answer evaluator. This is
also displayed in the section reporting the results of checking the
student's answers.
$ans_hash{type}
A string indicating the type of answer evaluator. This helps in
preprocessing the student's answer for errors. Some examples:
'number_with_units' 'function' 'frac_number' 'arith_number'
$ans_hash{original_student_ans}
This is the student's original answer. This is displayed on the preview
page and may be used for sticky answers.
$ans_hash{preview_text_string}
This typically shows how the student's answer was parsed. It is
displayed on the preview page. For a student answer of 2sin(3x) this
would be 2*sin(3*x). For string answers it is typically the same as
$ans_hash{student_ans}.
$ans_hash{preview_latex_string}
THIS IS OPTIONAL. This is latex version of the student's answer which
is used to show a typeset view on the answer on the preview page. For a
student answer of 2/3, this would be frac{2}{3}.
<| Post or View Comments |>
|