(1 pt) rochesterLibrary/setMAAtutorial/popuplistexample.pg
True False Popup Example
Indicate whether each statement is true or false.
? True False
1. All differentiable strictly increasing functions have nonnegative derivatives
at every point
? True False
2. All polynomials are differentiable.
? True False
3. All compact sets are closed
? True False
4. All closed sets are compact

WARNINGS µ¦å{h
DOCUMENT(); # This should be the first executable line in the problem.
loadMacros("PGbasicmacros.pl", "PGchoicemacros.pl", "PGanswermacros.pl", );
TEXT(beginproblem(), $BR,$BBOLD, "True False Popup Example", $EBOLD, $BR,$BR); $showPartialCorrectAnswers = 0;
# Make a new select list $tf = new_select_list(); # $tf now "contains" the select list object.
# change the printing mechanism of the object to # use popup list instead of an answer rule. $tf>rf_print_q(~~&pop_up_list_print_q);
# What should the popup list contain, and what string should it # submit for an answer when selected? # These are specified in the statment below. # To enter T as an answer choose the list element "True" # To enter F as an answer choose the list element "False" # The first choice is a blank to make the students do SOMETHING!!! $tf > ra_pop_up_list( [ No_answer => " ?", T => "True", F => "False"] ); # Note how the list is constructed [ answer => list element text, answer => list element text ]
# Insert some questions and their answers.
$tf > qa ( # each entry has to end with a comma "All continuous functions are differentiable.", "F", "All differentiable functions are continuous.", "T", "All polynomials are differentiable.", "T", "All functions with positive derivatives are increasing.", "T", "All compact sets are closed", "T", "All closed sets are compact", "F", "All increasing functions have positive deriviatives", "F", "All differentiable strictly increasing functions have nonnegative derivatives at every point", "T", );
# Choose two of the question and answer pairs at random. $tf >choose(4); # Using choose(3) would choose all three # questions, but the order of the questions # and answers would be scrambled.
# Now print the text using $ml>print_q for the questions. BEGIN_TEXT $PAR Indicate whether each statement is true or false. $BR \{ $tf> print_q \} $PAR END_TEXT # Enter the correct answers to be checked against the answers to the students. ANS(str_cmp( $tf>ra_correct_ans ) ) ;
ENDDOCUMENT(); # This should be the last executable line in the problem.
Comments:
This problem is just a demo  it doesn't actually work if you push the submit answer
button. (You can test a {linkWebworkProblem("tutorialCourse", "setFirstSteps","5","live")} version of this problem.)
 This is nearly identical to the truefalse problem, but this time the answers are selected from a list.
 First we create the object  this time called a "popup select list".
$tf = new_pop_up_select_list(); (line 16)
 Next we enter a list of questions, followed by their answers (T or F) (lines 20  29)
 Choose two questions at random from the list.
$tf >choose(2); (line 32)
 Print the questions
{ $tf> print_q } (line 40)
 Register the correct answers
ANS( str_cmp( $tf>ra_correct_ans ) ) ; ( line 45 )
< Post or View Comments >
