Ctadel: Programming Form Handlers

For the quiz CGI application, a list of questions and answers is sufficient:

get_questions := proc(
[
[       "Choose the correct statement (only one)",
        7 = "Hamlet said `to be or not to be'", % right answer must be first one
        3 = "Dirac said `to be or not to be'",
        4 = "Nixon said `Ich bin ein Berliner'",
        5 = "Clinton said `read my lips, no more taxes'",
        8 = ["Einstein said", {{c=E*m^2}}],
        2 = ["Pythagoras said", {{C^3=A^3+B^3}}]
],
[       ["What is the value of the partial derivative", html_center_math({{diff(f,x)}}),
        "where the graph of", f, "is", html_center(html_image("plot.cgi?"//html_query(["p"="true","s"="0.4","f"=f])))],
        4 = [diff(f,x),   html_ref("plot.cgi?"//html_query("f"=diff(f,x)), "Graph")],
        2 = [diff(1/f,x), html_ref("plot.cgi?"//html_query("f"=diff(1/f,x)), "Graph")],
        7 = [diff(-f,x),  html_ref("plot.cgi?"//html_query("f"=diff(-f,x)), "Graph")],
        6 = [diff(x*f,x), html_ref("plot.cgi?"//html_query("f"=diff(x*f,x)), "Graph")],
        1 = [diff(x+f,x), html_ref("plot.cgi?"//html_query("f"=diff(x+f,x)), "Graph")],
        3 = [diff(f^2,x), html_ref("plot.cgi?"//html_query("f"=diff(f^2,x)), "Graph")]
]
]
where f = random([x^2,x^3,x^(-2),sin(x),cos(x),log(x),exp(x)])
).

The display of questions and the grading of the answers is done automatically.

Next


File translated from TEX by TTH, version 2.21.
On 7 Oct 1999, 14:08.