Commit 23fa860f by Victor Shnayder

Add test files to full test course

- I added them when playing with input types, but never merged them in
parent 5611fce3
<problem display_name="S3E2: Lorentz Force">
<startouttext/>
<p>Consider a hypothetical magnetic field pointing out of your computer screen. Now imagine an electron traveling from right to leftin the plane of your screen. A diagram of this situation is show below.</p>
<center><img width="400" src="/static/images/LSQimages/LSQ_W01_8.png"/></center>
<p>a. The magnitude of the force experienced by the electron is proportional the product of which of the following? (Select all that apply.)</p>
<endouttext/>
<choiceresponse>
<checkboxgroup>
<choice correct="true"><text>Magnetic field strength</text></choice>
<choice correct="false"><text>Electric field strength</text></choice>
<choice correct="true"><text>Electric charge of the electron</text></choice>
<choice correct="false"><text>Radius of the electron</text></choice>
<choice correct="false"><text>Mass of the electron</text></choice>
<choice correct="true"><text>Velocity of the electron</text></choice>
</checkboxgroup>
</choiceresponse>
<startouttext/>
<p>b. The direction of the force experienced by the electron is _______.</p>
<endouttext/>
<choiceresponse>
<checkboxgroup>
<choice correct="false"><text>up, in the plane of the screen.</text></choice>
<choice correct="true"><text>down, in the plane of the screen.</text></choice>
<choice correct="false"><text>into the plane of the screen.</text></choice>
<choice correct="false"><text>out of the plane of the screen.</text></choice>
<choice correct="false"><text>towards the right, in the plane of the screen.</text></choice>
<choice correct="false"><text>towards the left, in the plane of the screen.</text></choice>
</checkboxgroup>
</choiceresponse>
</problem>
<?xml version="1.0"?>
<problem display_name="L4 Problem 1">
<text>
<p>
<b class="bfseries">Part 1: Function Types</b>
</p>
<p>
For each of the following functions, specify the type of its <b class="bfseries">output</b>. You can assume each function is called with an appropriate argument, as specified by its docstring. </p>
<p>
If the output can be either an int or a float, select num, which isn't a real Python type, but which we'll use to indicate that either basic numeric type is legal. </p>
<p>
In fact, in Python, booleans True and False can be operated on as if they were the integers 1 and 0; but it is ugly and confusing to take advantage of this fact, and we will resolutely pretend that it isn't true. </p> <!-- so why even mention it? -->
<p>
<section class="hints">
<div class="collapsible">
<header>
<a href="#" id="id41">What are those lines under the function definitions?</a>
</header>
<section id="id41">
<p>
In this and future problems, you'll see function definitions that look like this: </p>
<pre>
def a(x):
'''
x: int or float.
'''
return x + 1
</pre>
<p>
What are those three lines between <code>def a(x):</code> and <code>return x + 1</code>? These lines are called the <i class="it">docstring</i> of the function. A docstring is a special type of comment that is used to document what your function is doing. Typically, docstrings will explain what the function expects the type(s) of the argument(s) to be, and what the function is returning. </p>
<p>
In Python, docstrings appear immediately after the <code>def</code> line of a function, before the body. Docstrings start and end with triple quotes - this can be triple single quotes or triple double quotes, it doesn't matter as long as they match. To sum up this general form: </p>
<pre>
def myFunction(argument):
"""
Docstring goes here. Explain what type argument(s) should have, and what your function
is going to return.
"""
&lt; Code for your function (the body of the function) goes here &gt;
</pre>
<p>
As you begin coding your own functions, we strongly encourage you to document all your functions by using properly-formatted docstrings! </p>
</section>
</div>
</section>
</p>
<ol class="enumerate">
<li>
<pre>
def a(x):
'''
x: int or float.
'''
return x + 1
</pre>
<p>
Indicate the type of the output that the function <code>a</code> will yield. <optionresponse><optioninput options="('NoneType','num','int','float','boolean')" correct="num"/></optionresponse> </p>
</li>
<li>
<pre>
def b(x):
'''
x: int or float.
'''
return x + 1.0
</pre>
<p>
Indicate the type of the output that the function <code>b</code> will yield. <optionresponse><optioninput options="('NoneType','num','int','float','boolean')" correct="float"/></optionresponse> </p>
</li>
<li>
<pre>
def c(x, y):
'''
x: int or float.
y: int or float.
'''
return x + y
</pre>
<p>
Indicate the type of the output that the function <code>c</code> will yield. <optionresponse><optioninput options="('NoneType','num','int','float','boolean')" correct="num"/></optionresponse> </p>
</li>
<li>
<pre>
def d(x, y):
'''
x: Can be of any type.
y: Can be of any type.
'''
return x &gt; y
</pre>
<p>
Indicate the type of the output that the function <code>d</code> will yield. <optionresponse><optioninput options="('NoneType','num','int','float','boolean')" correct="boolean"/></optionresponse> </p>
</li>
<li>
<pre>
def e(x, y, z):
'''
x: Can be of any type.
y: Can be of any type.
z: Can be of any type.
'''
return x &gt;= y and x &lt;= z
</pre>
<p>
Indicate the type of the output that the function <code>e</code> will yield. <optionresponse><optioninput options="('NoneType','num','int','float','boolean')" correct="boolean"/></optionresponse> </p>
</li>
<li>
<pre>
def f(x, y):
'''
x: int or float.
y: int or float
'''
x + y - 2
</pre>
<p>
Indicate the type of the output that the function <code>f</code> will yield. <optionresponse><optioninput options="('NoneType','num','int','float','boolean')" correct="NoneType"/></optionresponse> </p>
</li>
</ol>
<p>
<b class="bfseries">Part 2: Transcript</b>
</p>
<p>
Below is a transcript of a session with the Python shell. Assume the functions from Part 1 (above) have been defined. Provide the type and value of the expressions being evaluated. If evaluating an expression would cause an error, select NoneType and write 'error' in the box. If the value of an expression is a function, select function as the type and write 'function' in the box. </p>
<ol class="enumerate">
<li>
<p>
<code>a(6)</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="int"/>
</optionresponse>
<stringresponse answer="7">
<textline size="50"/>
</stringresponse>
</p>
</li>
<li>
<p>
<code>a(-5.3)</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="float"/>
</optionresponse>
<stringresponse answer="-4.3">
<textline size="50"/>
</stringresponse>
</p>
</li>
<li>
<p>
<code>a(a(a(6)))</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="int"/>
</optionresponse>
<stringresponse answer="9">
<textline size="50"/>
</stringresponse>
</p>
</li>
<li>
<p>
<code>c(a(1), b(1))</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="float"/>
</optionresponse>
<stringresponse answer="4.0">
<textline size="50"/>
</stringresponse>
</p>
</li>
<li>
<p>
<code>d('apple', 11.1)</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="boolean"/>
</optionresponse>
<stringresponse answer="True">
<textline size="50"/>
</stringresponse>
</p>
</li>
<li>
<p>
<code>e(a(3), b(4), c(3, 4))</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="boolean"/>
</optionresponse>
<stringresponse answer="False">
<textline size="50"/>
</stringresponse>
</p>
</li>
<li>
<p>
<code>f</code>
<optionresponse>
<optioninput options="('NoneType','num','int','float','boolean','function')" correct="function"/>
</optionresponse>
<stringresponse answer="function">
<textline size="50"/>
</stringresponse>
</p>
</li>
</ol>
</text>
</problem>
<problem display_name="S3E3: Deflection of a Proton">
<startouttext/>
<p>Suppose you were to pass a hydroge ion (H+) through an electric field and measure the deflection of the ion. How would its deflection compare to the deflection of an electron passed through the same electric field? </p>
<endouttext/>
<multiplechoiceresponse direction="vertical" randomize="yes">
<choicegroup type="MultipleChoice">
<choice location="random" correct="false" name="1"><text>The ion would deflect identically as both species have the same charge.</text></choice>
<choice location="random" correct="false" name="2"><text>The ion would deflect by an amount identical in magnitude but opposite in direction because the charges are of opposite sign but equal in magnitude.</text></choice>
<choice location="random" correct="false" name="3"><text>The deflection will be in the same direction but smaller in magnitude due to the larger mass of the ion.</text></choice>
<choice location="random" correct="true" name="4"><text>The deflection will be smaller in magnitude due to the increased mass of the ion, as well as in the opposite direction due to the opposite sign of the charge.</text></choice>
</choicegroup>
</multiplechoiceresponse>
</problem>
\ No newline at end of file
<problem display_name="S2E2: Hydrogen Combustion">
<text>
<p>Gaseous hydrogen can be reacted with gaseous oxygen in the presence of a flame to produce water vapor according to the following reaction:</p>
[mathjax] \text{ a } \text{H}_{2 } + \text{ b }\text{O}_{2 } = \text{ c }\text{H}_{2 }\text{O }[/mathjax]
<p>Balance the equation i.e., specify the values of <i> a, b, </i> and <i>c</i>. Use the lowest whole number coefficients.</p>
<p>a =</p>
<numericalresponse answer="2">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline correct_answer="2" math="1" />
</numericalresponse>
<p>b =
<numericalresponse answer="1">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline math="1" />
</numericalresponse> </p>
<p>c =
<numericalresponse answer="2">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline math="1" />
</numericalresponse> </p>
</text>
</problem>
<problem>
<text>
<p>Metallothermic production of zirconium (Zr) would involve the reaction of sodium (Na) with zirconium tetrachloride (ZrCl<sub>4</sub>).</p>
<p><b>(a)</b> Write a balanced chemical equation.</p>
<!-- chemformularesponse
[mathjax] \text{a ZrCl}_{4 } + \text{ b }\text{Na} -> \text{ c }\text{NaCl } + \text{ d } \text{Zr} [/mathjax]
ratio of (a, b, c, d) = (1, 4, 4, 1)
-->
<customresponse>
<chemicalequationinput size="50"/>
<answer type="loncapa/python">
if chemcalc.chemical_equations_equal(submission[0], 'ZrCl4 + 4 Na -&gt; 4 NaCl + Zr'):
correct = ['correct']
else:
correct = ['incorrect']
</answer>
</customresponse>
<p><b>(b)</b> Write the balanced chemical equation using lowest whole numbers.</p>
<!-- chemformularesponse
as above, with (a, b, c, d) = (1, 4, 4, 1)
-->
<customresponse>
<chemicalequationinput size="50"/>
<answer type="loncapa/python">
if chemcalc.chemical_equations_equal(submission[0], 'ZrCl4 + 4 Na -&gt; 4 NaCl + Zr', exact=True):
correct = ['correct']
else:
correct = ['incorrect']
</answer>
</customresponse>
<p><b>(c)</b> Calculate the amount of zirconium produced (in kg) if a reactor were charged with 111 kg [mathjaxinline]\text{ZrCl}_4[/mathjaxinline] and 11.1 kg [mathjaxinline]\text{Na}[/mathjaxinline].
<numericalresponse answer="11.0">
<responseparam type="tolerance" default="5%" name="tol" description="Numerical Tolerance" />
<textline math="1" />
</numericalresponse> </p>
<br/>
<solution>
<p><b>SOLUTION:</b></p>
<p><b>(b)</b>[mathjax] \text{ZrCl}_{4 } + \mathbf{4 }\text{Na} = \mathbf{4 }\text{NaCl } + \mathbf{1 } \text{Zr} [/mathjax] </p>
<p><b>(c)</b></p>
<p>[mathjaxinline]111\text{kg ZrCl}_4 = 111000/[91.22 + (4 \times 35.45)] = 476 \text{ moles ZrCl}_4[/mathjaxinline] </p>
<p>[mathjaxinline]11.1\text{ kg Na} = 11100/22.99 = 483\text{ moles C}[/mathjaxinline]</p>
<p>stoichiometry of reaction further dictates that on a molar basis there needs to be 4 x amount of [mathjaxinline]\text{Na}[/mathjaxinline] as there is [mathjaxinline]\text{ZrCl}_4[/mathjaxinline], but calculations show there to be a shortfall of [mathjaxinline]\text{Na}[/mathjaxinline] </p>
<p>[mathjaxinline]\therefore[/mathjaxinline] reaction yield is contrained by [mathjaxinline]\text{Na}[/mathjaxinline] present </p>
<p>stoichiometry of reaction further dictates that if [mathjaxinline]\text{Na}[/mathjaxinline] controls the yield, then the amount of [mathjaxinline]\text{Zr}[/mathjaxinline] produced = 1/4 x molar quantity of [mathjaxinline]\text{Na}[/mathjaxinline] = 1/4 x 483 moles = 121 </p>
[mathjaxinline]121 \text{ moles Zr} \times 91.22\text{ g / mol } \mathbf{= 11.0 \text{ kg Zr} }[/mathjaxinline]<br/>
</solution>
</text>
</problem>
<problem>
<choiceresponse>
<checkboxgroup>
<choice correct="false">
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Five.<endouttext />
</choice>
</checkboxgroup>
</choiceresponse>
<choiceresponse>
<checkboxgroup>
<choice correct="false">
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Five.<endouttext />
</choice>
</checkboxgroup>
</choiceresponse>
<choiceresponse>
<checkboxgroup>
<choice correct="false">
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Five.<endouttext />
</choice>
</checkboxgroup>
</choiceresponse>
</problem>
<problem>
<choiceresponse>
<radiogroup>
<choice correct="false">
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Five.<endouttext />
</choice>
</radiogroup>
</choiceresponse>
<choiceresponse>
<radiogroup>
<choice correct="false">
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="true">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Five.<endouttext />
</choice>
</radiogroup>
</choiceresponse>
</problem>
<problem>
<text>
<h2>Code response</h2>
<p>
</p>
<text>
Write a program to compute the square of a number
<coderesponse tests="repeat:2,generate">
<textbox rows="10" cols="70" mode="python"/>
<codeparam>
<initial_display>def square(x):</initial_display>
<answer_display>answer</answer_display>
<grader_payload>grader stuff</grader_payload>
</codeparam>
</coderesponse>
</text>
<text>
Write a program to compute the square of a number
<coderesponse tests="repeat:2,generate">
<textbox rows="10" cols="70" mode="python"/>
<codeparam>
<initial_display>def square(x):</initial_display>
<answer_display>answer</answer_display>
<grader_payload>grader stuff</grader_payload>
</codeparam>
</coderesponse>
</text>
</text>
</problem>
<problem>
<text>
<h2>Code response</h2>
<p>
</p>
<text>
Write a program to compute the square of a number
<coderesponse tests="repeat:2,generate">
<textbox rows="10" cols="70" mode="python"/>
<answer><![CDATA[
initial_display = """
def square(n):
"""
answer = """
def square(n):
return n**2
"""
preamble = """
import sys, time
"""
test_program = """
import random
import operator
def testSquare(n = None):
if n is None:
n = random.randint(2, 20)
print 'Test is: square(%d)'%n
return str(square(n))
def main():
f = os.fdopen(3,'w')
test = int(sys.argv[1])
rndlist = map(int,os.getenv('rndlist').split(','))
random.seed(rndlist[0])
if test == 1: f.write(testSquare(0))
elif test == 2: f.write(testSquare(1))
else: f.write(testSquare())
f.close()
main()
sys.exit(0)
"""
]]>
</answer>
</coderesponse>
</text>
<text>
Write a program to compute the cube of a number
<coderesponse tests="repeat:2,generate">
<textbox rows="10" cols="70" mode="python"/>
<answer><![CDATA[
initial_display = """
def cube(n):
"""
answer = """
def cube(n):
return n**3
"""
preamble = """
import sys, time
"""
test_program = """
import random
import operator
def testCube(n = None):
if n is None:
n = random.randint(2, 20)
print 'Test is: cube(%d)'%n
return str(cube(n))
def main():
f = os.fdopen(3,'w')
test = int(sys.argv[1])
rndlist = map(int,os.getenv('rndlist').split(','))
random.seed(rndlist[0])
if test == 1: f.write(testCube(0))
elif test == 2: f.write(testCube(1))
else: f.write(testCube())
f.close()
main()
sys.exit(0)
"""
]]>
</answer>
</coderesponse>
</text>
</text>
</problem>
<problem>
<script type="loncapa/python">
# from loncapa import *
x1 = 4 # lc_random(2,4,1)
y1 = 5 # lc_random(3,7,1)
x2 = 10 # lc_random(x1+1,9,1)
y2 = 20 # lc_random(y1+1,15,1)
m = (y2-y1)/(x2-x1)
b = y1 - m*x1
answer = "%s*x+%s" % (m,b)
answer = answer.replace('+-','-')
inverted_m = (x2-x1)/(y2-y1)
inverted_b = b
wrongans = "%s*x+%s" % (inverted_m,inverted_b)
wrongans = wrongans.replace('+-','-')
</script>
<text>
<p>Hints can be provided to students, based on the last response given, as well as the history of responses given. Here is an example of a hint produced by a Formula Response problem.</p>
<p>
What is the equation of the line which passess through ($x1,$y1) and
($x2,$y2)?</p>
<p>The correct answer is <tt>$answer</tt>. A common error is to invert the equation for the slope. Enter <tt>
$wrongans</tt> to see a hint.</p>
</text>
<formularesponse samples="x@-5:5#11" id="11" answer="$answer">
<responseparam description="Numerical Tolerance" type="tolerance" default="0.001" name="tol" />
<text>y = <textline size="25" /></text>
<hintgroup>
<formulahint samples="x@-5:5#11" answer="$wrongans" name="inversegrad">
</formulahint>
<hintpart on="inversegrad">
<text>You have inverted the slope in the question.</text>
</hintpart>
</hintgroup>
</formularesponse>
</problem>
<problem>
<text><p>
Two skiers are on frictionless black diamond ski slopes.
Hello</p></text>
<imageresponse max="1" loncapaid="11">
<imageinput src="/static/Physics801/Figures/Skier-conservation of energy.jpg" width="560" height="388" rectangle="(490,11)-(556,98)"/>
<text>Click on the image where the top skier will stop momentarily if the top skier starts from rest.</text>
<imageinput src="/static/Physics801/Figures/Skier-conservation of energy.jpg" width="560" height="388" rectangle="(242,202)-(296,276)"/>
<text>Click on the image where the lower skier will stop momentarily if the lower skier starts from rest.</text>
<imageinput src="/static/Physics801/Figures/Skier-conservation of energy.jpg" width="560" height="388" rectangle="(490,11)-(556,98);(242,202)-(296,276)"/>
<text>Click on either of the two positions as discussed previously.</text>
<imageinput src="/static/Physics801/Figures/Skier-conservation of energy.jpg" width="560" height="388" rectangle="(490,11)-(556,98);(242,202)-(296,276)"/>
<text>Click on either of the two positions as discussed previously.</text>
<imageinput src="/static/Physics801/Figures/Skier-conservation of energy.jpg" width="560" height="388" rectangle="(490,11)-(556,98);(242,202)-(296,276)"/>
<text>Click on either of the two positions as discussed previously.</text>
<hintgroup showoncorrect="no">
<text><p>Use conservation of energy.</p></text>
</hintgroup>
</imageresponse>
</problem>
<problem>
<javascriptresponse>
<generator src="test_problem_generator.js"/>
<grader src="test_problem_grader.js"/>
<display class="TestProblemDisplay" src="test_problem_display.js"/>
<responseparam name="value" value="4"/>
<javascriptinput>
</javascriptinput>
</javascriptresponse>
</problem>
<problem>
<multiplechoiceresponse>
<choicegroup>
<choice correct="false" >
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false" >
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true" >
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false">
<startouttext />This is foil Five.<endouttext />
</choice>
</choicegroup>
</multiplechoiceresponse>
</problem>
<problem>
<multiplechoiceresponse>
<choicegroup>
<choice correct="false" name="foil1">
<startouttext />This is foil One.<endouttext />
</choice>
<choice correct="false" name="foil2">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice correct="true" name="foil3">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice correct="false" name="foil4">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice correct="false" name="foil5">
<startouttext />This is foil Five.<endouttext />
</choice>
</choicegroup>
</multiplechoiceresponse>
</problem>
<problem display_name="S3E3: Deflection of a Proton">
<startouttext/>
<p>Suppose you were to pass a hydroge ion (H+) through an electric field and measure the deflection of the ion. How would its deflection compare to the deflection of an electron passed through the same electric field? </p>
<endouttext/>
<multiplechoiceresponse direction="vertical" randomize="yes">
<choicegroup type="MultipleChoice">
<choice location="random" correct="false" name="1"><text>The ion would deflect identically as both species have the same charge.</text></choice>
<choice location="random" correct="false" name="2"><text>The ion would deflect by an amount identical in magnitude but opposite in direction because the charges are of opposite sign but equal in magnitude.</text></choice>
<choice location="random" correct="false" name="3"><text>The deflection will be in the same direction but smaller in magnitude due to the larger mass of the ion.</text></choice>
<choice location="random" correct="true" name="4"><text>The deflection will be smaller in magnitude due to the increased mass of the ion, as well as in the opposite direction due to the opposite sign of the charge.</text></choice>
</choicegroup>
</multiplechoiceresponse>
</problem>
\ No newline at end of file
<problem display_name="S2E2: Hydrogen Combustion">
<text>
<p>Gaseous hydrogen can be reacted with gaseous oxygen in the presence of a flame to produce water vapor according to the following reaction:</p>
[mathjax] \text{ a } \text{H}_{2 } + \text{ b }\text{O}_{2 } = \text{ c }\text{H}_{2 }\text{O }[/mathjax]
<p>Balance the equation i.e., specify the values of <i> a, b, </i> and <i>c</i>. Use the lowest whole number coefficients.</p>
<p>a =</p>
<numericalresponse answer="2">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline correct_answer="2" math="1" />
</numericalresponse>
<p>b =
<numericalresponse answer="1">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline math="1" />
</numericalresponse> </p>
<p>c =
<numericalresponse answer="2">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline math="1" />
</numericalresponse> </p>
</text>
</problem>
<problem>
<text>
<p>
Why do bicycles benefit from having larger wheels when going up a bump as shown in the picture? <br/>
Assume that for both bicycles:<br/>
1.) The tires have equal air pressure.<br/>
2.) The bicycles never leave the contact with the bump.<br/>
3.) The bicycles have the same mass. The bicycle tires (regardless of size) have the same mass.<br/>
</p>
</text>
<optionresponse texlayout="horizontal" max="10" randomize="yes">
<ul>
<li>
<text>
<p>The bicycles with larger wheels have more time to go over the bump. This decreases the magnitude of the force needed to lift the bicycle.</p>
</text>
<optioninput name="Foil1" location="random" options="('True','False')" correct="True">
</optioninput>
</li>
<li>
<text>
<p>The bicycles with larger wheels always have a smaller vertical displacement regardless of speed.</p>
</text>
<optioninput name="Foil2" location="random" options="('True','False')" correct="False">
</optioninput>
</li>
<li>
<text>
<p>The bicycles with larger wheels experience a force backward with less magnitude for the same amount of time.</p>
</text>
<optioninput name="Foil3" location="random" options="('True','False')" correct="False">
</optioninput>
</li>
<li>
<text>
<p>The bicycles with larger wheels experience a force backward with less magnitude for a greater amount of time.</p>
</text>
<optioninput name="Foil4" location="random" options="('True','False')" correct="True">
</optioninput>
</li>
<li>
<text>
<p>The bicycles with larger wheels have more kinetic energy turned into gravitational potential energy.</p>
</text>
<optioninput name="Foil5" location="random" options="('True','False')" correct="False">
</optioninput>
</li>
<li>
<text>
<p>The bicycles with larger wheels have more rotational kinetic energy, so the horizontal velocity of the biker changes less.</p>
</text>
<optioninput name="Foil6" location="random" options="('True','False')" correct="False">
</optioninput>
</li>
</ul>
<hintgroup showoncorrect="no">
<text>
<br/>
<br/>
</text>
</hintgroup>
</optionresponse>
</problem>
<problem >
<text><h2>Example: String Response Problem</h2>
<br/>
</text>
<text>Which US state has Lansing as its capital?</text>
<stringresponse answer="Michigan" type="ci">
<textline size="20" />
<hintgroup>
<stringhint answer="wisconsin" type="cs" name="wisc">
</stringhint>
<stringhint answer="minnesota" type="cs" name="minn">
</stringhint>
<hintpart on="wisc">
<text>The state capital of Wisconsin is Madison.</text>
</hintpart>
<hintpart on="minn">
<text>The state capital of Minnesota is St. Paul.</text>
</hintpart>
<hintpart on="default">
<text>The state you are looking for is also known as the 'Great Lakes State'</text>
</hintpart>
</hintgroup>
</stringresponse>
</problem>
<problem>
<text>
<h2>Example: Symbolic Math Response Problem</h2>
<p>
A symbolic math response problem presents one or more symbolic math
input fields for input. Correctness of input is evaluated based on
the symbolic properties of the expression entered. The student enters
text, but sees a proper symbolic rendition of the entered formula, in
real time, next to the input box.
</p>
<p>This is a correct answer which may be entered below: </p>
<p><tt>cos(theta)*[[1,0],[0,1]] + i*sin(theta)*[[0,1],[1,0]]</tt></p>
<script>
from symmath import *
</script>
<text>Compute [mathjax] U = \exp\left( i \theta \left[ \begin{matrix} 0 &amp; 1 \\ 1 &amp; 0 \end{matrix} \right] \right) [/mathjax]
and give the resulting \(2 \times 2\) matrix. <br/>
Your input should be typed in as a list of lists, eg <tt>[[1,2],[3,4]]</tt>. <br/>
[mathjax]U=[/mathjax] <symbolicresponse cfn="symmath_check" answer="[[cos(theta),I*sin(theta)],[I*sin(theta),cos(theta)]]" options="matrix,imaginaryi" id="filenamedogi0VpEBOWedxsymmathresponse_1" state="unsubmitted">
<textline size="80" math="1" response_id="2" answer_id="1" id="filenamedogi0VpEBOWedxsymmathresponse_2_1"/>
</symbolicresponse>
<br/>
</text>
</text>
</problem>
<problem>
<truefalseresponse max="10" randomize="yes">
<choicegroup>
<choice location="random" correct="true" name="foil1">
<startouttext />This is foil One.<endouttext />
</choice>
<choice location="random" correct="true" name="foil2">
<startouttext />This is foil Two.<endouttext />
</choice>
<choice location="random" correct="false" name="foil3">
<startouttext />This is foil Three.<endouttext />
</choice>
<choice location="random" correct="false" name="foil4">
<startouttext />This is foil Four.<endouttext />
</choice>
<choice location="random" correct="false" name="foil5">
<startouttext />This is foil Five.<endouttext />
</choice>
</choicegroup>
</truefalseresponse>
</problem>
<vertical display_name="Test problems">
<problem url_name="test_files:numericalresponse_demo"/>
<problem url_name="test_files:choiceresponse_checkbox"/>
<problem url_name="test_files:choiceresponse_radio"/>
<problem url_name="test_files:coderesponse"/>
<problem url_name="test_files:coderesponse_externalresponseformat"/>
<problem url_name="test_files:formularesponse_with_hint"/>
<problem url_name="test_files:imageresponse"/>
<problem url_name="test_files:javascriptresponse"/>
<problem url_name="test_files:multi_bare"/>
<problem url_name="test_files:multichoice"/>
<problem url_name="test_files:multiplechoicelresponse_demo"/>
<problem url_name="test_files:numericalresponse_demo"/>
<problem url_name="test_files:optionresponse"/>
<problem url_name="test_files:stringresponse_with_hint"/>
<problem url_name="test_files:symbolicresponse"/>
<problem url_name="test_files:truefalse"/>
<problem url_name="test_files:chemicalequationresponse"/>
<problem url_name="test_files:filesubmission"/>
</vertical>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment