<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>37.2.3.6 A terminal that requires attention</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p class="HELM_exercise">Exercise</p><p>A computer installation has {@n@} terminals. Independently, the probability that any one terminal
will require attention during a week is {@p@}. Find the probabilities that</p><ol class="HELM_parts">

<li><p>0 terminals will require attention during the next week: [[input:ans1]] [[validation:ans1]] [[feedback:prt1]]</p></li>

<li><p>1 terminal will require attention during the next week: [[input:ans2]] [[validation:ans2]] [[feedback:prt2]]</p></li>

<li><p>2 terminals will require attention during the next week: [[input:ans3]] [[validation:ans3]] [[feedback:prt3]]</p></li>

<li><p>3 or more terminals will require attention during the next week: [[input:ans4]] [[validation:ans4]] [[feedback:prt4]]</p></li>

</ol><p><b>Note:</b> please round your answer to \(4\) decimal places.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text><![CDATA[<p><b>SOLUTION:</b></p><p>As we suspect, this experiment follows a Binomial distribution&nbsp;\(\text{P} (X=r)=\&nbsp; ^n\!C_rp^r(1-p)^{n-r}\) where \(p\) is the probability that any one terminal will require attention during a week</p>
<ol class="HELM_parts">
  <li>\(\text{P} (X=0)=\  ^{{@n@}}\!C_0({@p@})^0(1-{@p@})^{@n@}=({@1-p@})^{@n@}={@ta_1@}\)</li>
  <li><p><span class="math display">\(\text{P} (X=1) =\&nbsp;^{{@n@}}\!C_1({@p@})^1(1-{@p@})^{@n-1@} = {@ta_2@}\)</span></p></li>
 <li><p><span class="math display">\( \text{P} (X=2) =\&nbsp;^{{@n@}}\!C_2({@p@})^2(1-{@p@})^{@n-2@} = {@ta_3@}\)</span></p></li>
  <li>\( \text{P} (X\ge 3)= 1 - \text{P}(X=0) - \text{P}(X=1) -&nbsp;\text{P}(X=2) =&nbsp;{@ta_4@}\)</li></ol>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2021072200</text>
    </stackversion>
    <questionvariables>
      <text>p: 0.1 + 0.1*rand(5);
n: 8 + rand(4);
ta_1_prev: pdf_binomial(0,n,p);
ta_1: decimalplaces(float(ta_1_prev),4);
ta_2_prev: pdf_binomial(1,n,p);
ta_2: decimalplaces(float(ta_2_prev),4);
ta_3_prev: pdf_binomial(2,n,p);
ta_3: decimalplaces(float(ta_3_prev),4);
ta_4_prev: 1 - ta_1_prev - ta_2_prev - ta_3_prev;
ta_4: decimalplaces(float(ta_4_prev),4);

/*Error due to compound rounding*/
ta_4_prev_bad: 1 - ta_1 - ta_2 - ta_3;   
ta_4_bad: decimalplaces(float(ta_4_prev_bad),4);</text>
    </questionvariables>
    <specificfeedback format="html">
      <text/>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>n: {@n@}, p: {@p@}, \(\text{P} (X=0)= {@ta_1@} \), \( \text{P}(X=1) = {@ta_2@} \), \( \text{P}(X=2) = {@ta_3@} \), \( \text{P} (X\ge 3)= {@ta_4@} \) rounding error: {@ta_4_bad@}</text>
    </questionnote>
    <questiondescription format="moodle_auto_format">
      <text/>
    </questiondescription>
    <questionsimplify>1</questionsimplify>
    <assumepositive>0</assumepositive>
    <assumereal>0</assumereal>
    <prtcorrect format="html">
      <text><![CDATA[<span style="font-size: 1.5em; color:green;"><i class="fa fa-check"></i></span> Correct answer, well done.]]></text>
    </prtcorrect>
    <prtpartiallycorrect format="html">
      <text><![CDATA[<span style="font-size: 1.5em; color:orange;"><i class="fa fa-adjust"></i></span> Your answer is partially correct.]]></text>
    </prtpartiallycorrect>
    <prtincorrect format="html">
      <text><![CDATA[<span style="font-size: 1.5em; color:red;"><i class="fa fa-times"></i></span> Incorrect answer.]]></text>
    </prtincorrect>
    <decimals>.</decimals>
    <scientificnotation>*10</scientificnotation>
    <multiplicationsign>dot</multiplicationsign>
    <sqrtsign>1</sqrtsign>
    <complexno>i</complexno>
    <inversetrig>cos-1</inversetrig>
    <logicsymbol>lang</logicsymbol>
    <matrixparens>[</matrixparens>
    <isbroken>0</isbroken>
    <variantsselectionseed/>
    <input>
      <name>ans1</name>
      <type>numerical</type>
      <tans>dispdp(ta_1,4)</tans>
      <boxsize>5</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint>to 4 d.p.</syntaxhint>
      <syntaxattribute>1</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>0</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options>maxdp:4, mindp:4</options>
    </input>
    <input>
      <name>ans2</name>
      <type>numerical</type>
      <tans>dispdp(ta_2,4)</tans>
      <boxsize>5</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint>to 4 d.p.</syntaxhint>
      <syntaxattribute>1</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>0</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options>maxdp:4, mindp:4</options>
    </input>
    <input>
      <name>ans3</name>
      <type>numerical</type>
      <tans>dispdp(ta_3,4)</tans>
      <boxsize>5</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint>to 4 d.p.</syntaxhint>
      <syntaxattribute>1</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>0</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options>maxdp:4, mindp:4</options>
    </input>
    <input>
      <name>ans4</name>
      <type>numerical</type>
      <tans>dispdp(ta_4,4)</tans>
      <boxsize>5</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint>to 4 d.p.</syntaxhint>
      <syntaxattribute>1</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>0</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options>maxdp:4, mindp:4</options>
    </input>
    <prt>
      <name>prt1</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>NumDecPlaces</answertest>
        <sans>ans1</sans>
        <tans>ta_1</tans>
        <testoptions>4</testoptions>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt1-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt1-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>prt2</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>NumDecPlaces</answertest>
        <sans>ans2</sans>
        <tans>ta_2</tans>
        <testoptions>4</testoptions>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt2-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt2-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>prt3</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>NumDecPlaces</answertest>
        <sans>ans3</sans>
        <tans>ta_3</tans>
        <testoptions>4</testoptions>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt3-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt3-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>prt4</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>NumDecPlaces</answertest>
        <sans>ans4</sans>
        <tans>ta_4</tans>
        <testoptions>4</testoptions>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt4-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>1</falsenextnode>
        <falseanswernote>prt4-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description/>
        <answertest>NumDecPlaces</answertest>
        <sans>ans4</sans>
        <tans>ta_4_bad</tans>
        <testoptions>4</testoptions>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt4-2-T</trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[<p dir="ltr" style="text-align: left;">Your answer may be numerically inaccurate due to compound rounding.</p>]]></text>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt4-2-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>1620845899</deployedseed>
    <deployedseed>1035612644</deployedseed>
    <deployedseed>762931416</deployedseed>
    <deployedseed>1394924828</deployedseed>
    <deployedseed>1605430901</deployedseed>
    <deployedseed>531541581</deployedseed>
    <deployedseed>168459431</deployedseed>
    <deployedseed>898583057</deployedseed>
    <deployedseed>173514124</deployedseed>
    <deployedseed>731574922</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ta_1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>ta_2</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>ta_3</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt1-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt2-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt3</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt3-1-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>2</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>dispdp(ev(ta_1+1.0752,simp),4)</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>dispdp(ev(ta_2+1.0752,simp),4)</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>dispdp(ev(ta_3+1.0752,simp),4)</value>
      </testinput>
      <testinput>
        <name>ans4</name>
        <value>dispdp(ev(ta_4+1.0752,simp),4)</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt1-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt2-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt3</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt3-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt4</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt4-2-F</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
