File:
[LON-CAPA] /
loncom /
html /
adm /
help /
tex /
Custom_Response_Problems.tex
Revision
1.2:
download - view:
text,
annotated -
select for diffs
Tue Jul 18 18:56:11 2006 UTC (18 years, 2 months ago) by
albertel
Branches:
MAIN
CVS tags:
version_2_3_X,
version_2_3_2,
version_2_3_1,
version_2_3_0,
version_2_2_X,
version_2_2_99_1,
version_2_2_99_0,
version_2_2_2,
version_2_2_1,
version_2_2_0,
version_2_1_99_3,
version_2_1_99_2,
version_2_1_99_1,
HEAD
attempting to possibly make the english clearer?
\label{Custom_Response_Problems}
Custom Response is a way to have a problem graded based on an algorithm. The use of this response type is
generally discouraged, since the responses will not be analyzable by the LON-CAPA statistics tools.
The student answer is stored in the
variable \$submission, and needs to be evaluated by Perl code inside the <answer>-tag. Custom Response needs to return a standard LON-CAPA grading code:
\begin{itemize}
\item EXACT\_ANS: return if solved exactly correctly
\item APPROX\_ANS: return if solved approximately
\item INCORRECT: return if not correct, uses up a try
\item SIG\_FAIL, NO\_UNIT, ANS\_CNT\_NOT\_MATCH, BAD\_FORMULA,
WANTED\_NUMERIC: return if not correct for different reasons, does not use up a try
\end{itemize}
The answer display is shown instead of the student response in 'show answer' mode.
The following example illustrates this:
\begin{verbatim}
<problem>
<startouttext />Accept an answer of around 90 or -90<endouttext />
<customresponse answerdisplay="something near 90 or -90">
<answer type="loncapa/perl">
# We do not want a vector
if ($submission=~/\,/) { return 'ANS_CNT_NOT_MATCH'; }
# Need a numerical answer here
if ($submission!~/^[\d\.\-\e]+$/i) { return 'WANTED_NUMERIC'; }
$difference=abs(90-abs($submission));
if ($difference==0) { return 'EXACT_ANS'; }
if ($difference < 0.1) { return 'APPROX_ANS'; }
return 'INCORRECT';</answer>
<textline readonly="no" />
</customresponse>
</problem>
\end{verbatim}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>