multiple choice with drop-down lists

introduction
If the different answers can be written as a text, you can use drop-down lists for multiple choice problems. In following applet you have to select the equation of a first degree function out of four possibilities.
How to do this?
[list][*][b]2 different numbers[/b]: Define[br]- [code]listab = Shuffle({-3, -2, -1, 1, 2, 3})[/code][br]- [code]a = listab(1)[/code][br]- [code]b = listab(2)[/code] to ensure that a and b are not equal numbers within a given range.[br][/*][*][b]4 functions[/b]: Define following functions and hide them:[br]- [code]f1(x) = Polynomial(a x + b)[/code][br]- [code]f2(x) = Polynomial(a x - b)[/code][br]- [code]f3(x) = Polynomial(-a x + b)[/code][br]- [code]f4(x) = Polynomial(-a x - b)[/code][br]- [code]listf={ f1, f2 ,f3 ,f4 }[/code][/*][*][b]solution[/b]: Define:[br]- [code]sol = RandomBetween(1, 4)[/code][br]- [code]f(x) = Element(listf, sol) [/code]to show the graph of one of the four functions[/*][*][b]answer[/b]: Define:[br]- [code]listans= {"", f1, f2, f3, f4}[/code]. [br] Rightclick on it an select in the tab Basic of the Properties the option Draw as drop-down list.[br]- [code]ans = SelectedIndex(listans) - 1[/code] [br] ( since the first option is a blank )[br][/*][*][b]Feedback[/b] on the answer[br]- Rightclick on the drop-down list and select the tab Advanced in the Properties.[br]- Define the dynamic colors of the drop-down-list as follows:[br] [code]Red: If((ans ≠ 0) ∧ (ans ≠ sol), 1, 0)[/code][br] [code]Green: If(ans ≟ sol, 0.7, 0)[/code][br] [code]Blue: 0[/code][/*][*][b]button[/b]: Create a button with following scripting commands: [br][code]UpdateConstruction[][/code] to recalculate all random values[br][code]SetValue[listans,1][/code] to set the drop-down list to blank[br][br][/*][/list]

Information: multiple choice with drop-down lists