Difference between revisions of "Matching1"

From WeBWorK_wiki
Jump to navigation Jump to search
(Created page with '<h2>Matching Question</h2> 300px|thumb|right|Click to enlarge <p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> This PG code shows …')
 
(add historical tag and give links to newer problems.)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  +
{{historical}}
  +
  +
<p style="font-size: 120%;font-weight:bold">This problem has been replaced with many other problems:</p>
  +
* [https://openwebwork.github.io/pg-docs/sample-problems/Misc/Matching.html A matching problem]
  +
* [https://openwebwork.github.io/pg-docs/sample-problems/Misc/MatchingAlt.html An alternative matching problem]
  +
  +
 
<h2>Matching Question</h2>
 
<h2>Matching Question</h2>
   
 
[[File:Matching1.png|300px|thumb|right|Click to enlarge]]
 
[[File:Matching1.png|300px|thumb|right|Click to enlarge]]
<p style="background-color:#eeeeee;border:black solid 1px;padding:3px;">
+
<p style="background-color:#f9f9f9;border:black solid 1px;padding:3px;">
 
This PG code shows how to set up a matching question.
 
This PG code shows how to set up a matching question.
 
</p>
 
</p>
* Download file: [[File:Matching1.txt]] (change the file extension from txt to pg when you save it)
 
  +
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/Matching1.pg FortLewis/Authoring/Templates/Misc/Matching1.pg]
* File location in NPL: <code>FortLewis/Authoring/Templates/Misc/Matching1.pg</code>
+
* PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/Matching1_PGML.pg FortLewis/Authoring/Templates/Misc/Matching1_PGML.pg]
   
 
<br clear="all" />
 
<br clear="all" />
Line 56: Line 63:
 
<p>
 
<p>
 
<b>Initialization:</b>
 
<b>Initialization:</b>
  +
We use <code>PGchoicemacros.pl</code> to construct the list of matching object, and the custom problem grader fluid from <code>PGgraders.pl</code> for incremental grading.
 
</p>
 
</p>
 
</td>
 
</td>
Line 105: Line 113:
 
<td style="background-color:#ffffcc;padding:7px;">
 
<td style="background-color:#ffffcc;padding:7px;">
 
<p>
 
<p>
<b>Setup:</b>
+
<b>Setup:</b>
  +
Since we are choosing 6 questions and 2 extra answers and have 1 entry in <code>makeLast</code>, we must create a popup list with 9 entries A through I.
  +
</p>
  +
<p>
 
For more details, see [http://webwork.maa.org/wiki/MatchingProblems MatchingProblems] from the Problem Techniques documentation.
 
For more details, see [http://webwork.maa.org/wiki/MatchingProblems MatchingProblems] from the Problem Techniques documentation.
 
</p>
 
</p>
Line 119: Line 127:
 
BEGIN_TEXT
 
BEGIN_TEXT
 
Match each question with its answer.
 
Match each question with its answer.
\{ ColumnMatchTable($ml) \}
+
\{ ColumnMatchTable($ml, valign=>'TOP') \}
 
END_TEXT
 
END_TEXT
 
Context()->normalStrings;
 
Context()->normalStrings;
Line 126: Line 134:
 
<p>
 
<p>
 
<b>Main Text:</b>
 
<b>Main Text:</b>
  +
The <code>ColumnMatchTable()</code> is provided by the macro file <code>unionTables.pl</code>.
 
</p>
 
</p>
 
</td>
 
</td>
Line 157: Line 166:
 
<p>
 
<p>
 
<b>Answer Evaluation:</b>
 
<b>Answer Evaluation:</b>
  +
We must withhold feedback from students by setting <code>$showPartialCorrectAnswers = 0;</code>
  +
We use an incremental grader called <code>custom_problem_grader_fluid</code>. With this problem grader, you must specify the number of correct answers <code>[2,4,6]</code> and their corresponding scores <code>[0.3,0.6,1]</code> and update the grader message accordingly. The last entry in the array for <code>grader_numright</code> must be the total number of questions asked, and the last entry in the array for <code>grader_scores</code> must be 1 (otherwise nobody can earn full credit!).
  +
</p>
  +
<p>
  +
If you want a grader that awards full credit when all questions are correct and no credit otherwise, uncomment the standard problem grader.
 
</p>
 
</p>
 
</td>
 
</td>
Line 194: Line 208:
   
 
[[Category:Top]]
 
[[Category:Top]]
[[Category:Authors]]
+
[[Category:Sample Problems]]
  +
[[Category:Subject Area Templates]]

Latest revision as of 07:22, 17 July 2023

This article has been retained as a historical document. It is not up-to-date and the formatting may be lacking. Use the information herein with caution.

This problem has been replaced with many other problems:


Matching Question

Click to enlarge

This PG code shows how to set up a matching question.


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();  

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGchoicemacros.pl",
"PGgraders.pl",
"unionTables.pl",
);

TEXT(beginproblem());

Initialization: We use PGchoicemacros.pl to construct the list of matching object, and the custom problem grader fluid from PGgraders.pl for incremental grading.

#
#  Create a matching list and use popups
#
$ml = new_match_list();
$ml->rf_print_q(~~&pop_up_list_print_q);
$ml->ra_pop_up_list([
"No answer" => "?",
"A" => "A", "B" => "B", "C" => "C", 
"D" => "D", "E" => "E", "F" => "F",
"G" => "G", "H" => "H", "I" => "I",
]);

#
#  Add correct questions and answers
#
$ml->qa(
"Question a?", "Answer a",
"Question b?", "Answer b",
"Question c?", "Answer c",
"Question d?", "Answer d",
"Question e?", "Answer e",
"Question f?", "Answer f",
);
$ml->choose(6);

#
#  Add extra incorrect answers
#
$ml->extra(
"Extra answer 1", 
"Extra answer 2",
);
$ml->choose_extra(2);
  
$ml->makeLast("None of the above");

Setup: Since we are choosing 6 questions and 2 extra answers and have 1 entry in makeLast, we must create a popup list with 9 entries A through I.

For more details, see MatchingProblems from the Problem Techniques documentation.

Context()->texStrings;
BEGIN_TEXT
Match each question with its answer.
\{ ColumnMatchTable($ml, valign=>'TOP') \}
END_TEXT
Context()->normalStrings;

Main Text: The ColumnMatchTable() is provided by the macro file unionTables.pl.

$showPartialCorrectAnswers = 0;

#
#  Incremental grader
#
install_problem_grader(~~&custom_problem_grader_fluid);
$ENV{'grader_numright'} = [2,4,6];
$ENV{'grader_scores'} = [0.3,0.6,1];
$ENV{'grader_message'} = "You can earn " .
"30% partial credit for 2 - 3 correct answers, and ".
"60% partial credit for 4 - 5 correct answers.";

#
#  All or nothing grader
#  
# install_problem_grader(~~&std_problem_grader);

ANS( str_cmp( $ml->ra_correct_ans ) );

Answer Evaluation: We must withhold feedback from students by setting $showPartialCorrectAnswers = 0; We use an incremental grader called custom_problem_grader_fluid. With this problem grader, you must specify the number of correct answers [2,4,6] and their corresponding scores [0.3,0.6,1] and update the grader message accordingly. The last entry in the array for grader_numright must be the total number of questions asked, and the last entry in the array for grader_scores must be 1 (otherwise nobody can earn full credit!).

If you want a grader that awards full credit when all questions are correct and no credit otherwise, uncomment the standard problem grader.

@correct = @{$ml->ra_correct_ans()};
$answerstring = join(", ", @correct);
Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:$PAR
The correct answers are $answerstring
END_SOLUTION
Context()->normalStrings;

COMMENT('MathObject version.');

ENDDOCUMENT();

Solution: It is also possible to provide explanations for these answers. For details, see MatchingProblems from the Problem Techniques documentation.

Templates by Subject Area