Note: You are currently viewing documentation for Moodle 3.3. Up-to-date documentation for the latest stable version of Moodle is probably available here: Formulas: Hon Wai Lau's examples.

Formulas: Hon Wai Lau's examples

From MoodleDocs


Hon Wai Lau's examples

Example 1.1: Minimal question

For a minimal question, you must define a sub-question with:

  • mark
  • answer
  • grading criteria
  • question text (optional)
General
  Question name!       Minimal question
Main question
  Question text!       What is 2 + 2?
Part 1
  Part's mark*         1
  Answer type          Number
  Answer*              4
  Grading criteria*    Relative error < 0.01

The Formulas question should look like this:

Formules201801261903.png

Play it    Login info  (Open in new tab: Ctrl+Shift+Click)

Example 1.2: Generate random data

Random data can be defined in the random variables, such as a = {2,3,4,5}. Upon quiz generation, one deterministic value will be chosen.

General
  Question name!       Generate random data
Variables
  Random variables     a = {2,3,4,5};
Main question
  Question text!       In this instantiation, a takes the value {a}.
Part 1
  Part's mark*         1
  Answer type          Number
  Answer*              a
  Grading criteria*    Relative error < 0.01
  Part's text          Enter the value of a:

The Formulas question should look like this:

Formules201801261929.png

Play it    Login info  (Open in new tab: Ctrl+Shift+Click)

Example 1.3: Multiple parts

By default, all parts will be added at the end of the question. If placeholders are used, the parts will be inserted at the location of placeholders.

General
  Question name        Multiple parts
Main question
  Question text        This is the beginning of the main question text.
                       {#1}
                       This is the continuation of the main question text.
                       {#2}
                       This is the continuation and the end of the main question text.
Part 1
  Part's mark          1
  Answer type          Number
  Answer               3
  Grading criteria     Relative error < 0.01
  Placeholder name     #1
  Part's text          This is the text of Part 1. The correct answer is 3:
Part 2
  Part's mark          1
  Answer type          Number
  Answer               1
  Grading criteria     Relative error < 0.01
  Placeholder name     #2
  Part's text          This is the text of Part 2. The correct answer is 1:
Part 3
  Part's mark          1
  Answer type          Number
  Answer               4
  Grading criteria     Relative error < 0.01
  Part's text          This is the text of Part 3. The correct answer is 4:

With the question behaviour set to Interactive with multiple tries, the Formulas question should look like this:

Formules201801262037.png

Play it    Login info  (Open in new tab: Ctrl+Shift+Click)

With the question behaviour set to Adaptive mode, the Formulas question should look like this:

Formules201801262039.png

Play it    Login info  (Open in new tab: Ctrl+Shift+Click)

An important advantage of the Adaptive mode behaviour is that all the answers do not have to be entered before they can be checked by clicking the Check button. Thus, the answers for each part can be checked one at a time or as they are entered.

Example 1.4: Placeholders of numbers and unit

This question shows different display methods of the number and unit boxes.

General
  Question name        04  Placeholders of numbers and unit
Variables
Random variables       v = {20:100:10};
                       dt = {2:6};
Global variables       s = v*dt;
Main question
  Question text        If a car travels {s} m in {dt} s, what is the speed of the car?
Part 1
  Part's mark          1
  Answer type          Number
  Answer               v
  Grading criteria     Relative error < 0.01
  Unit                 m/s
  Part's text          Number box and unit box side by side
                       {_0}{_u}
Part 2
  Part's mark          1
  Answer type          Number
  Answer               v
  Grading criteria     Relative error < 0.01
  Unit                 m/s
  Part's text          Number box and unit box side by side
                       {_0} {_u}
Part 3
  Part's mark          1
  Answer type          Number
  Answer               v
  Grading criteria     Relative error < 0.01
  Unit                 m/s
  Part's text          No unit box
                       {_0} m/s
Part 4
  Part's mark          1
  Answer type          Number
  Answer               v
  Grading criteria     Relative error < 0.01
  Unit                 m/s
  Part's text          No unit box
                       speed = {_0} m/s

The Formulas question should look like this:

Formules201801272226.png

Play it    Login info  (Open in new tab: Ctrl+Shift+Click)

Example 3.2: Multiple and within range

This question is similar to Example: Multiples of 7 between 10 and 100 (Mark = 0, 0.5 or 1), except that the multiples are multiple of a variable d which can be 5, 6, 7, 8 or 9, and that the range is variable by requiring that x satisfies a < x < b where a = k*d-3, b = (k+2)*d-2 and k ranges from 4 to 9.

General
  Question name        3.2  Variable multiple and range
Variables
  Random variables     k = {4:10:1};
                       d = {5,6,7,8,9};
  Global variables     a = k*d-3;
                       b = (k+2)*d-2;
Main question
  Question text        Two Grading criteria are defined here, each of which is worth half a mark.
Part 1
  Part's mark*         1
  Answer type          Number
  Answer*              k*d
  Grading variables    criterion1 = _0 % d == 0;
                       criterion2 = a <= _0 && _0 <= b;
  Grading criteria     (criterion1 + criterion2)/2
  Part's text          Give a number x that is a multiple of {d} and satisties {a} < x < {b}:

The Formulas question should look like this:

Formules201801261903.png

Play it    Login info  (Open in new tab: Ctrl+Shift+Click)


Back to top of page

← FORMULAS QUESTION TYPE

In other languages

Español
Français