From 23fa860f2aef6c035ab694ef1dba19dad7ea9401 Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Tue, 13 Nov 2012 10:47:42 -0500 Subject: [PATCH] Add test files to full test course - I added them when playing with input types, but never merged them in --- .../data/full/problem/choiceresponse_demo.xml | 37 ++++ .../test/data/full/problem/codeinput_demo.xml | 205 ++++++++++++++++++ .../problem/multiplechoicelresponse_demo.xml | 17 ++ .../full/problem/numericalresponse_demo.xml | 31 +++ .../test_files/chemicalformularesponse.xml | 64 ++++++ .../test_files/choiceresponse_checkbox.xml | 59 +++++ .../test_files/choiceresponse_radio.xml | 40 ++++ .../full/problem/test_files/coderesponse.xml | 33 +++ .../coderesponse_externalresponseformat.xml | 101 +++++++++ .../test_files/formularesponse_with_hint.xml | 45 ++++ .../full/problem/test_files/imageresponse.xml | 21 ++ .../problem/test_files/javascriptresponse.xml | 13 ++ .../full/problem/test_files/multi_bare.xml | 21 ++ .../full/problem/test_files/multichoice.xml | 21 ++ .../multiplechoicelresponse_demo.xml | 17 ++ .../test_files/numericalresponse_demo.xml | 31 +++ .../problem/test_files/optionresponse.xml | 63 ++++++ .../test_files/stringresponse_with_hint.xml | 25 +++ .../problem/test_files/symbolicresponse.xml | 29 +++ .../full/problem/test_files/truefalse.xml | 21 ++ .../test/data/full/vertical/test_problems.xml | 20 ++ 21 files changed, 914 insertions(+) create mode 100644 common/test/data/full/problem/choiceresponse_demo.xml create mode 100644 common/test/data/full/problem/codeinput_demo.xml create mode 100644 common/test/data/full/problem/multiplechoicelresponse_demo.xml create mode 100644 common/test/data/full/problem/numericalresponse_demo.xml create mode 100644 common/test/data/full/problem/test_files/chemicalformularesponse.xml create mode 100644 common/test/data/full/problem/test_files/choiceresponse_checkbox.xml create mode 100644 common/test/data/full/problem/test_files/choiceresponse_radio.xml create mode 100644 common/test/data/full/problem/test_files/coderesponse.xml create mode 100644 common/test/data/full/problem/test_files/coderesponse_externalresponseformat.xml create mode 100644 common/test/data/full/problem/test_files/formularesponse_with_hint.xml create mode 100644 common/test/data/full/problem/test_files/imageresponse.xml create mode 100644 common/test/data/full/problem/test_files/javascriptresponse.xml create mode 100644 common/test/data/full/problem/test_files/multi_bare.xml create mode 100644 common/test/data/full/problem/test_files/multichoice.xml create mode 100644 common/test/data/full/problem/test_files/multiplechoicelresponse_demo.xml create mode 100644 common/test/data/full/problem/test_files/numericalresponse_demo.xml create mode 100644 common/test/data/full/problem/test_files/optionresponse.xml create mode 100644 common/test/data/full/problem/test_files/stringresponse_with_hint.xml create mode 100644 common/test/data/full/problem/test_files/symbolicresponse.xml create mode 100644 common/test/data/full/problem/test_files/truefalse.xml create mode 100644 common/test/data/full/vertical/test_problems.xml diff --git a/common/test/data/full/problem/choiceresponse_demo.xml b/common/test/data/full/problem/choiceresponse_demo.xml new file mode 100644 index 0000000000..f7d1fcf16c --- /dev/null +++ b/common/test/data/full/problem/choiceresponse_demo.xml @@ -0,0 +1,37 @@ + + + +

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.

+
+ +

a. The magnitude of the force experienced by the electron is proportional the product of which of the following? (Select all that apply.)

+ + + +Magnetic field strength +Electric field strength +Electric charge of the electron +Radius of the electron +Mass of the electron +Velocity of the electron + + + + + +

b. The direction of the force experienced by the electron is _______.

+ + + +up, in the plane of the screen. +down, in the plane of the screen. +into the plane of the screen. +out of the plane of the screen. +towards the right, in the plane of the screen. +towards the left, in the plane of the screen. + + + + + +
diff --git a/common/test/data/full/problem/codeinput_demo.xml b/common/test/data/full/problem/codeinput_demo.xml new file mode 100644 index 0000000000..03d8fd8c31 --- /dev/null +++ b/common/test/data/full/problem/codeinput_demo.xml @@ -0,0 +1,205 @@ + + + +

+ Part 1: Function Types +

+

+For each of the following functions, specify the type of its output. You can assume each function is called with an appropriate argument, as specified by its docstring.

+

+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.

+

+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.

+

+

+
+
+ What are those lines under the function definitions? +
+
+

+In this and future problems, you'll see function definitions that look like this:

+
+def a(x):
+   '''
+   x: int or float.
+   '''
+   return x + 1
+
+

+What are those three lines between def a(x): and return x + 1? These lines are called the docstring 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.

+

+In Python, docstrings appear immediately after the def 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:

+
+def myFunction(argument):
+   """
+   Docstring goes here. Explain what type argument(s) should have, and what your function
+   is going to return.
+   """
+   < Code for your function (the body of the function) goes here >
+
+

+As you begin coding your own functions, we strongly encourage you to document all your functions by using properly-formatted docstrings!

+
+
+
+

+
    +
  1. +
    +def a(x):
    +   '''
    +   x: int or float.
    +   '''
    +   return x + 1
    + 
    +

    + Indicate the type of the output that the function a will yield.

    +
  2. +
  3. +
    +def b(x):
    +   '''
    +   x: int or float.
    +   '''
    +   return x + 1.0
    + 
    +

    + Indicate the type of the output that the function b will yield.

    +
  4. +
  5. +
    +def c(x, y):
    +   '''
    +   x: int or float. 
    +   y: int or float.
    +   '''
    +   return x + y
    + 
    +

    + Indicate the type of the output that the function c will yield.

    +
  6. +
  7. +
    +def d(x, y):
    +   '''
    +   x: Can be of any type.
    +   y: Can be of any type.
    +   '''
    +   return x > y
    + 
    +

    + Indicate the type of the output that the function d will yield.

    +
  8. +
  9. +
    +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 >= y and x <= z
    + 
    +

    + Indicate the type of the output that the function e will yield.

    +
  10. +
  11. +
    +def f(x, y):
    +   '''
    +   x: int or float.
    +   y: int or float
    +   '''
    +   x + y - 2
    + 
    +

    + Indicate the type of the output that the function f will yield.

    +
  12. +
+

+ Part 2: Transcript +

+

+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.

+
    +
  1. +

    + a(6) + + + + + + +

    +
  2. +
  3. +

    + a(-5.3) + + + + + + +

    +
  4. +
  5. +

    + a(a(a(6))) + + + + + + +

    +
  6. +
  7. +

    + c(a(1), b(1)) + + + + + + +

    +
  8. +
  9. +

    + d('apple', 11.1) + + + + + + +

    +
  10. +
  11. +

    + e(a(3), b(4), c(3, 4)) + + + + + + +

    +
  12. +
  13. +

    + f + + + + + + +

    +
  14. +
+
+
diff --git a/common/test/data/full/problem/multiplechoicelresponse_demo.xml b/common/test/data/full/problem/multiplechoicelresponse_demo.xml new file mode 100644 index 0000000000..b3e89a39e3 --- /dev/null +++ b/common/test/data/full/problem/multiplechoicelresponse_demo.xml @@ -0,0 +1,17 @@ + + +

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?

+ + + + + + The ion would deflect identically as both species have the same charge. + 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. + The deflection will be in the same direction but smaller in magnitude due to the larger mass of the ion. + 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. + + + + +
\ No newline at end of file diff --git a/common/test/data/full/problem/numericalresponse_demo.xml b/common/test/data/full/problem/numericalresponse_demo.xml new file mode 100644 index 0000000000..629b56edfd --- /dev/null +++ b/common/test/data/full/problem/numericalresponse_demo.xml @@ -0,0 +1,31 @@ + + + +

Gaseous hydrogen can be reacted with gaseous oxygen in the presence of a flame to produce water vapor according to the following reaction:

+ [mathjax] \text{ a } \text{H}_{2 } + \text{ b }\text{O}_{2 } = \text{ c }\text{H}_{2 }\text{O }[/mathjax] +

Balance the equation i.e., specify the values of a, b, and c. Use the lowest whole number coefficients.

+ +

a =

+ + + + + + +

b = + + + +

+ +

c = + + + +

+ + +
+
+ + diff --git a/common/test/data/full/problem/test_files/chemicalformularesponse.xml b/common/test/data/full/problem/test_files/chemicalformularesponse.xml new file mode 100644 index 0000000000..28591013f5 --- /dev/null +++ b/common/test/data/full/problem/test_files/chemicalformularesponse.xml @@ -0,0 +1,64 @@ + + +

Metallothermic production of zirconium (Zr) would involve the reaction of sodium (Na) with zirconium tetrachloride (ZrCl4).

+ +

(a) Write a balanced chemical equation.

+ + + + + + + +if chemcalc.chemical_equations_equal(submission[0], 'ZrCl4 + 4 Na -> 4 NaCl + Zr'): + correct = ['correct'] +else: + correct = ['incorrect'] + + + + +

(b) Write the balanced chemical equation using lowest whole numbers.

+ + + + + + + +if chemcalc.chemical_equations_equal(submission[0], 'ZrCl4 + 4 Na -> 4 NaCl + Zr', exact=True): + correct = ['correct'] +else: + correct = ['incorrect'] + + + + + + +

(c) 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]. + + + +

+
+ +

SOLUTION:

+

(b)[mathjax] \text{ZrCl}_{4 } + \mathbf{4 }\text{Na} = \mathbf{4 }\text{NaCl } + \mathbf{1 } \text{Zr} [/mathjax]

+

(c)

+

[mathjaxinline]111\text{kg ZrCl}_4 = 111000/[91.22 + (4 \times 35.45)] = 476 \text{ moles ZrCl}_4[/mathjaxinline]

+

[mathjaxinline]11.1\text{ kg Na} = 11100/22.99 = 483\text{ moles C}[/mathjaxinline]

+

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]

+

[mathjaxinline]\therefore[/mathjaxinline] reaction yield is contrained by [mathjaxinline]\text{Na}[/mathjaxinline] present

+

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

+ [mathjaxinline]121 \text{ moles Zr} \times 91.22\text{ g / mol } \mathbf{= 11.0 \text{ kg Zr} }[/mathjaxinline]
+
+
+
+ + diff --git a/common/test/data/full/problem/test_files/choiceresponse_checkbox.xml b/common/test/data/full/problem/test_files/choiceresponse_checkbox.xml new file mode 100644 index 0000000000..c087266d04 --- /dev/null +++ b/common/test/data/full/problem/test_files/choiceresponse_checkbox.xml @@ -0,0 +1,59 @@ + + + + + This is foil One. + + + This is foil Two. + + + This is foil Three. + + + This is foil Four. + + + This is foil Five. + + + + + + + This is foil One. + + + This is foil Two. + + + This is foil Three. + + + This is foil Four. + + + This is foil Five. + + + + + + + This is foil One. + + + This is foil Two. + + + This is foil Three. + + + This is foil Four. + + + This is foil Five. + + + + diff --git a/common/test/data/full/problem/test_files/choiceresponse_radio.xml b/common/test/data/full/problem/test_files/choiceresponse_radio.xml new file mode 100644 index 0000000000..a85d663b2b --- /dev/null +++ b/common/test/data/full/problem/test_files/choiceresponse_radio.xml @@ -0,0 +1,40 @@ + + + + + This is foil One. + + + This is foil Two. + + + This is foil Three. + + + This is foil Four. + + + This is foil Five. + + + + + + + This is foil One. + + + This is foil Two. + + + This is foil Three. + + + This is foil Four. + + + This is foil Five. + + + + diff --git a/common/test/data/full/problem/test_files/coderesponse.xml b/common/test/data/full/problem/test_files/coderesponse.xml new file mode 100644 index 0000000000..1c0bf8d4e6 --- /dev/null +++ b/common/test/data/full/problem/test_files/coderesponse.xml @@ -0,0 +1,33 @@ + + +

Code response

+ +

+

+ + +Write a program to compute the square of a number + + + + def square(x): + answer + grader stuff + + + + + +Write a program to compute the square of a number + + + + def square(x): + answer + grader stuff + + + + +
+
diff --git a/common/test/data/full/problem/test_files/coderesponse_externalresponseformat.xml b/common/test/data/full/problem/test_files/coderesponse_externalresponseformat.xml new file mode 100644 index 0000000000..42b6e0a54a --- /dev/null +++ b/common/test/data/full/problem/test_files/coderesponse_externalresponseformat.xml @@ -0,0 +1,101 @@ + + +

Code response

+ +

+

+ + +Write a program to compute the square of a number + + + + + + + + +Write a program to compute the cube of a number + + + + + + + +
+
diff --git a/common/test/data/full/problem/test_files/formularesponse_with_hint.xml b/common/test/data/full/problem/test_files/formularesponse_with_hint.xml new file mode 100644 index 0000000000..90248dcf04 --- /dev/null +++ b/common/test/data/full/problem/test_files/formularesponse_with_hint.xml @@ -0,0 +1,45 @@ + + + + +

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.

+ +

+What is the equation of the line which passess through ($x1,$y1) and +($x2,$y2)?

+ +

The correct answer is $answer. A common error is to invert the equation for the slope. Enter +$wrongans to see a hint.

+ +
+ + + + y = + + + + + You have inverted the slope in the question. + + + +
+ diff --git a/common/test/data/full/problem/test_files/imageresponse.xml b/common/test/data/full/problem/test_files/imageresponse.xml new file mode 100644 index 0000000000..34dba37e3b --- /dev/null +++ b/common/test/data/full/problem/test_files/imageresponse.xml @@ -0,0 +1,21 @@ + +

+Two skiers are on frictionless black diamond ski slopes. +Hello

+ + + +Click on the image where the top skier will stop momentarily if the top skier starts from rest. + +Click on the image where the lower skier will stop momentarily if the lower skier starts from rest. + +Click on either of the two positions as discussed previously. + +Click on either of the two positions as discussed previously. + +Click on either of the two positions as discussed previously. + +

Use conservation of energy.

+
+
+
diff --git a/common/test/data/full/problem/test_files/javascriptresponse.xml b/common/test/data/full/problem/test_files/javascriptresponse.xml new file mode 100644 index 0000000000..439866e62c --- /dev/null +++ b/common/test/data/full/problem/test_files/javascriptresponse.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/common/test/data/full/problem/test_files/multi_bare.xml b/common/test/data/full/problem/test_files/multi_bare.xml new file mode 100644 index 0000000000..20bc8f853d --- /dev/null +++ b/common/test/data/full/problem/test_files/multi_bare.xml @@ -0,0 +1,21 @@ + + + + + This is foil One. + + + This is foil Two. + + + This is foil Three. + + + This is foil Four. + + + This is foil Five. + + + + diff --git a/common/test/data/full/problem/test_files/multichoice.xml b/common/test/data/full/problem/test_files/multichoice.xml new file mode 100644 index 0000000000..60bf02ec59 --- /dev/null +++ b/common/test/data/full/problem/test_files/multichoice.xml @@ -0,0 +1,21 @@ + + + + + This is foil One. + + + This is foil Two. + + + This is foil Three. + + + This is foil Four. + + + This is foil Five. + + + + diff --git a/common/test/data/full/problem/test_files/multiplechoicelresponse_demo.xml b/common/test/data/full/problem/test_files/multiplechoicelresponse_demo.xml new file mode 100644 index 0000000000..b3e89a39e3 --- /dev/null +++ b/common/test/data/full/problem/test_files/multiplechoicelresponse_demo.xml @@ -0,0 +1,17 @@ + + +

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?

+ + + + + + The ion would deflect identically as both species have the same charge. + 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. + The deflection will be in the same direction but smaller in magnitude due to the larger mass of the ion. + 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. + + + + +
\ No newline at end of file diff --git a/common/test/data/full/problem/test_files/numericalresponse_demo.xml b/common/test/data/full/problem/test_files/numericalresponse_demo.xml new file mode 100644 index 0000000000..629b56edfd --- /dev/null +++ b/common/test/data/full/problem/test_files/numericalresponse_demo.xml @@ -0,0 +1,31 @@ + + + +

Gaseous hydrogen can be reacted with gaseous oxygen in the presence of a flame to produce water vapor according to the following reaction:

+ [mathjax] \text{ a } \text{H}_{2 } + \text{ b }\text{O}_{2 } = \text{ c }\text{H}_{2 }\text{O }[/mathjax] +

Balance the equation i.e., specify the values of a, b, and c. Use the lowest whole number coefficients.

+ +

a =

+ + + + + + +

b = + + + +

+ +

c = + + + +

+ + +
+
+ + diff --git a/common/test/data/full/problem/test_files/optionresponse.xml b/common/test/data/full/problem/test_files/optionresponse.xml new file mode 100644 index 0000000000..99a17e8fac --- /dev/null +++ b/common/test/data/full/problem/test_files/optionresponse.xml @@ -0,0 +1,63 @@ + + +

+Why do bicycles benefit from having larger wheels when going up a bump as shown in the picture?
+Assume that for both bicycles:
+1.) The tires have equal air pressure.
+2.) The bicycles never leave the contact with the bump.
+3.) The bicycles have the same mass. The bicycle tires (regardless of size) have the same mass.
+

+
+ +
    +
  • + +

    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.

    +
    + + +
  • +
  • + +

    The bicycles with larger wheels always have a smaller vertical displacement regardless of speed.

    +
    + + +
  • +
  • + +

    The bicycles with larger wheels experience a force backward with less magnitude for the same amount of time.

    +
    + + +
  • +
  • + +

    The bicycles with larger wheels experience a force backward with less magnitude for a greater amount of time.

    +
    + + +
  • +
  • + +

    The bicycles with larger wheels have more kinetic energy turned into gravitational potential energy.

    +
    + + +
  • +
  • + +

    The bicycles with larger wheels have more rotational kinetic energy, so the horizontal velocity of the biker changes less.

    +
    + + +
  • +
+ + +
+
+
+
+
+
diff --git a/common/test/data/full/problem/test_files/stringresponse_with_hint.xml b/common/test/data/full/problem/test_files/stringresponse_with_hint.xml new file mode 100644 index 0000000000..86efdf0f18 --- /dev/null +++ b/common/test/data/full/problem/test_files/stringresponse_with_hint.xml @@ -0,0 +1,25 @@ + +

Example: String Response Problem

+
+
+ + Which US state has Lansing as its capital? + + + + + + + + + The state capital of Wisconsin is Madison. + + + The state capital of Minnesota is St. Paul. + + + The state you are looking for is also known as the 'Great Lakes State' + + + +
diff --git a/common/test/data/full/problem/test_files/symbolicresponse.xml b/common/test/data/full/problem/test_files/symbolicresponse.xml new file mode 100644 index 0000000000..4dc2bc9d7b --- /dev/null +++ b/common/test/data/full/problem/test_files/symbolicresponse.xml @@ -0,0 +1,29 @@ + + +

Example: Symbolic Math Response Problem

+ +

+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. +

+ +

This is a correct answer which may be entered below:

+

cos(theta)*[[1,0],[0,1]] + i*sin(theta)*[[0,1],[1,0]]

+ + + Compute [mathjax] U = \exp\left( i \theta \left[ \begin{matrix} 0 & 1 \\ 1 & 0 \end{matrix} \right] \right) [/mathjax] + and give the resulting \(2 \times 2\) matrix.
+ Your input should be typed in as a list of lists, eg [[1,2],[3,4]].
+ [mathjax]U=[/mathjax] + + +
+
+ +
+
diff --git a/common/test/data/full/problem/test_files/truefalse.xml b/common/test/data/full/problem/test_files/truefalse.xml new file mode 100644 index 0000000000..60018f7a2d --- /dev/null +++ b/common/test/data/full/problem/test_files/truefalse.xml @@ -0,0 +1,21 @@ + + + + + This is foil One. + + + This is foil Two. + + + This is foil Three. + + + This is foil Four. + + + This is foil Five. + + + + diff --git a/common/test/data/full/vertical/test_problems.xml b/common/test/data/full/vertical/test_problems.xml new file mode 100644 index 0000000000..6cdc7977d9 --- /dev/null +++ b/common/test/data/full/vertical/test_problems.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file