Google Classroom
GeoGebraGeoGebra Klaslokaal

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?

  • 2 different numbers: Define - listab = Shuffle({-3, -2, -1, 1, 2, 3}) - a = listab(1) - b = listab(2) to ensure that a and b are not equal numbers within a given range.
  • 4 functions: Define following functions and hide them: - f1(x) = Polynomial(a x + b) - f2(x) = Polynomial(a x - b) - f3(x) = Polynomial(-a x + b) - f4(x) = Polynomial(-a x - b) - listf={ f1, f2 ,f3 ,f4 }
  • solution: Define: - sol = RandomBetween(1, 4) - f(x) = Element(listf, sol) to show the graph of one of the four functions
  • answer: Define: - listans= {"", f1, f2, f3, f4}. Rightclick on it an select in the tab Basic of the Properties the option Draw as drop-down list. - ans = SelectedIndex(listans) - 1 ( since the first option is a blank )
  • Feedback on the answer - Rightclick on the drop-down list and select the tab Advanced in the Properties. - Define the dynamic colors of the drop-down-list as follows: Red: If((ans ≠ 0) ∧ (ans ≠ sol), 1, 0) Green: If(ans ≟ sol, 0.7, 0) Blue: 0
  • button: Create a button with following scripting commands: UpdateConstruction[] to recalculate all random values SetValue[listans,1] to set the drop-down list to blank