Forum archive 2000-2006

Davide P. Cervone - New macros and examples for essay questions

Davide P. Cervone - New macros and examples for essay questions

by Arnold Pizer -
Number of replies: 0
inactiveTopicNew macros and examples for essay questions topic started 8/25/2006; 5:55:49 PM
last post 8/27/2006; 10:57:51 AM
userDavide P. Cervone - New macros and examples for essay questions  blueArrow
8/25/2006; 5:55:49 PM (reads: 269, responses: 5)
Recently I was asked about how to handle essay-type questions where the answer is graded by the professor (rather than WeBWorK) after the assignment is due. It turns out that this is non-trivial to do, so I put together a macro package that should help.

You can find the file and an example at
The .pl file contains some documentation, so look there for details.

This is how it works: the students get a type-in area where they can enter their answer and submit it. They are told that the professor will grade the problem after the due date. When the set has closed, the professor can act as a student to view his or her response. The problem will also display a new type-in area (not available to the student) where the professor can enter the score for the essay. Submitting the answers will record the score.

After the problem is graded, the student can view the score either in the problem list for the homework set (where the scores for all problems are shown) or by viewing the particular problem.

All of this is possible without changes to WeBWorK, but you will need to change the values of some of the permission levels in global.conf (or in a course's course.conf file). This is because the default setting is to NOT allow professors to submit answers after the due date, so that would prevent the professor from saving the grades. (See the comments in the .pl file for details.)

Another setting that you might want to change is the one that controls whether previous answers are shown for students after the due date. This is off by default (so the students can go back and redo the problems for review without seeing their previous solutions), but this also means they would not see their essays and scores when they view the page after it is graded. Alternatively, you can tell the students to check the "show saved answers" box in the options panel at the left in order to see their essay.

In the long run, it would be nice for the professor to have "next student" and "previous student" buttons to make it easier to go from one student to the next, but that would either require changes to WeBWorK (or at least a new module), or the use of a data file that contains the student ids, which would have to be generated before the professor grades the problems.

Anyway, some of you might find this useful, so check it out.

<| Post or View Comments |>

userMichael Gage - Re: New macros and examples for essay questions  blueArrow
8/25/2006; 8:06:03 PM (reads: 317, responses: 0)

Just for reference, in case someone goes further with this, the module -- never completed, is also an attempt in this direction. It might be a useful to have that code as reference in designing a module to accomplish grading essay questions.

The preflight module was a response to a request to have the student's answer saved to a file in the database or on the disk (or just in the lastAnswer facility that already exists in WeBWorK) and then providing an instructor interface for quickly browsing the answers in order to grade them.

The original request was to allow multiple choice questions followed by an essay question. The instructor would be able to select and browse the essay questions based on responses to the multiple choice question.


What is a derivative? Explain your answer

    1. The slope of the graph of the function
2. Bring down the exponent and subtract one
3. A way to get rich quick

Explanation here:

By making this due shortly before class an instructor would have an idea of which concepts the students were clear on and which ones needed more explanation.

I'd love to have a unit that did this nicely. I already have an example problem that allows a student to enter primitive tex in the explanation box and have it previewed.

-- Unfortunately none of this is available at the moment so your macro file is really welcome.

-- Mike

<| Post or View Comments |>

userDavide P. Cervone - Re: New macros and examples for essay questions  blueArrow
8/25/2006; 8:41:21 PM (reads: 303, responses: 0)
The macros that I prepared can be used in combination with other types of questions, like your multiple choice question, so the grading of it could be put off just like any other question. (The essay_cmp() checker doesn't look at the data that it is the checker for, so it could be anything.)

You can also use multiple essay questions in one file, so both questions could be marked as "essay" questions, and so graded later by the professor. The only caveat is that with the package as it now stands, each part would need to receive its own grade. It would be possible to give only one grade for the whole problem, but I don't have it set up for that. It might be possible to use the weighted grader that is in the Union macros directory to overcome this deficiency, however, by allowing one part to hold all the points in the problem. I'll check it out and see.

I already posted a means of saving student data to files (though it is a hack) so that it could be read into a later problem. It would not be hard to make a special "master" problem that read all that data in to give a professor a more global view of the answers.

As for the TeX and preview, I think that can be worked out, too. Let me give some things a try... (And here I thought I was done with this one for now :-)


<| Post or View Comments |>

userMichael Gage - Re: New macros and examples for essay questions  blueArrow
8/25/2006; 9:43:21 PM (reads: 303, responses: 1)
For reference here is the hack I came up with -- the grading portion of the problem was not yet operational, but you've solved that.

-- Mike

$inputs_ref->{myAnswer} =~ s/~~~~/~~~~~~~~/g; #hack to handle backslashes
my($name,$row,$col) = @_;
my $essay_name = "${name}_ESSAY_BOX";
$row = 10 unless defined($row);
$col = 80 unless defined($col);
$essay_name = RECORD_FORM_LABEL($essay_name);
my $len = 0.07*$col;
my $height = .07*$row;
my $answer_value = '';
$answer_value = $inputs_ref->{$essay_name} if defined( $inputs_ref->{$essay_name} );
$answer_value =~ tr/$@`//d; ## make sure student answers can not be interpolated by e.g. EV3
my $print_string = $answer_value ||'';
$print_string =~ s/+/\/g; # prevent weirdness with backslashes
$answer_value =~ s/+//g;
my $out = M3(
qq!vskip $height in hrulefillquad !,
qq!begin{rawhtml}<TEXTAREA NAME="${essay_name}" ROWS="$row" COLS="$col"
qq!<TEXTAREA NAME="$essay_name" ROWS="$row" COLS="$col"
$out = "$HR Answer: $BR". $out;
$out = $out. EV3($BR,"Typeset version of answer:", $BR,$print_string, $HR) if $print_string;
$out.= NAMED_ANS_RULE($name, 10);

$showPartialCorrectAnswers = 0;
Let (R ) be a collection of subsets of (X) with the property that
the intersection of any two elements (A) and (B) of (R) is the union
of elements of (R). ( A cap B = cup I_alpha ) where (I_alphain R).

Statement: $PAR The collection of sets (S) which consists of all elements
of (R) and all unions of elements of (R) is a topology.

Show that the statement is true, or supply a counter-example. You can also modify the statement if it's almost true.


TEXT($PAR,NAMED_TEX_BOX('myAnswer',20, 80));


TEXT("$HR This statement is ",ans_radio_buttons(T=>'true',F=>'false',NT=>'nearly true','%d'=>"don't know yet"));

ENDDOCUMENT(); # This should be the last executable line in the problem.

<| Post or View Comments |>

userDavide P. Cervone - Re: New macros and examples for essay questions  blueArrow
8/25/2006; 10:17:15 PM (reads: 342, responses: 0)
Your preview method was basically what I had in mind as well.

I have produced two versions of the derivative example problem that you suggested above: one that allows the professor to give a separate score for each part, and one that uses a single score for both parts.

See and in the answerEssay directory that I linked to above.


<| Post or View Comments |>

userDavide P. Cervone - Re: New macros and examples for essay questions  blueArrow
8/27/2006; 10:57:51 AM (reads: 287, responses: 0)
Well, I spent all of yesterday making some enhancements to the essay answer macros, and there are a number of new features and new examples at the location listed above.

Some of the new features include the ability to have the professor include comments to the student in addition to the grade, and the ability to have a student answer that can include mathematics (when the student submits or checks the answer, it will be typeset and displayed so he or she can preview it to make sure the layout is what is desired).

There is also a new feature for adding navigation links to the problem to move more easily from one student to the next when grading essay problems. This is implemented in one of two ways: either a modification to the system is required, or the professor must supply a special file that lists the ID's of the students assigned to the set. See the comments in for details. The library will work with either method (so the problem doesn't have to be changed), but one of the two needs to be done.


<| Post or View Comments |>