UnorderedAnswers1

From WeBWorK_wiki
Revision as of 19:52, 4 December 2010 by Pearson (talk | contribs) (Created page with '<h2>Answers Can Be Entered Into Answer Blanks in Any Order</h2> 300px|thumb|right|Click to enlarge <p style="background-color:#f9f9f9;border:black…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.

  • Download file: File:UnorderedAnswers1.txt (change the file extension from txt to pg when you save it)
  • File location in NPL: FortLewis/Authoring/Templates/Algebra/UnorderedAnswers1.pg


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:

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:

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

COMMENT('MathObject version.');

ENDDOCUMENT();

Solution:

Templates by Subject Area