Creating and Grading Custom Quizzes

Introduction

The mgiQuiz tag can be used with two types of quizzes, Composite and Custom.

Composite quizzes are created manually or randomly from questions entered in the admin mode of the mgiQuiz tag and stored in the mgiQuiz database. Composite quizzes are graded by the mgiQuiz tag and quiz results are stored in the mgiQuiz database for later management.

Custom quizzes are created as "hard-coded" pages with text, HTML, and form elements. Custom quizzes can be graded by the mgiQuiz tag, but results are not tracked or stored. Combining the mgiQuiz tag with a database submit or file write will allow you to store quiz grades and other information for later retrieval.

In this example, you will create a custom nutrition quiz and collect quiz scores and answers in a text file.

MGI Tags

Steps

  1. Create a custom quiz form page.
  2. Create a quiz administration page and open it in a text editor.
  3. Insert the mgiQuiz tag in Admin mode.
  4. Save the quiz administration page.
  5. FTP the administration page to the web server running MGI.
  6. View the quiz administration page in a web browser.
  7. Add a new quiz.
  8. Add quiz post arguments and answers.
  9. Create a quiz grading page and open it in a text editor.
  10. Insert the mgiQuiz tag in Grade mode.
  11. Save the quiz grading page.
  12. FTP the quiz form and quiz grading page to the web server running MGI.
  13. View the quiz form page in a web browser and take the quiz.


Step 1: Create a custom quiz form page.

Create a custom quiz form named "nutrition.mgi" using any type of form element (radio buttons, checkboxes, selects, text fields, or text areas). Name each form element uniquely. For radio buttons, name the set of radio buttons with one name and enter a unique value for each radio button. For checkboxes, name each checkbox uniquely and enter a value for each checkbox. For selects (pup-up menus), name the pop-up menu uniquely and enter a value for each option. For text fields and text areas, name each uniquely. Text boxes can be used for fill-in-the-blank questions, but we recommend text fields for that purpose.
 
After the form elements (questions and answers), enter a submit button named "Submit Quiz".
 
Enclose all form elements with HTML <FORM> tags and post the form to the quiz grading page (results.mgi).
 
The following is an example quiz form with different form elements, a submit button and HTML <FORM> tags.
<FORM ACTION="results.mgi" METHOD="POST">

<H1><CENTER>Nutrition Quiz</CENTER></H1>

<H4><CENTER>How is your nutrition IQ? 
Answer these questions to find out.</CENTER></H4>

<H1><CENTER>
<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="3">

<TR>
<TD BGCOLOR="#99ccff">1. How many calories 
are in 1 gram of fat?</TD>
</TR>
<TR>
<TD><INPUT NAME="calorie" TYPE="text" SIZE="5" 
MAXLENGTH="1">
</TD>
</TR>

<TR>
<TD BGCOLOR="#99ccff">2. Which food is the best 
source of protein?</TD>
</TR>
<TR>
<TD>
<P><INPUT TYPE="radio" VALUE="carrot" NAME="protein"> 
carrot</P>
<P><INPUT TYPE="radio" VALUE="sweet potato" NAME="protein"> 
sweet potato</P>
<P><INPUT TYPE="radio" VALUE="ground beef" NAME="protein"> 
ground beef</P>
<P><INPUT TYPE="radio" VALUE="butter" NAME="protein"> 
butter</P>
<P><INPUT TYPE="radio" VALUE="NO ANSWER" NAME="protein" 
CHECKED="1"> NO
ANSWER
</TD>
</TR>

<TR>
<TD BGCOLOR="#99ccff">3. Choose 2 foods that would 
help you meet your daily fruit and vegetable 
requirement:</TD>
</TR>
<TR>
<TD>
<P><INPUT TYPE="checkbox" NAME="vegetableA" 
VALUE="banana"> banana</P>
<P><INPUT TYPE="checkbox" NAME="vegetableB" 
VALUE="roast beef"> roast beef</P>
<P><INPUT TYPE="checkbox" NAME="vegetableC" 
VALUE="cheese"> cheese</P>
<P><INPUT TYPE="checkbox" NAME="vegetableD" 
VALUE="waffles"> waffles</P>
<P><INPUT TYPE="checkbox" NAME="vegetableE" 
VALUE="peas"> peas</P>
<P><INPUT TYPE="checkbox" NAME="vegetableF" 
VALUE="tea"> tea
</TD>
</TR>

<TR>
<TD BGCOLOR="#99ccff">4. What is the recommended intake 
of water per day?</TD>
</TR>
<TR>
<TD><SELECT NAME="water">
<OPTION VALUE=" " SELECTED>Choose One
<OPTION VALUE="1">1 - 8 ounce glass
<OPTION VALUE="2">2 - 8 ounce glasses
<OPTION VALUE="8">8 - 8 ounce glasses
<OPTION VALUE="20">20 - 8 ounce glasses
</SELECT></TD>
</TR>

<TR>
<TD BGCOLOR="#99ccff">5. Which of the following 
practices does <B>NOT</B> promote good health?</TD>
</TR>
<TR>
<TD>
<P><INPUT TYPE="radio" VALUE="decrease salt" 
NAME="health"> Lowering your intake of salt</P>
<P><INPUT TYPE="radio" VALUE="increase caffeine" 
NAME="health"> Increasing your intake of caffeine</P>
<P><INPUT TYPE="radio" VALUE="decrease fat" 
NAME="health"> Lowering your intake of saturated fat</P>
<P><INPUT TYPE="radio" VALUE="increase exercise" 
NAME="health"> Increasing your exercise</P>
<P><INPUT TYPE="radio" VALUE="NO ANSWER" 
NAME="health" CHECKED="1"> NO ANSWER
</TD>
</TR>

</TABLE></CENTER></H1>

<P><CENTER><INPUT NAME="name" TYPE="submit" 
VALUE="Submit Quiz">
</CENTER></P>

</FORM>

Step 2: Create a quiz administration page and open it in a text editor.

Create a page named "quizadmin.mgi" to display the web-based quiz administration interface. Open the quiz administration page in a text editing program that allows you to view and modify the HTML and code of the page.

Step 3: Insert the mgiQuiz tag in Admin mode.

Insert your cursor after the beginning <BODY> element and enter the mgiQuiz tag and mode parameter. In the mode parameter, enter "Admin".
<mgiQuiz mode="Admin">

Step 4: Save the quiz administration page.

Save the changes you have made to the quiz administration page.

Step 5: FTP the quiz administration page to the web server running MGI.

Upload the quiz administration page from your local computer to the web server using an FTP program.

Step 6: View the quiz administration page in a web browser.

View the quiz administration page in a web browser. The first screen of the web-based, administration interface displays four options: 1) Create Questions 2) Edit Composite Quizzes 3) Manage Composite Quizzes and 4) Edit Custom Quizzes.

Step 7: Add a new quiz.

Click the "Edit Custom Quizzes" button. In the text field under the "Custom Quiz Name" column, enter the case-sensitive quiz name ("Nutrition" for this example). and click the "Create" button.

Step 8: Add quiz post arguments and answers.

Click the "Edit" button beside the quiz to access the post argument interface. For each quiz question including each checkbox (i.e., for each unique post argument) add a question number, post argument name, correct answer, and points.
 
In the text field under the "Question #" column, enter the question number. Question numbers are entered automatically based on the previous question number. For checkboxes (i.e., questions with multiple answers) we suggest that you use a suffix such as 3.1, 3.2, etc.
 
In the text field under the "Post Argument Name" column, enter the post argument name to grade. Enter one name for each text field, one name for each text area, one name for each set of radio buttons, one name for each checkbox and one name for each select (pop-up menu).
 
In the text field under the "Answer" column, enter the value for the correct answer. The value is not necessarily the same as the answer appearring on the quiz form since radio buttons, checkboxes and selects (pop-up menus) can have post argument values that differ from the option description.
 
In the text field under the "Points" column, enter the number of points gained or lost for a value which matches the answer. For selecting a correct answer, enter positive point values. For selecting an incorrect answer (e.g., selecting an incorrect checkbox) you may enter a negative number to subtract points.
 
Finally, click the "Add" button under the quiz name to add the post argument information.
 
To edit a post argument name, answer or points once they have been created, modify the name, answer or point value and click the "Update" button beside the post argument.
 
For this example, enter the following post argument information. In this example, notice that each checkbox is included as a sub-set of one question and one loses points for selecting an incorrect checkbox answer.
 
Nutrition Quiz Post Arguments:

Question # Post Argument Answer Points
1 calorie 9 20
2 protein ground beef 20
3.1 vegetableA banana 10
3.2 vegetableB roast beef -5
3.3 vegetableC cheese -5
3.4 vegetableD waffles -5
3.5 vegetableE peas 10
3.6 vegetableF tea -5
4 water 8 20
5 health increase caffeine 20

Step 9: Create a quiz grading page and open it in a text editor.

Create a quiz grading page named "results.mgi" to grade the quiz and open the quiz grading page in a text editing program that allows you to view and modify the HTML and code of the page.

Step 10: Insert the mgiQuiz tag in Grade mode.

On the quiz grading page, enter the mgiQuiz tag, name parameter and type parameter. In the name parameter, enter the name of the quiz to grade (e.g., "Nutrition"). In the type parameter, enter "Custom". For custom quizzes, the type parameter is required.
 
For this example, the quiz grade is stored in a variable. Based on the quiz grade, a text message is displayed. The quiz score and answers are then appended to a tab-delimited file using the mgiModifyFile tag.
<mgiSet name="Score">
<mgiQuiz name="Nutrition" type="Custom">
</mgiSet>

<mgiIf lhs={mgiGet name="Score"} 
relationship="greaterThan" rhs="90">

<p>Excellent!  You have a very high nutrition IQ.  
Keep up the good work.

<mgiElse>

<mgiIf lhs={mgiGet name="Score"} relationship="greaterThan"
rhs="80">

<p>Your nutrition IQ is good, but could use a little work.
	
<mgiElse>
	
<p>Your nutrition IQ is poor.  Read our nutrition fact 
sheet to brush up on your nutrition information.

</mgiIf>

</mgiIf>

<mgiModifyFile fileLocation="scores.txt" mode="append">
<mgiGet name="Score"> <mgiPostArgument
name="calorie"> <mgiPostArgument name="protein">	
<mgiPostArgument name="vegetableA"> 
<mgiPostArgument name="vegetableB">
<mgiPostArgument name="vegetableC"> 
<mgiPostArgument name="vegetableD">
<mgiPostArgument name="vegetableE"> 
<mgiPostArgument name="vegetableF">
<mgiPostArgument name="water"> 
<mgiPostArgument name="health">
</mgiModifyFile>

Step 11: Save the quiz grading page.

Save the changes you have made to the quiz grading page.

Step 12: FTP the quiz form and quiz grading page to the web server running MGI.

Upload the quiz form and quiz grading page from your local computer to the web server using an FTP program.

Step 13: View the quiz form page in a web browser and take the quiz.

View the quiz form page in a web browser. Complete the quiz and click the "submit" button. Based on your grade, a message displays and your score is saved in a text file with your answers.


[Return to the Administering Online Quizzes Menu]


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]