<?xml version="1.0" encoding="UTF-8"?>
<!-- Example question authored by the CTM team. Licensed under CC BY-SA 4.0. -->
<quiz>
  <question type="stack">
    <name>
      <text>Expand a product (form-sensitive)</text>
    </name>
    <questiontext format="html">
      <text>&lt;p&gt;Expand and collect like terms: \((x+{@a@})(x+{@b@})\).&lt;/p&gt;&lt;p&gt;Give your answer as a polynomial in \(x\). [[input:ans]] [[validation:ans]] [[feedback:prt1]]&lt;/p&gt;</text>
    </questiontext>
    <generalfeedback format="html">
      <text>&lt;p&gt;Multiply each term and collect: \(x^2+({@a@}+{@b@})x+{@a@}\cdot{@b@}={@ta@}\).&lt;/p&gt;&lt;p&gt;A factored expression has the same value, but this task asks for expanded form.&lt;/p&gt;</text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2021072200</text>
    </stackversion>
    <questionvariables>
      <text>a:rand(4)+2;
b:rand(3)+2;
ta:x^2+(a+b)*x+a*b;</text>
    </questionvariables>
    <specificfeedback format="html">
      <text>&lt;p&gt;[[feedback:prt1]]&lt;/p&gt;</text>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>Expansion: (x+a)(x+b) = ta</text>
    </questionnote>
    <questiondescription format="moodle_auto_format">
      <text/>
    </questiondescription>
    <questionsimplify>1</questionsimplify>
    <assumepositive>0</assumepositive>
    <assumereal>0</assumereal>
    <scientificnotation>*10</scientificnotation>
    <multiplicationsign>none</multiplicationsign>
    <sqrtsign>1</sqrtsign>
    <complexno>i</complexno>
    <inversetrig>cos-1</inversetrig>
    <logicsymbol>lang</logicsymbol>
    <matrixparens>[</matrixparens>
    <isbroken>0</isbroken>
    <variantsselectionseed/>
    <input>
      <name>ans</name>
      <type>algebraic</type>
      <tans>ta</tans>
      <boxsize>18</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>1</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>1</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>1</showvalidation>
      <options/>
    </input>
    <prt>
      <name>prt1</name>
      <value>1.0000000</value>
      <autosimplify>0</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>EqualComAss</answertest>
        <sans>ans</sans>
        <tans>ta</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt1-0-T</trueanswernote>
        <truefeedback format="html">
          <text>&lt;p&gt;Correct: the expression is expanded and collected.&lt;/p&gt;</text>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>1</falsenextnode>
        <falseanswernote>prt1-0-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans</sans>
        <tans>ta</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>0.5000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt1-1-T</trueanswernote>
        <truefeedback format="html">
          <text>&lt;p&gt;This is equivalent, but expand the product and collect like terms for full credit.&lt;/p&gt;</text>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt1-1-F</falseanswernote>
        <falsefeedback format="html">
          <text>&lt;p&gt;Check the middle term and constant term when you multiply the binomials.&lt;/p&gt;</text>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>17</deployedseed>
    <deployedseed>29</deployedseed>
    <deployedseed>47</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description>Expanded polynomial</description>
      <testinput>
        <name>ans</name>
        <value>ta</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt1-0-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>2</testcase>
      <description>Equivalent but still factored</description>
      <testinput>
        <name>ans</name>
        <value>(x+a)*(x+b)</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>0.5000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt1-0-F | prt1-1-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>3</testcase>
      <description>Incorrect middle coefficient</description>
      <testinput>
        <name>ans</name>
        <value>x^2+(a+b+1)*x+a*b</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt1-0-F | prt1-1-F</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
