Difference between revisions of "MultipleChoiceCheckbox3"
Paultpearson (talk | contribs) |
Paultpearson (talk | contribs) m |
||
Line 181: | Line 181: | ||
[[Category:Top]] |
[[Category:Top]] |
||
− | [[Category:Authors]] |
||
[[Category:Sample Problems]] |
[[Category:Sample Problems]] |
||
[[Category:Subject Area Templates]] |
[[Category:Subject Area Templates]] |
Revision as of 15:22, 3 January 2012
Multiple Choice with Checkboxes
This PG code shows how to write a multiple choice question with possibly more than one correct answer by using checkboxes.
- Download file: File:MultipleChoiceCheckbox3.txt (change the file extension from txt to pg when you save it)
- File location in NPL:
FortLewis/Authoring/Templates/Misc/MultipleChoiceCheckbox3.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "PGchoicemacros.pl", ); TEXT(beginproblem()); |
Initialization: |
$mc = new_checkbox_multiple_choice(); $mc -> qa ( "Select all expressions that are equivalent to \( e^{x^2 + 1/x} \). There may be more than one correct answer.", "\( e^{x^2} e^{1/x} \) $BR", "\( e^{x^2} e^{x^{-1}} \) $BR", ); $mc -> extra( "\( \displaystyle \frac{ e^{x^2} }{ e^x } \) $BR", ); $mc -> makeLast("None of the above"); |
Setup:
Use the question and answer method $mc->qa( "Question text here.", "\( x^2 \) $BR", "\( \displaystyle \frac{x^2}{4-x} \) $BR" );
Incorrect answers are specified as a list of string arguments to the
The arguments of the $mc->qa("question","None of the above"); $mc->extra("very wrong","distractor","red herring"); $mc->makeLast("None of the above");
To make answers appear in a certain order (e.g., Yes followed by No and Maybe), use |
Context()->texStrings; BEGIN_TEXT Additional instructions can be put here. $BR \{ $mc -> print_q() \} $BR \{ $mc -> print_a() \} END_TEXT Context()->normalStrings; |
Main Text:
Print the question and answers. Print the question text using |
install_problem_grader(~~&std_problem_grader); $showPartialCorrectAnswers = 0; ANS( checkbox_cmp( $mc->correct_ans() ) ); |
Answer Evaluation: |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:$PAR The correct answer is \{ $mc->correct_ans() \} END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |