Difference between revisions of "UnorderedAnswers1"

From WeBWorK_wiki
Jump to navigation Jump to search
m
(Add link to PGML version in OPL)
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
This PG code shows how to allow students to enter their answers into several answer blanks in any order.
 
This PG code shows how to allow students to enter their answers into several answer blanks in any order.
 
</p>
 
</p>
* Download file: [[File:UnorderedAnswers1.txt]] (change the file extension from txt to pg when you save it)
 
  +
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/UnorderedAnswers1.pg FortLewis/Authoring/Templates/Algebra/UnorderedAnswers1.pg]
* File location in NPL: <code>FortLewis/Authoring/Templates/Algebra/UnorderedAnswers1.pg</code>
 
  +
* PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/UnorderedAnswers1_PGML.pg FortLewis/Authoring/Templates/Algebra/UnorderedAnswers1_PGML.pg]
   
 
<br clear="all" />
 
<br clear="all" />
Line 167: Line 167:
   
 
[[Category:Top]]
 
[[Category:Top]]
[[Category:Authors]]
 
 
[[Category:Sample Problems]]
 
[[Category:Sample Problems]]
 
[[Category:Subject Area Templates]]
 
[[Category:Subject Area Templates]]

Revision as of 16:55, 7 June 2015

Answers Can Be Entered Into Answer Blanks in Any Order

Click to enlarge

This PG code shows how to allow students to enter their answers into several answer blanks in any order.


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"AnswerFormatHelp.pl",
"unorderedAnswer.pl",
);

TEXT(beginproblem());

Initialization: We must load unorderedAnswer.pl.

Context("Numeric")->variables->add(y=>"Real",z=>"Real");

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

$answer1 = Compute("x^$a");
$answer2 = Compute("y^$a");
$answer3 = Compute("z^$a");

Setup:

Context()->texStrings;
BEGIN_TEXT
Rewrite the following expression without parentheses.  
Simplify your answer as much as possible, and assume 
that all variables are positive.
$BR
$BR
\( (xyz)^{$a} = \) 
\{ ans_rule(5) \}
\( \cdot \)
\{ ans_rule(5) \}
\( \cdot \)
\{ ans_rule(5) \}
\{ AnswerFormatHelp("formulas") \}
END_TEXT
Context()->normalStrings;

Main Text:

$showPartialCorrectAnswers = 1;

UNORDERED_ANS( 
$answer1->cmp(), 
$answer2->cmp(), 
$answer3->cmp(),
);

Answer Evaluation: We use UNORDERED_ANS( checker1, checker2, ...); to evaluate the answers. It is possible to withhold feedback and credit until everything is correct by using the standard problem grader, which awards no partial credit and full credit only when everything is correct.

$showPartialCorrectAnswers = 0;

install_problem_grader(~~&std_problem_grader);

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;

COMMENT('MathObject version.');

ENDDOCUMENT();

Solution:

Templates by Subject Area