Group Abstract Group Abstract

Message Boards Message Boards

How to Use QuestionObject with AssessmentResultObject?

POSTED BY: Jonathan Kinlay
4 Replies

First, let me say that this will improve in two ways in 13.1: support of Setting and a dedicated form notebook for QuestionObject content.

That said, if you want to use the QuestionObject interface in 13.0 but have programmatic access to the answer or the assessment you can use one of these tricks:

Store the student answer in a symbol using a comparator function QuestionObject["How many career home runs did Hank Aaron hit?", AssessmentFunction[{714 -> False, 755 -> True, 868 -> False}, (MatchQ[$studentanswer = #1, #2] &)]]

Store the student answer and assessment in symbols using a wrapper around the assessment function. Note the need to specify the interface since it is not automatically inferred from the custom assessment. QuestionObject[ QuestionInterface["MultipleChoice", <|"Choices" -> {714, 755, 868}, "Prompt" -> "How many career home runs did Hank Aaron hit?"|>], ($result = AssessmentFunction[{714 -> False, 755 -> True, 868 -> False}][$answer = #])["AnswerCorrect"] &]

POSTED BY: Bob Sandheinrich

Thanks Bob.

Two excellent solutions here.

Much appreciated.

POSTED BY: Jonathan Kinlay
Posted 3 years ago

It also sounds like you want to you QuestionObject and AssessmentFunction together, but get access to the result programmatically. The documentation examples of nesting QuestionObject["label", AssessmentFunction[...]] seem to be created a self-contained Q&A interface, where the student simply gets visual feedback (green checkmark or red x). I also don't know how to hook into this correctly for sure.

But I think if you use QuestionObject['label", f] and tell QuestionObject your input UI type, you might be able to write a function f that uses AssessmentFunction to do the job.

POSTED BY: Joel Klein
Posted 3 years ago

First problem, I think AssessmentFunction, x in your case, needs to be applied to the "student" input to get the AssessmentResultObject. Second problem, which becomes more obvious when you realize the first, is that x["property"] is supplying a string to an AssessmentFunction expecting a number.

I think what you want is this: (* student supplies answer: *) result = x[715] (* retrieve properties from AssessmentResultObject: *) {result["GivenAnswer"], result["AnswerCorrect"]}

POSTED BY: Joel Klein
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard