WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center
Wolfram Language Home Page »

"Expression" (Comparison Method)

Test whether two expressions match.

Details

  • The "Expression" comparison method compares submitted answers to values in the answer key using pattern matching.
  • Symbolic structures including pattern objects like Blank are valid pattern forms in the answer key. During assessment, submitted answers are compared with the answer key values using MatchQ .
  • "Expression" is the default comparison method when no other comparison method is specified or automatically inferred from the AssessmentFunction .

Examples

open allclose all

Basic Examples  (2)

Create an AssessmentFunction using arbitrary expressions to define multiple correct answers:

Answers matching any value in the key are marked as correct:

Any other answer is incorrect:

Create an AssessmentFunction with numeric values compared as expressions:

Equivalent numeric answers are marked as incorrect because they do not match as expressions:

Scope  (1)

Create an test for a pattern test and award two points for a correct answer:

See the score for a correct answer:

Applications  (5)

Multiple choice questions can always use the "Expression" comparison method because the possible answers are predefined:

Create a multiple-choice QuestionGenerator with an "Expression" comparison:

Generate three QuestionObject examples from the generator:

Create a "MultipleShortAnswers" question with "Expression" comparison. The interpreter standardizes the submitted answers:

Create a grammar test, treating strings as expressions:

Create a "DragCompletion" question comparing Entity values as expressions:

Properties & Relations  (4)

"Expression" is the default comparison method when answer keys do not match special built-in comparison methods:

When the key matches a special method, that method is inferred automatically:

Specify "Expression" to force the method:

Use Information to check the comparison method of an AssessmentFunction :

Assess an answer that matches multiple values in the answer key of an "Expression" comparison:

The first matching value in the answer key is used for assessment:

With the setting "ListAssessment""SeparatelyScoreElements", repeated answers are only compared against each value in the answer key once:

The first matching value in the answer key is used for assessment:

See Also

AssessmentFunction   QuestionObject   MatchQ

Question Interface Types: ShortAnswer   MultipleShortAnswers   DragCompletion   SelectCompletion   Sort   TextCompletion

Comparison Methods: HeldExpression   CodeEquivalence

Tech Notes

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /