|Select.pm||topic started 5/22/2000; 10:47:04 PM
last post 5/22/2000; 10:47:04 PM
|Michael Gage - Select.pm
5/22/2000; 10:47:04 PM (reads: 3082, responses: 0)
Select.pm -- sub-class of List that implements a select list.
All items accessed by $out = $sl -> item( $in );
Select.pm is intended to be used to create standard true/false questions or questions where all the questions have the same set of short one to two word answers as possible answers. Unlike a matching list, where answers are indicated by typing in the corresponding letter, in a select list the actual answer is typed in. A select list also has the option of having a pop-up list of the answers so that the correct answer can just be selected instead of typed. But like match lists, students can be given different sets of questions (to avoid students sharing answers) by entering many questions and then having each student only receive a sub-set of those questions by using choose.
questions # 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
qa( 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
Create a select list using the new_select_list call.
$sl = new_select_list;
After calling qa, use choose to select which questions and/or how many each student sees. 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.
would show the first question and a random question while
would show 3 random questions (but never call choose more than once).
If you want you can change the size of the answer boxes at any time (the default is 4).
$sl->ans_rule_len = 10;
Now you would start your problem with a BEGIN_TEXT tag
and print the questions
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.
A Pop-up select list problem is identical to a regular select list problem with only a few exceptions.
First, you would create a pop-up select list using the new_pop_up_select_list call.
$sl = new_pop_up_select_list;
Then you would use
$sl->ra_pop_up_list([no_answer => ' ?', T => 'True', F => 'False']);
indicates that instead of seeing the letter T (which was used as the actual answer), the student will see the word 'True'. Also, before they choose their answer the student will first see a question mark in each pop-up list indicating that they have not yet selected an answer there because the special variable no_answer has been selected. This is optional, however, because if no $sl->ra_pop_up_list is specified, it will default to the one shown above. So if this is want you want, you don't need to do any of this, but if you use ra_pop_up_list at all, these defaults will be lost and 'T' will just be 'T'. Also, if you don't specify a label for a particular answer, the label for that answer will be the answer (like I just said, 'T' will be 'T').
Other than those two differences, a pop-up select list problem is exactly the same as a regular select list problem as described above.
File path = /ww/webwork/pg/lib/Select.pm