How do I get the ? for No Answer to appear first in the drop-down menu. Instead of them being listed as
- ?
- Descriptive Statistics
- Inferential Statistics
for each one as entered in the code, the possible answers are listed in random order with and random option listed first as if answers had been selected already.
DOCUMENT();
loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"PGcourse.pl"
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 0;
install_problem_grader(~~&std_problem_grader);
# Make a new select list
$ma = new_select_list();
$ma->rf_print_q(~~&pop_up_list_print_q);
# Insert some questions and answers
$ma -> ra_pop_up_list( [
No_answer => " ?",
Inferential => "Inferential Statistics",
Descriptive => "Descriptive Statistics",
] );
$ma -> qa ( # each entry has to end with a comma
'Collecting data', 'Descriptive',
'Interpreting data', 'Inferential',
'Summarizing data', 'Descriptive',
'Describing the characteristics of a dataset', 'Descriptive',
'Organizing a dataset', 'Descriptive',
'Finding the mode of data', 'Descriptive',
'Finding the mean of data', 'Descriptive',
'Extrapolation', 'Inferential',
'Inferring something about a population based on a sample', 'Inferential',
'Applying results about a part of a population to the whole population', 'Inferential',
);
# Choose four of the question and answer pairs at random.
$ma ->choose(4);
BEGIN_TEXT
$PAR
For each activity, select whether it is a type of inferential or descriptive statistics. To prepare for this question, read Chapter 1 of the text.
$BR$BR
Note that you only have a limited number of tries for this question, meaning you can select "Submit Answers" only so many times before WeBWorK stops letting you change your answers.
$BR$BR
Also note that the answers are listed in random order to begin with.
$BR$BR
\{ $ma-> print_q \}
$PAR
END_TEXT
# Enter the correct answers to be checked against the answers to the students.
ANS(str_cmp( $ma->ra_correct_ans ) ) ;
COMMENT('Questions selected randomly from a larger set. See source for full question list.');
ENDDOCUMENT(); # This should be the last executable line in the problem.