WeBWorK Problems

multiple choice with static images

multiple choice with static images

by Valerio De Angelis -
Number of replies: 3
I would like to make a problem just like the one copied below (that is a slight modification of a problem found on the webwork wiki), but replacing the various LaTeX tables with png files that will show some graphs. Just like in the problem with the tables, the students need to choose which graphs define a function.
If there is an entirely different way to to do same, I would surely like to know.
Thanks for any help.



DOCUMENT();

loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"PGcourse.pl",
);

TEXT(beginproblem());

$mc = new_checkbox_multiple_choice();
$mc -> qa (
"Select the tables that define a function.",
"\( \begin{array}{c|cccccc}
x& 0 & 3 & 6 & 9 & 12 & 15\\
\hline
y& 1&1& 2 & 1&1&1
\end{array}
\)$BR $BR",
"\( \begin{array}{c|ccccc}
s&-3& -1 & 1 & 3 & 5\\
\hline
t & 1 & 3 & 5 & 3 & 1
\end{array} \)$BR $BR",
"\( \begin{array}{c|ccccc}
u&0& 2 & 4 & 6 & 8\\
\hline
v & 1 & 1 & 1 & 1 & 1
\end{array} \)$BR $BR",
"\( \begin{array}{c|ccccc}
u&0& 2 & 0 & 2 & 0\\
\hline
v & 1 & 3 & 1 & 3 & 1
\end{array} \)$BR $BR"
);
$mc -> extra(
"\( \begin{array}{c|cccccc}
s&0&1&2&1&0\\
\hline
t&4&3&2&1&0
\end{array} \)$BR $BR",
"\( \begin{array}{c|cccccc}
x &1&4&7&4&1&0\\
\hline
y&1&0&3&1&2&1
\end{array} \)$BR $BR",
);

BEGIN_TEXT

\{ $mc -> print_q() \}
$BR
\{ $mc -> print_a() \}

END_TEXT


install_problem_grader(~~&std_problem_grader);

$showPartialCorrectAnswers = 0;

ANS( checkbox_cmp( $mc->correct_ans() ) );

ENDDOCUMENT();
In reply to Valerio De Angelis

Re: multiple choice with static images

by Gavin LaRose -
Hi Valerio,

I'm not sure if I'm correctly understanding your question; I think this will work nicely replacing the tables with image() calls, as you suggest:

    $mc->qa (
      "Select the graphs that define a function.",
      image("imagefile1.png", options) . $BR,
      image("imagefile2.png", options) . $BR
    );

and so on. I can think of some other ways to do the same thing (e.g., with pop-up options for each graph: <http://webwork.maa.org/wiki/PopUpListsLong>), but not anything that seems strikingly better.

Gavin

In reply to Gavin LaRose

Re: multiple choice with static images

by Paul Pearson -
Hi Valerio,

Please have a look at these files in the WebWork Open Problem Library as templates (use the browse by directory button in the library browser):

FortLewis/Calc3/12-2-Multivariable-graphs/HGM4-12-2-02b-Multivariable-functions-graphs/HGM4-12-2-02b-Multivariable-functions-graphs.pg

FortLewis/Calc3/12-3-Contour-diagrams/HGM4-12-3-18a-Contour-diagrams/HGM4-12-3-18a-Contour-diagrams.pg

FortLewis/Calc3/12-3-Contour-diagrams/HGM4-12-3-18a-Contour-diagrams/HGM4-12-3-18a-Contour-diagrams.pg

FortLewis/Calc3/12-3-Contour-diagrams/HGM4-12-3-18a-Contour-diagrams/HGM4-12-3-18a-Contour-diagrams.pg

Best regards,

Paul Pearson