Walkthrough 1: QuizzesIn this walkthrough, we will help you to design a quiz for students for your geometry class.
Designing Question 1. Let's start off with a softball question, "What is the area of a square with side 5 inches?". You could model this question in a worksheet in multitude of ways as follows (starting off from a blank worksheet). In the following, we outline one way of doing so.
In this scenario, you start by typing in the question. Then you add a text field for your students to type in an answer. (A text field can be inserted by clicking through Insert > Form Element > Input Text in the Worksheet Editor's menu bar.)
Q1: The area of a square with side 5 in. is in. x in.
To make the quiz engaging you may want to add in real time feedback. For example, you may want the question to be colored colored blue in case the correct answer (i.e. 25) is typed in, otherwise you may want the question to be colored red. You can embed this behavior in his worksheet using Worksheet Rules through the following simple steps.
Designing Question 2 (with multiple choices). Let's move on to a multiple-choice question. In this section, we will explore a way of encoding such questions by inserting checkboxes (click through Insert > Form Element > Checkbox in the Worksheet menu bar).
First, type in the question text. For example: A triangle with three equal sides is: (select all options that apply).
Then, insert the relevant answer checkboxes, and convert these checkboxes and the paragraph containg the question text to Worksheet cells as previously described, i.e., by assigning an 'Id' to the paragraph containing the question and each of four checkboxes. In addition, check the option 'Refresh Worksheet on change' for the checkboxes. In this example, we use the Ids: acute, isosceles, equilateral, and scalene for the checkboxes and 'question2' for the paragraph containing the question text.
Q2: A triangle with three equal sides is: (select all options that apply) Acute Iscosceles Equilateral Scalene
Similar to Question 1, suppose you want the question text to be colored blue if all correct options (i.e. acute, isosceles, and equilateral) are selected, otherwise red. In order to do so, open up the rule editor, and add the following rules.
style(question2, color, blue) :- value(acute, true) & value(isosceles, true) & value(equilateral, true) & ~value(scalene, true) style(question2, color, red) :- ~style(question2, color, blue)
The first rule reads as: If the value of acute is true, and the value of isosceles is true, and the value of equilateral is true, and the value of scalene is not true, then the color of question2 is blue. The second rule reads as: If the color of question2 is not blue, then the color of question2 is red.
Note that: checking the checkbox, say acute, sets its value to true. Similarly, unchecking the checkbox, sets its value to false.
Again, save the rules, and then, preview the Worksheet by clicking through View > Preview Worksheet in the Worksheet menu bar.
The quiz so far, that we have designed is as follows:
Q1: The area of a square with side 5 in. is in. x in.
Q2: A triangle with three equal sides is: (select all options that apply) Acute Iscosceles Equilateral Scalene
Computing the Quiz Score. Suppose that you want to compute the total score based on the responses. Each question, if correctly answered, adds a score of 5 to the total. If a question is incorrectly answered, no score is added to the total. One way to embed the total score is through the following steps:
The quiz so far, that we have designed is as follows:
Q1: The area of a square with side 5 in. is in. x in.
Q2: A triangle with three equal sides is: (select all options that apply) Acute Iscosceles Equilateral Scalene
Total:
Towards a compact encoding of the total score. Consider a scenario where you have a large number of questions in your quiz - say 20. In this scenario, if you use the rules as described in the previous section to compute the total score, then you'll end up with 220 rules, which is not all pleasant to write!
An alternative is to encode desired behavior using a compact set of rules by leveraging Variables, and Aggregate Operators as follows. attribute(total, value, T) :- countofall(X, style(X, color, blue), C) & times(C, 5, T) The above rule reads as follows: set the value of total to T, where T = 5 * C, and C is the number of constants that can be substituted for X such that color of the element X is blue.
|