isTrue

Overview

The isTrue method checks that an expression has a comparison, or equality, that is true. This means that when this method is used alone, any true equation entered by the student will be marked as correct.

Expressions that include a relational (‘\(<\)’, ‘\(<=\)’, ‘\(>\)’ or ‘\(>=\)’) or equality (‘\(=\)’) operator are evaluated for their truthfulness.


  • Allow thousands separator

    Authors can specify what separators can be used by the student. From the Thousand Separator drop down menu you can select dot, comma, and/or space. The Decimal Separator menu contains the option for either a dot or a comma. Note that the specified thousand separator and decimal separator cannot be the same, e.g. both dot.


  • Inverse result

    Enabling this means that the value specified in the Value field will not be accepted as the correct answer. It is a useful way of excluding very specific answers from validation.



Examples

Example 1 - Basic isTrue question example.

isTrue does not take any value, which means when used alone it will validate any mathematical expression that is true.

AnswerMarking
\(5=5\)true
\(1\)true
\(5 > 1\)true
\(x\)true
\(1km>1m\)true
\(1=2\)false
\(5<1\)false
Source
{
    "instant_feedback": true,
    "is_math": true,
    "stimulus": "Enter a value that evaluates to true.",
    "type": "formulaV2",
    "ui_style": {
        "type": "block-on-focus-keyboard"
    },
    "validation": {
        "scoring_type": "exactMatch",
        "valid_response": {
            "score": 1,
            "value": [
                {
                    "method": "isTrue",
                    "options": {
                        "decimalPlaces": 10,
                        "inverseResult": false
                    }
                }
            ]
        }
    }
}


Example 2 - isTrue fill in the blanks.

AnswerMarking
\(23\)true
\(50\)true
\(22\)false
\(1\)false
Source
{
    "instant_feedback": true,
    "is_math": true,
    "stimulus": "Enter a number greater than or equal to 23.",
    "template": "{{response}}\\ge23",
    "type": "formulaV2",
    "ui_style": {
        "type": "block-on-focus-keyboard"
    },
    "validation": {
        "scoring_type": "exactMatch",
        "valid_response": {
            "score": 1,
            "value": [
                {
                    "method": "isTrue",
                    "options": {
                        "decimalPlaces": 10,
                        "inverseResult": false
                    }
                }
            ]
        }
    }
}