I was able to accomplish this using a combination of radio buttons and a multiAnswer problem. However, the "Entered" and "Answer Preview" values contain a superfluous suffix (; _) when only one of the multiple choice problems is previewed or checked by the student. This issue is not present when zero or all questions are answered. The issue is also not present when the multiple choice questions are moved out of the MultiAnswer() function.
I would appreciate any thought about cleaning this up. Code for a MWE is given below and attached is a screenshot with red arrows indicated the text in question.
Thank you,
Steven
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'parserMultiAnswer.pl', 'PGcourse.pl','parserRadioButtons.pl');
$radio1 = RadioButtons([ 1, 2, 3], 1, );
$radio2 = RadioButtons( [ 4, 5, 6], 0, );
$multians = MultiAnswer($radio1, $radio2)->with(
singleResult => 1,
checker => sub {
my ($correct, $student, $self) = @_;
my ($f1stu, $f2stu) = @{$student};
my ($f1, $f2) = @{$correct};
if (($f1 == $f1stu && $f2 == $f2stu)
|| ($f1 == $f2stu && $f2 == $f1stu))
{
return [ 1, 1 ];
} else {
if ($f1 == $f1stu || $f2 == $f1stu) {
return [ 1, 0 ];
} elsif ($f1 == $f2stu || $f2 == $f2stu) {
return [ 0, 1 ];
} else {
return [ 0, 0 ];
} } });
BEGIN_PGML
1+1 =
[___]{$multians}
2+2 =
[___]{$multians}
END_PGML
ENDDOCUMENT();