[LON-CAPA-users] restricting incorrect answers in exam mode

Gerd Kortemeyer lon-capa-users@mail.lon-capa.org
Thu, 23 Mar 2006 20:37:49 -0500

Hi Nathan,

On Mar 23, 2006, at 6:15 PM, Felicia Berryman wrote:

>> I'd like to restrict the incorrect answers that LON-CAPA  
>> generates  for exam mode to a certain range, namely 0 to 1.  Is  
>> there a simple  way to do this?
> There is not built-in method with LON-CAPA where you can specify a  
> range for your wrong answers.  See http://bugs.loncapa.org/ 
> show_bug.cgi?id=2702.  You can however hard-code what answers  
> appear for your wrong answers.  Then you can specify the array of  
> wrong answers in the incorrect answer location.  There is also a  
> parameter for number of bubbles.  Make sure that the you specify at  
> least number-of-bubbles - 1 wrong answers.  The default is 8   
> bubbles in exam mode.

I have provided a few routines in


You'll need to include this library in your problem.

Then you can call


That will generate a "wrong" array with values between 0 and 1 in  
steps of 0.01 that miss the value $correct by 10 percent.


will generate wrong values between 3 and 15 missing $correct by  
absolute 0.5

That wrong array needs to be put into the <numericalresponse>  
incorrect location, as Felicia explains above.

If you want to include certain values, you can do


That way, you always have 0 and 1 as answers, as well as 5 additional  
wrong answers between 0.01 and 0.99 in steps of 0.01, but missing  
$correct by 10 percent.

- Gerd.