GeoGebra Klaslokaal

# multiple choice: select the slope

## Introduction

In mulitple choice questions you shouldn't use Input Boxes to type the answer. To make such multiple choice questions you can use checkboxes. But when using points, you don't have to add additional texts as feedback. Just use dynamic coloring of the points.

## How to do this

• exercise: Define - `a = ``RandomBetween(-4, 4)` - `b = ``RandomBetween(-4, 4)` - `f(x) = a x + b` - Create a dynamic text showing the exercise
• solution: Define a conditional number `sol = If(a > 0, 1, If(a < 0, 2, 3))` so that - if a > 0, then sol = 1 - if a < 0, then sol = 2 - if a = 0, then sol = 3
• answer: Define a number `ans = 0`
• Points: - Create three points A, B and C (maximal size and unfilled) to be uses as checkboxes. - Add the three texts 'is ascending', 'is descending' and 'none of both' behind them.
• Checkboxes: To answer the question add following scripts (On Click) in the tab Scripting of the Properties of the three points:  ﻿Point A ﻿Point B ﻿Point C ﻿```SetValue[ans,1] SetPointStyle[A, 0] SetPointStyle[B, 2] SetPointStyle[C, 2]``` ﻿SetValue[ans,2] SetPointStyle[A, 2] SetPointStyle[B, 0] SetPointStyle[C, 2] ﻿SetValue[ans,3] SetPointStyle[A, 2] SetPointStyle[B, 2] SetPointStyle[C, 0]
These scripts define the value of ans, select the clicked point and deselect the other two. To do so we use the Command SetPointStyle[ <Point>, <Number> ]. The only two PointStyles you have to know are: - `0` : filled (= to use as selected) - `2` : unfilled (= to use as deselected)
• button: create a button next exercise to recalculate the random values, uncheck all points and set back the value of ans to `0 `by following script: ```UpdateConstruction[] SetValue[ans,0] SetPointStyle[A, 2] SetPointStyle[B, 2] SetPointStyle[C, 2]```