Multiple-choice style

We create a maxima-embedded LATEXfile thisquiz.tex successfully, and then prepare it in the form of HTML multiple-choice control sequence.

\problemset
\problem
problem statements
\multiplechoice
\correct
correct choice
\incorrect
incorrect choice
..........
\incorrect
incorrect choice
\endmultiplechoice
\problem
problem statements
..........
..........
\endproblemset

Here we present the second example, Quiz 2.

\maximacode
  pick([list]) := block([i], i:random(length(list))+1, return(list[i]));
  round(x) := ?round(float(x));
\endmaximacode

\problemset
\problem
\maximacode
  x1: pick(-2,1,2,4);
  x2: x1 + pick(-5,6,7);
  y1: pick(-3,1,3,5);
  y2: y1 + pick(-3,-2,5);
\endmaximacode
If a linear function~$f$
satisfies \maxima f(x1) = y1 \endmaxima and \maxima f(x2) = y2 \endmaxima, find  $f(x)$.

\multiplechoice
\correct
\maxima expand(solve(y - y1 = (y1 - y2)/(x1 - x2)*(x - x1), y)[1]) \endmaxima
\incorrect
\maxima expand(solve(y + y1 = (y1 - y2)/(x1 - x2)*(x + x1), y)[1]) \endmaxima
\incorrect
\maxima expand(solve(y - y2 = y1/x1*(x - x2), y)[1]) \endmaxima
\incorrect
\maxima expand(solve(y + y2 = y1/x1*(x + x2), y)[1]) \endmaxima
\endmultiplechoice

\problem
\maximacode
  a: pick(-2,2,3);
  c: pick(-3,1,2,4);
  b: pick(-1,1) * round(sqrt(4*abs(a*c) + pick(1,3,4,7)));
\endmaximacode
Solve the equation \maxima ff: a*x^2 + b*x + c = 0 \endmaxima.

\multiplechoice
\correct
\maxima solve(ff,x) \endmaxima
\incorrect
\maxima solve(a * x^2 + b*x - c, x) \endmaxima
\incorrect
\maxima solve(a * x^2 - b*x + c, x) \endmaxima
\incorrect
\maxima solve(x^2 + b*x + c, x) \endmaxima
\endmultiplechoice

\endproblemset

The perl CGI script quiz.cgi will shuffle both problems and choices randomly, and create javascript-enabled LATEX file. Then latex2html processes it with the additional javascript qghtml.js



Department of Mathematics
Last modified: 2005-07-18