WeBWorK Problems

Multiple answer across multiple answer boxes

Multiple answer across multiple answer boxes

by Joseph Wells -
Number of replies: 1

I apologize if this has been asked before. I tried searching, and while I found similar questions, none of them really seemed to handle the case I'm looking at. Maybe my Google-fu needs some work.

I've provided an example below. I want a question to have multiple answer boxes, and I want each of those answer boxes to (1) allow multiple possible answers and (2) to check against each other so that the student doesn't use the same answer in all of them. I'm still new to WeBWorK, so maybe there's a usual technique for dealing with this. In the past, I've gotten around this issue by forcing the answers to be in a particular order, but it doesn't makes sense to do that in this context.

Thanks in advance.


DOCUMENT();        # This should be the first executable line in the problem.

loadMacros(
  "PGstandard.pl",
  "PGchoicemacros.pl",
  "PGcomplexmacros.pl",
  "PGcourse.pl"
);

TEXT(beginproblem());

BEGIN_TEXT
Find and classify each singularity for the function \( f(z) = \dfrac{e^{1/z}}{(z-1)(z-i)^2} \).
$PAR
Singularity at \(z = \) \{ans_rule(20)\}, Singularity type: \{ans_rule(20)\} (If \(z\) is a pole, enter the order. Otherwise type "REM" if removable or "ESS" if essential.) 
$BR
Singularity at \(z = \) \{ans_rule(20)\}, Singularity type: \{ans_rule(20)\} 
$BR
Singularity at \(z = \) \{ans_rule(20)\}, Singularity type: \{ans_rule(20)\} 
END_TEXT

ANS(cplx_cmp(i)); #This can be any of i, 1, or 0
ANS(cplx_cmp(2)); #This answer relies on the one above

ANS(cplx_cmp(1)); #This can be any of i, 1, or 0 that isn't used above 
ANS(cplx_cmp(1)); #This answer relies on the one above

ANS(cplx_cmp(0)); #This can be any of i, 1, or 0 that isn't used above  
ANS(cplx_cmp( "ESS", strings => ["ESS", "ess"] )); #This answer relies on the one above

ENDDOCUMENT();

In reply to Joseph Wells

Re: Multiple answer across multiple answer boxes

by Glenn Rice -

The standard way to do this sort of thing is to use a MultiAnswer problem.  See https://webwork.maa.org/wiki/MultiAnswerProblems.