## WeBWorK Problems

### matching problems

by Zak Zarychta -
Number of replies: 2
Given a matching problem based on the example of Matching1, where there are many questions and less option matches. How might I avoid the repeating of the same matching option when the question is presented to the student.

the question (in question !?) may be viewed at

thanks in advance for any suggestions,
Zak

### Re: matching problems

by Zak Zarychta -
The issue is that when the specific questions in the problem are randomly selected, some students get identical matching options, only one of which is correct.
An example of this can be seen at the following link.

Zak

### Re: matching problems

by Zak Zarychta -

On reflection I managed to solve the problem.

To ensure that no two problems with the same matching option were selected, each different question that has an identical matching option was grouped into an array.

One question from each group was selected by assigning each group a random selector Hence, all the matching options were covered and none were duplicated. For example

$randG1=random(0,n-1,1)$matchoptG1 = “matching option for group 1”;

@QgroupG1 = (#

“question_1”,

“question_2”,

“question_3”,

,...

“question_n”];

$randG1=random(0,n-1,1)$matchoptG2 = “matching option for group 2”;

@QgroupG2 = (#

“question_1”,

“question_2”,

“question_3”,

,...

“question_n”];

...

$randG1=random(0,n-1,1)$matchoptGN = “matching option for group N”;

@QgroupGN = (#

“question_1”,

“question_2”,

“question_3”,

,...

“question_n”];

####### snip ######

#

$ml->qa( "$QgroupG1[$randGp1]",”$matchoptG1”,
"$QgroupG2[$randGp2]",”$matchoptG2”, "$QgroupGN[$randGpN]",”$matchoptGN”