Match.pm | topic started 5/22/2000; 10:46:06 PM last post 5/22/2000; 10:46:06 PM |
Michael Gage - Match.pm 5/22/2000; 10:46:06 PM (reads: 3331, responses: 0) |
NAMEMatch.pm -- sub-class of List that implements a matching list. All items accessed by $out = $ml -> item( $in );
SYNOPSISMatch.pm is intended to be used to create standard matching questions in which the the student is given a list of questions and a list of answers and is asked to match the correct answers to those questions. Some answers may be used more than once while others are not used at all. The order of answers is usually random but some answers can be appended to the end of the list in a set order (i.e. 'None of the above', 'All of the above'). Answers are not directly typed in but are given a corresponding letter that is the answer that the system expects. (i.e. 'the answer to #1 is A' not 'the answer to #1 is the square root of 2'). Also, students can be given different sets of questions (to avoid students sharing answers) by entering many questions and then using choose with a number less than the total so that each student only receive a sub-set of those questions.
DESCRIPTION
Variables and methods available to Match
Variablesquestions # array of questions as entered using qa() selected_q # randomly selected subset of "questions" ans_rule_len # determines the length of the answer blanks slice # index used to select specific questions inverted_shuffle # the inverse permutation array rf_print_q # reference to any subroutine which should rf_print_a # reference to any subroutine which should
Methodsqa( array ) # accepts an array of strings which can be used extra( array ) # accepts an array of strings which can be used print_q # yields a formatted string of question to be choose([3, 4], 1) # chooses questions indexed 3 and 4 and one other ra_correct_ans # outputs a reference to the array of correct answers
UsageCreate a match list using the new_match_list call. $ml = new_match_list Use $ml->qa( After you call qa you can use $ml->extra( After calling extra you can use choose to select which questions and/or how many each student sees. This helps give students different sub-sets of the full question set so that students cannot cheat as easily. A list of numbers in brackets indicates which questions every student sees (counting starts with 0) and the final number outside of brackets is how many more questions should be randomly picked for each student. Though it is available, the use of selecting specific extra answers is not recommended for novices as the indexing is complicated (see below). $ml->choose([0], 1); would show the first question and a random question while $ml->choose(3); would show 3 random questions (but never call choose more than once). After calling choose, use choose_extra to select which of the extra 'answers' will be given to each student. Note that unused answers are dumped into the list of extra 'answers' so the indexing may be difficult to grasp at first. (This can be stopped by doing the following: $ml->dumpExtra = "";) $ml->choose_extra([0], 2); would show 3 extra answers besides the correct one note that these extra answers may consist of answers from the questions that were not used. After calling choose_extra you can use makeLast to add specific answers to the end of the list of answers or to force already existing answers to be moved to the end of the list. This is usually done for 'None of the above', or 'All of the above' type answers. $ml->makeLast( If you want you can change the size of the answer boxes at any time (the default is 4). $ml->ans_rule_len(10); Now you would start your problem with a BEGIN_TEXT tag
and print the questions
and answers with the BEGIN_TEXT Now all that's left is sending the students answers to the answer evaluator along with the correct answers so that the students answers can be checked and a score can be given. This is done using ANS, an answer evaluator and the ra_correct_ans variable. ANS(str_cmp($ml->ra_correct_ans)); File path = /ww/webwork/pg/lib/Match.pm |