## Forum archive 2000-2006

### christelle scharff - Question/Answer with feedback

by Arnold Pizer -
Number of replies: 0
 Question/Answer with feedback topic started 12/18/2006; 11:58:29 AMlast post 12/22/2006; 11:08:01 AM
 christelle scharff - Question/Answer with feedback  12/18/2006; 11:58:29 AM (reads: 124, responses: 2) Hi, In WeBWorK is there a type of question that would give student feeback when an incorrect answer is submitted? Best, Christelle <| Post or View Comments |>

 Michael Gage - Re: Question/Answer with feedback  12/21/2006; 7:29:50 PM (reads: 137, responses: 0) Hi Christelle, These can be constructed, but it's function that could use the development of some more tools to provide syntactic sugar for the process. Here is an example: The example below does a standard num_cmp with the number 3.14159 but gives a hint and encouragement (?) if your answer is off by less than .2. DOCUMENT();# Load whatever macros you need for the problemloadMacros(PG.pl,PGbasicmacros.pl,PGanswermacros.pl,PGauxiliaryFunctions.pl, );## Do NOT show partial correct answers$showPartialCorrectAnswers = 0;TEXT(beginproblem());BEGIN_TEXTEnter a value for (\pi){ans_rule()}END_TEXTsub addAnswerMessage { my$ans_eval = shift; if ( $ans_eval->{score} == 0 and abs ($ans_eval->{student_ans}-$PI) <.2 ) {$ans_eval->{ans_message} = "Close but no cigar"; } $ans_eval;}$ans_eval = num_cmp(3.14159,reltol=>.01);$ans_eval->{debug}=1;$ans_eval->install_post_filter(~~&addAnswerMessage);ANS($ans_eval);ENDDOCUMENT(); The $ans_eval->{debug}=1; line prints out a trace of evaluator as it works -- there is currently too much information, but it will give you some idea of the process as the student's response progresses down the pipeline of the evaluator. In particular it will tell you what fields have been defined in the particular answer evaluator you are working with. You should look through the AnswerEvaluator object in the lib/AnswerHash.pm file. I expect to be adding some features to this object so I'd appreciate any feedback on what you would like to see to make it easier to modify existing answer evaluators. --Mike <| Post or View Comments |>

 John Jones - Re: Question/Answer with feedback  12/22/2006; 11:08:01 AM (reads: 131, responses: 0) Hi, One possibility is to use pc_evaluator. You give it a list of answer checkers and webwork will match the student's answer until it finds a match. It then awards the specified amount of credit for that answer, and optionally gives a message. The name comes from the idea of giving partial credit for certain answers, but it can also be used for feedback. I don't know what you want to have trigger the feedback. Here is an artificial example. Note, in the loadMacros part of the problem, you need to load PGasu.pl so that pc_evaluator is defined. ANS(pc_evaluator([[num_cmp(10), 0, "hi"], [num_cmp(20), 0.5, "ho"], [num_cmp(23),1]])); If the student enters "10", they get no credit and a message of "hi", of they enter "20" they get half credit and a message of "ho", and an answer of "23" gives them full credit (no special message, but you could have one). Another example would be ANS(pc_evaluator([[num_cmp(23), 1], [auto_right(1), 0, "Try 23"]])); This gives full credit if the student answers "23", otherwise they get no credit and a helpful suggestion. John <| Post or View Comments |>