Multiple.pm | topic started 7/31/2000; 2:18:18 PM last post 7/31/2000; 2:18:18 PM |
Robert (Rochester ugrad) - Multiple.pm 7/31/2000; 2:18:18 PM (reads: 1126, responses: 0) |
NAMEMultiple.pm -- sub-class of List that implements a multiple choice question. All items accessed by $out=$mc->item($in);
SYNOPSISMultiple.pm is intended to be used to create one of two types of multiple choice
questions. The regular multiple choice question is one question followed by a
list of answers, only one of which is correct, printed in a bulleted form with
radio buttons to select the correct answer. The second type of of multiple choice
question consists of one question followed by several answers bulleted with check
boxes so that more than one answer can be selected if more than one answer exists.
Each student will receive the same set of answers in a mostly random order (some
answers can be forced to be at the end of list of answers, see
DESCRIPTION
Variables and methods available to Multiple
Variablesquestions # array of questions as entered using qa() selected_q # randomly selected subset of "questions" 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 correct_ans # outputs a reference to the array of correct answers
Usage
Regular Multiple ChoiceCreate a multiple choice question using the new_multiple_choice call. $mc = new_multiple_choice Use $mc->qa('\( x^2 \) is:', 'quadratic'); After calling qa you can use $mc->extra( If you want certain answers to be at the end of the list instead of having
them be randomized
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. Note that if 'None of
the above'
is the correct answer then you must put it in $mc->makeLast( Now you would start your problem with a 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(radio_cmp($mc->correct_ans))
Checkbox Multiple ChoiceA checkbox multiple choice problem is identical to a regular multiple choice problem with only a few exceptions. First, you create the checkbox multiple choice object using the command: $cmc = new_checkbox_multiple_choice Then you would call $cmc->qa( Then you would use ANS(radio_cmp($cmc->correct_ans)) File path = /ww/webwork/pg/lib/Multiple.pm |