Math and Select&Order questions

Events happening in the community are now at Drupal community events on www.drupal.org.
HylkeVDS's picture

Here is an example of a combination of a Select&Order question that uses math to generate a "different" question for each student: http://wmmrc.wur.nl/drupal-modules/closedquestion/example-questions/sele...

In this question the student has to choose a set of dilutions for a sample so that the concentration of the substance he wants to measure falls in range of the measurement device for all three dilutions. The concentration is generated randomly for each student.

Here's the XML:

<?xml version="1.0" encoding="UTF-8"?>
<question type="PATTERN" duplicates="0">
  <matheval expression="a=random()" store="1" />
  <matheval expression="conc=round(250*a+1,0)" />
  <matheval expression="min=(conc/1.71)" />
  <matheval expression="max=(conc/0.57)" />

  <text>
    You have made the following calibration curve. You think your sample contains about
    <mathresult expression="nf(conc,0)" /> mg/ml. Which dilution(s) of your sample do you
    prepare for your measurement?<br/>
    <img src="[attachurl:1]"/>
  </text>

  <option identifier="a">
    <choice>1.0x</choice>
  </option>
  <option identifier="b">
    <choice>2.5x</choice>
  </option>
  <option identifier="c">
    <choice>5.0x</choice>
  </option>
  <option identifier="d">
    <choice>10.0x</choice>
  </option>
  <option identifier="e">
    <choice>25.0x</choice>
  </option>
  <option identifier="f">
    <choice>50.0x</choice>
  </option>
  <option identifier="g">
    <choice>100.0x</choice>
  </option>
  <option identifier="h">
    <choice>250.0x</choice>
  </option>
  <option identifier="i">
    <choice>500.0x</choice>
  </option>

<hint mintries="1">first hint</hint>

  <mapping correct="1">
    <match pattern="^([abc]{3}|[bcd]{3}|[cde]{3}|[def]{3}|[efg]{3}|[fgh]{3}|[ghi]{3})$" />
    <or>
      <and>
        <range minval="min" maxval="max" value="2.5" />
        <match pattern="b" />
      </and>
      <and>
        <range minval="min" maxval="max" value="5" />
        <match pattern="c" />
      </and>
      <and>
        <range minval="min" maxval="max" value="10" />
        <match pattern="d" />
      </and>
      <and>
        <range minval="min" maxval="max" value="25" />
        <match pattern="e" />
      </and>
      <and>
        <range minval="min" maxval="max" value="50" />
        <match pattern="f" />
      </and>
      <and>
        <range minval="min" maxval="max" value="100" />
        <match pattern="g" />
      </and>
      <and>
        <range minval="min" maxval="max" value="250" />
        <match pattern="h" />
      </and>
      <and>
        <range minval="min" maxval="max" value="500" />
        <match pattern="i" />
      </and>
    </or>
    <feedback>
      Correct. You selected three subsequent dilutions, at least one of which falls in the range of the measuring device.
    </feedback>
  </mapping>

  <mapping correct="0" stop="1">
    <match pattern="^.{0,2}$" />
    <feedback mintries="1">
      Only one or two dilutions is not a safe bet, If your estimate is off you'll end up with no data at all.
    </feedback>
  </mapping>
  <mapping correct="0" stop="1">
    <match pattern="^.{4,}$" />
    <feedback mintries="1">
      More than three dilutions is more than needed and gives you too much extra work.
    </feedback>
  </mapping>
  <mapping correct="0">
    <not><match pattern="^([abc]{3}|[bcd]{3}|[cde]{3}|[def]{3}|[efg]{3}|[fgh]{3}|[ghi]{3})$" /></not>
    <feedback mintries="1">
      It's best to select three consecutive dilutions, to maximise the chance of one of them being in range.
    </feedback>
  </mapping>

  <mapping correct="0">
    <match pattern=".*" />
    <feedback mintries="1">Nope, that't not correct. Try again.</feedback>
    <feedback mintries="2">Make sure at least one if your dilutions falls in the range where the measuring device is accurate.</feedback>
    <feedback mintries="3">It's best to make sure the middle dilution is most likely to fall in the correct range. If your estimate is off, then one of the other two will be in range.</feedback>
    <feedback mintries="4">From the graph you can see that the useful range is an absorbance between 0.2 and 1.1.</feedback>
    <feedback mintries="5">This means you need a dilution that gives a concentration between 0.6 and 1.7.</feedback>
    <feedback mintries="6">This means you need a dilution between <mathresult expression="nf(min,0)" /> and <mathresult expression="nf(max,0)" />.</feedback>
  </mapping>

</question>