HomeCurrent UR
|
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
Variables
questions # array of questions as entered using qa()
answers # array of answers as entered using qa()
selected_q # randomly selected subset of "questions"
selected_a # the answers for the selected questions
slice # index used to select specific questions
shuffle # permutation array which can be applied to slice
# to shuffle the answers
inverted_shuffle # the inverse permutation array
rf_print_q # reference to any subroutine which should
# take ($self, @questions) as parameters and
# output the questions in a formatted string.
# If you want to change the way questions are
# printed, write your own print method and set
# this equal to a reference to to that method
# (i.e. $sl->rf_print_q = ~~&printing_routine_q)
rf_print_a # reference to any subroutine which should
# take ($self, @answers) as parameters and
# output the answers in a formatted string.
# If you want to change the way answers are
# printed, write your own print method and set
# this equal to a reference to to that method
# (i.e. $sl->rf_print_a = ~~&printing_routine_a)
Methods
qa( array ) # accepts an array of strings which can be used
# for the question and answers
extra( array ) # accepts an array of strings which can be used
# as extra answers
print_q # yields a formatted string of question to be
# matched with answer blanks
print_a # yields a formatted string of answers
choose([3, 4], 1) # chooses questions indexed 3 and 4 and one other
# randomly
makeLast( array ) # accepts an array of strings (like qa) which will
# be forced to the end of the list of answers.
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(
'cubic',
'logarithmic',
'exponential'
);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(
'All of the above',
'None of the above'
);Now you would start your problem with a
BEGIN_TEXT
$PAR
\{ $mc->print_q() \}
$PAR
\{ $mc->print_a() \}
END_TEXTNow 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_choiceThen you would call
$cmc->qa(
'Indicate all the functions that are anti-derivatives of \( 3x^2
\)',
'\( x^3 \)',
'\( x^3 - 57 \)',
'\( 27 + x^3 \)'
);Then you would use
ANS(radio_cmp($cmc->correct_ans))
File path = /ww/webwork/pg/lib/Multiple.pm
|
||
Last update: Wednesday, January 10, 2007 at 9:56:47 PM.
This site maintained using Manila and Frontier software. |
|||