Difference between revisions of "MultipleChoicePopup2"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | <h2>Multiple Choice Question |
+ | <h2>Multiple Choice Question with a Popup Menu</h2> |
+ | [[File:MultipleChoicePopup2.png|300px|thumb|right|Click to enlarge]] |
||
<p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> |
<p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> |
||
This PG code shows how to write a multiple choice question in which all of the options are displayed to the student and the student can only choose one correct answer (it uses radio buttons). |
This PG code shows how to write a multiple choice question in which all of the options are displayed to the student and the student can only choose one correct answer (it uses radio buttons). |
||
− | <ul> |
||
− | <li>Download file: [[File:MultipleChoicePopup2.txt]] (change the file extension from txt to pg when you save it)</li> |
||
− | <li>File location in NPL: <code>NationalProblemLibrary/FortLewis/Authoring/Templates/Misc/MultipleChoicePopup2.pg</code></li> |
||
− | </ul> |
||
</p> |
</p> |
||
+ | * Download file: [[File:MultipleChoicePopup2.txt]] (change the file extension from txt to pg when you save it) |
||
+ | * File location in NPL: <code>NationalProblemLibrary/FortLewis/Authoring/Templates/Misc/MultipleChoicePopup2.pg</code> |
||
+ | |||
+ | <br clear="all" /> |
||
<p style="text-align:center;"> |
<p style="text-align:center;"> |
||
[[SubjectAreaTemplates|Templates by Subject Area]] |
[[SubjectAreaTemplates|Templates by Subject Area]] |
Revision as of 14:46, 2 December 2010
Multiple Choice Question with a Popup Menu
This PG code shows how to write a multiple choice question in which all of the options are displayed to the student and the student can only choose one correct answer (it uses radio buttons).
- Download file: File:MultipleChoicePopup2.txt (change the file extension from txt to pg when you save it)
- File location in NPL:
NationalProblemLibrary/FortLewis/Authoring/Templates/Misc/MultipleChoicePopup2.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserPopUp.pl", ); TEXT(beginproblem()); |
Initialization:
We need |
Context("Numeric"); $popup = PopUp( ["?","Red","Blue","Green"], "Blue", ); |
Setup:
To create a radio object, use |
Context()->texStrings; BEGIN_TEXT My favorite color is \{ $popup->menu() \} END_TEXT Context()->normalStrings; |
Main Text: |
install_problem_grader(~~&std_problem_grader); $showPartialCorrectAnswers = 0; ANS( $popup->cmp() ); |
Answer Evaluation: We withhold feedback by choosing not to show partially correct answers. We use the standard problem grader, which gives full credit or no credit. For other graders, see weighted graders |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:$PAR The correct answer is \{ $popup->correct_ans() \} END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |