Checkboxes with multiple correct answers

How do I code so that students receive feedback (green check or red x) when checking two boxes? Box 4 and box 5 are correct and this coding is not working- nothing happens when boxes are checked:

correct:
(this.isSelected(4) and this.isSelected(5) and not(this.isSelected(1) or this.isSelected(2) or this.isSelected(3)))

It is slide 9 in this activity:

Thank you for helping!!

Just add this to your sketch:
readOnly: true

Thank you!! :slight_smile: That works

No problem.

In my opinion the default behaviour should be the opposite way around: if you want something to be checked for correctness, opt in to that.
You are far, far from alone in asking about this and it’s not explained in the documentation.

Happy coding!

So here is my next problem- it shows the x on the dashboard preview, but it does not show it on the student screen preview. Is there anything I can do for my students to get immediate feedback? Or should I tackle this kind of question differently altogether?

Somewhat differently. You need to add something somewhere on the screen to indicate to students what happened. This might be in a Note component.

Name your checkbox to something like answers(doesn’t matter what) so that you can refer to it. Then inside answers change the code to something like:

allGood = (this.isSelected(4) and this.isSelected(5) and not(this.isSelected(1) or this.isSelected(2) or this.isSelected(3))) correct: allGood

Then in your Note component you can add something like:

feedback = when answers.script.allGood "correct" otherwise ""

And import that feedback variable into your note content.

By the way this is made easier if you use an Answer Key for the Checkbox component as you can set up your correctness scheme directly there if you want.

Hi Mike, so I am trying to go about this completely differently now. Here is my attempt:

submitLabel: “Submit”
prompt: “Select all that are false”

A= this.isSelected(1)
B= this.isSelected(2)
C= this.isSelected(3)
D= this.isSelected(4)
E= this.isSelected(5)

answers= D and E
correct: answers
warning: when (A OR B OR C) or not(D or E)AND not(this.submitted) “This isn’t submitted” otherwise “”

My attempt works, except for when students choose D, E (both correct) and additional (wrong) answers, they still get the message that they are correct. How can I fix this? I am so sorry, but I am completely new to coding in desmos and I am willing to learn!

This simplest way of handling all this is to take advantage of that matchesKey keyword.

So in your multiple choice answers component all the scripting required is just:

correct: this.matchesKey

Provided you select the correct combination of responses apriori, like this:

Then in your Note component you can add this:
feedback = when answers.matchesKey "✅ correct!" otherwise ""

And then import that feedback variable into your note content like so:

Here you go if it helps: [Copy of] [Copy of] Triangle - Exterior Angles • Activity Builder by Desmos Classroom

You are amazing! Thank you :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.