AnyAnswerMarkedCorrect

From WeBWorK_wiki
Revision as of 15:43, 1 September 2011 by Apizer (talk | contribs) (Created page with '<h2>Any Answer Marked Correct</h2> <!-- Header for these sections -- no modification needed --> <p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> <em>…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Any Answer Marked Correct


This PG code shows how to mark any answer a student submits as correct.

Problem Techniques Index

PG problem file Explanation
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGasu.pl",
"PGcourse.pl",
);
TEXT(beginproblem()); 

Initialization: We need to include the macros file PGasu.pl, which provides an answer checker that marks any answer submitted as correct.

Context("Numeric");
Context()->variables->are(x=>"Real",y=>"Real",u=>"Real");

$a = random(2,9,1);

Setup: Everything is as usual.

Context()->texStrings;
BEGIN_TEXT
Enter anything, e.g. \($a\) and it will be marked correct:
\{ans_rule(10) \}.


END_TEXT
Context()->normalStrings;

Main Text: The text section is as we'd expect.

$showPartialCorrectAnswers = 1;

ANS(auto_right("All answers are marked correct"));

ENDDOCUMENT();

Answer Evaluation: We use the ANS(auto_right("All answers are marked correct")); routine to evaluate the answer. The phrase in quotes (which can be empty) is displayed when "Show correct answers" is checked. See PGasu.pl.html for more options and details.

Problem Techniques Index