计算题

来自MoodleDocs
stephen Liu讨论 | 贡献2009年3月11日 (三) 02:33的版本
跳转至:导航、​搜索


计算题提供了一种建立个别数字题的方法,题目里使用通配符(例如 {x} , {y})答题时通配符会被乱数替换。

举一个例,如果你想要建立很多"矩形面积的计算"问题给你的学生练习,你可以建立有两个通配符的试题(例如{base}, {height})然后放在"正确答案公式="的输入字段{base} * {height} ( * 是乘法的符号)。

正確答案公式= {base}*{height}


当学生作答时,Moodle会随机选取{base}{height}的值然后使用 正确答案公式来评分。

这个测验很难同时出现两次一样的题目。

这真的是你要的题型吗?

计算题的主要目的是建立有很多数值的试题版本,这个意思是你必须在答案中有一个以上的通配符。

假如你不需要乱数值,使用数字题型来取代。

通配符及资料集

当Moodle传送一个计算题给学生,通配符会被随机选择的值所取代,然而这些值不总是随机的- 他们是从已经预先定义好可能数值的资料集中随机选出的,这样可以允许你控制一些所选择的可能值 - 举个例来说,这是为了确定这些数字是实际的。

这些资料集可以是私用的共享的 - 私用的资料集在一个计算题被一个通配符所使用;共享的资料集是所有的计算题都可以共用这个通配符。

试题设定

要新增(或编辑)计算题有三页要处理,下面的操作会带你一步一步地操作这些页面:

第一页.编辑计算题

  1. 选取试题类别
  2. 这个类别中共享的通配符会列在下面。假如你改变类别,你需要点击"更新题库"按钮来更新这个列表,有可能没有共享的通配符 - 假如没有你可以稍后依照你自己的意愿来新增。
  3. 给定试题描述的名称 - 这个可以允许你在题库中办认。
  4. 输入试题内容,这应该是你想要学生回答的试题,而且必须包含所有要计算答案的资讯,因此他必须含有至少一个通配符在大括弧内,例如,假如你想要学生计算A加B,这个试题内容很可能是这样:"{A} + {B}=多少?"
  5. 假如你乡要新增一个试题的图片就选择一个图片来显示,对学生来说,图片会显示在试题内容后答案前,假如你想要控制图片如何显示,就把他放在试题内容中用HTML编辑器处理。
  6. 设定预设题目得分 (例如,这个试题的最高分)。
  7. 设定倒扣条件 (见下面的倒扣条件)。
  8. Moodle 1.7+: 假如你愿意,新增一般的回馈,这是显示给学生回答后所要显示的文字。
  9. 接下来新增正确答案公式这个公式必须含有试题内容中一个以上的通配符,见正确答案公式语法有更进一步的资料。
  10. 选择成绩这个成绩是学生针对该试题所给的答案得到的,这应该是题目得分的一个百分比,例如,你可以给正确答案100%,而接近正确答案则给50%,答案中有一个必须是100%分
  11. 决定你可以接受答案错误的容许误差,这个容许误差及误差类型设定可以提供一个可接受分数的范围,所以假如容许误差 = t,正确答案 = x 且使用者的答案跟正确答案的差为dx,那么误差类型如下:
    1. 额定误差 - 假如 dx <= t 就是正确的
    2. 相对误差 - 假如 dx / x <= t 就是正确的
    3. 几何误差 - 假如 dx² / x² <= t²就是正确的
  12. 接下来两个设定,"显示正确的答案"及"格式"决定答案的精度,使用这些来选择你想要使用的小数位数或显著数字的数字。
  13. 新增一些回馈在学生输入答案时可以看到。
  14. 你可以指定许多你喜欢的正确答案公式 - 点击"新增另一个答案空格"来新增。
  15. 你也可以指定答案的单位,例如,假如你在这里输入'cm'单位,接受的答案是15,那么答案是'15cm'及'15'都是正确的答案,假如你要新增一个以上的单位,你也可以用倍数的方式指定,所以,假如你的主要答案是5500,单位W,你也可以新增单位kW其倍数是0.001,这表示答案'5500'、'5500W'或'5.5kW'都是正确的,注意接受的错误也是倍数的,所以允许100W的错误会变成0.1kW的错误。
  16. 最后(!)你可以点击"下一页"来储存你所作及继续前进,假如拟是编辑原有试题,你可以点击 "下一页(新的问题)"来根据现有的试题新增一个全新的试题。

倒扣条件

'倒扣条件'只用在试题用在测验卷使用适性模式时 - 例如,学生允许在测验时试很多次即使是同样的测试,假如倒扣条件大于0,那么学生在成功的尝试后将会失去最高分的机会,举一个例假如预设的分数是10,倒扣条件是0.2,那么在第一次尝试后才成功的话将会发生倒扣0.2 x 10 = 2分。

第二页.选择资料集属性

每一个在答案正确公式里的通配符必须有一个相关可能的值域 - 这就是资料集,列在这一页的每个通配符有一个资料集的选择:

  • 私用的 例如只使用在这个试题
  • 共享的例如在相同类别里共享其他的计算题

使用共享的资料集可以节省时间在你要新增很多类似的计算题时。

假如在是堤内荣中有任何像是通配符的东西,但是却没有出现在答案公式里头,你可以指定这是否是通配符,假如是你可以选择要作为私用的或共享的资料集。

要继续,针对每个通配符选择你喜欢的资料集,然后点击"下一页"。

第三页.修改资料集

现在我们需要新增每个通配符可能的值,警告 - 这一页有点乱!

有两种方法可以新增值 - 你可以自己输入然后加到列表中,或是你可以让Moodle来帮你产生。

新增/删除你自己的值

新增个人的值到列表中是容易的:

  1. 在'参数'的字段针对每一个通配符输入你要的值
  2. 下拉卷轴到'新增'的部分然后点击新增按钮(保留该项的数字设为1)
  3. 需要的话可以重复上面的步骤很多次(该项数字最大到100)

要从列表中删除值:

  1. 在'删除'的部分,选择要删除的项目编号
  2. 点击删除按钮

Letting Moodle create values

  1. Start with the "Range of Values" fields, and enter the lower and upper limits for the values you would accept
  2. Choose a number of decimal places for the value
  3. Choose the distribution of values between the limits - 'uniform' means any value between the limits is equally likely to be generated; 'loguniform' means that values towards the lower limit are more likely.
  4. Now move down to the 'Add' section and click on "force regeneration"
  5. In the menu next to the Add button, choose the number of sets of random values (items) you wish to add to the list. (Note that the maximum total number of items in your list is 100.)
  6. Finally, click Add to append the new values to the list
  7. Note: If you want more control over the items that Moodle adds, you can do them one at a time and preview the values before you add them. Click the "Get New Item to Add" button to make Moodle generate new values in the "Item to Add" section at the top. If you like them, click "Add" for 1 item; if not, click "Get New Item to Add" again to get new values.

Finishing off

Once your list of items (values) is complete, you are finished. It's up to you how many values you add - the more values you add, the more a question can be used by the students without them seeing the same values repeatedly.

Note that if you delete values from the list, you can put them back again. Change the "Next Item to Add" option to "reuse previous value if available", then the next time you add items, Moodle will restore your previously-deleted items from the dataset.

Once your list of values is complete, you can click 'Save changes' to finish.

What does the 'Update the datasets parameters' button do?

As far as I can tell, it has the same function as the "Get New Item to Add" button, i.e. it generates a new set of values and displays them in the "Item to Add" section. However, it is less conveniently placed that that button, so it is probably best ignored.

Correct answer formula syntax

DO NOT PUT THE = sign in the formula.

  • In the recent versions of the calculated question type, you could have more than one answer formula and applied a specific grading value to each of them as long as there is at least one 100% correct answer formula.
If more than one correct answer formula input field are displayed when editing, 
your site has the multiple answer feature. 


  • As a general rule, write these formulas like you would in a calculator e.g. 3 + 5 * sin(3/{x}) A notable exception is exponentiation, where x3 cannot be entered as {x}^3, but instead should be entered as pow(x, 3).
  • Each function's placeholders and other arguments should be in parentheses (brackets). For example, if you want students to calculate the sine of one angle and two times cosine of another, you would enter sin({a}) + cos({b}*2).
  • It's usually better to have too many parentheses (brackets) than too few. The server won't care, and the more specific you are about what you mean, the more likely it will like your complex formulas.
  • There is no implicit multiplication. To you, the human editor, "5(23)" or "5x" may seem perfectly obvious. To the server doing the math, it's crazy talk and won't be understood. Always use the "*" for multiplication.
  • Any special mathematical function must have parentheses around its values. Take the sine function in the first bullet point for instance. Notice that the 3 / x is wrapped in parentheses (brackets)--this is so the server can understand it properly. Without those parentheses, the server won't know if you mean "(sin 3) / x" or "sin (3 / x)" and will reject the entire formula accordingly.

Available functions

Calculated questions can use more than simple arithmetic operators. The following functions are allowed in versions 1.5 and newer.

Function Explanation
abs Absolute value
acos Arc cosine -- in radians!!! Convert your degree measurement to radians before you take the acos of it.
acosh Inverse hyperbolic cosine -- in radians!!! Convert your degree measurement to radians before you take the acosh of it.
asin Arc sine -- in radians!!! Convert your degree measurement to radians before you take the asin of it.
asinh Inverse hyperbolic sine -- in radians!!! Convert your degree measurement to radians before you take the asing of it.
atan2 Arc tangent of two variables -- pass in two values like (x, y), and you'll get the atah(y/x), adjusted to the proper quadrant.
atan Arc tangent -- in radians!!! Convert your degree measurement to radians before you take the atan of it.
atanh Inverse hyperbolic tangent
bindec Binary to decimal
ceil Round fractions up
cos Cosine -- in radians!!! Convert your degree measurement to radians before you take the cos of it.
cosh Hyperbolic cosine -- in radians!!! Convert your degree measurement to radians before you take the cosh of it.
decbin Decimal to binary
decoct Decimal to octal
deg2rad Converts the number in degrees to the radian equivalent
exp Calculates the exponent of e
expm1 Returns exp(number) - 1, computed in a way that is accurate even when the value of number is close to zero
floor Round fractions down
fmod Returns the floating-point modulus of two numbers - i.e. the remainder when the first is divided by the second.
is_finite Finds whether a value is a legal finite number
is_infinite Finds whether a value is infinite
is_nan Finds whether a value is not a number
log10 Base-10 logarithm
log1p Returns log(1 + number), computed in a way that is accurate even when the value of number is close to zero
log Natural logarithm (ln)
max Find highest value
min Find lowest value
octdec Octal to decimal
pi Get value of pi
pow (numberToRaise, NumberRaisedTo) Exponential expression
rad2deg Converts the radian number to the equivalent number in degrees
rand Generate a random integer
round Rounds a float
sin Sine -- in radians!!! Convert your degree measurement to radians before you take the sin of it.
sinh Hyperbolic sine -- in radians!!! Convert your degree measurement to radians before you take the sinh of it.
sqrt Square root
tan Tangent -- in radians!!! Convert your degree measurement to radians before you take the tan of it.
tanh Hyperbolic tangent -- in radians!!! Convert your degree measurement to radians before you take the tanh of it.

Predefined constants

Actually there is NO Predefined constant that is allowed other than pi() as a function without parameter.