Consider
the following file. It currently has two separate multiple choice
questions that test exactly the same thing. How can I write code to
randomly choose only one of them instead of printing them both out. (my
apologies for typos -- I don't have a WebWork machine currently
running, so this is a "paper only" exercise)
Andy
**
DOCUMENT();
loadMacros('PG.pl',
'PGbasicmacros.pl',
'PGchoicemacros.pl',
'PGanswermacros.pl',
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 0;
$mca = new_multiple_choice;
$mca->qa('what is the negation of the following: If I form a study group then I raise my grades.',
'I form a study group and I lower my grades.'
);
$mca->extra(
'I form a study group and I raise my grades.',
'If I work alone then I lower my grades.',
'I work alone or I raise my grades.'
);
BEGIN_TEXT
$PAR
{ $mca->print_q() }
$PAR
{ $mcb->print_a() }
END_TEXT
ANS(radio_cmp($mca->correct_ans));
$mcb = new_multiple_choice;
$mcb->qa('what is the negation of the following: If P is a square then P is a rectangle.',
'P is a square and P is not a rectangle.'
);
$mcb->extra(
'P is a square and P is a rectangle.',
'P is a square or P is a rectangle.',
'P is a square.'
);
BEGIN_TEXT
$PAR
{ $mcb->print_q() }
$PAR
{ $mcb->print_a() }
END_TEXT
ANS(radio_cmp($mcb->correct_ans));
ENDDOCUMENT();
<| Post or View Comments |>
|