<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>Your Quiz</title>
<script type='text/javascript'>
<!--
//=================== NUMBER OF QUESTIONS AND HOW TO SCORE==================
var radioNum = 5; //Total number of questions
var qNum = 4; //Number of options per question
var maxPt = 100; //Total possible points
var YourScore = 0; //Starting score
var correct = new Array(); //Answer key array
correct[0] = "D";
correct[1] = "B";
correct[2] = "D";
correct[3] = "A";
correct[4] = "C";
var answer = new Array(); //User answer array
//============== GRADING THE TEST=============
var radioTax = maxPt / radioNum; //Points per question
var timeStart = new Date();
function CheckSum ()
{
for (i=0; i<qNum; i++) {
if (document.answer.Q1[i].checked == true)
answer[0] = document.answer.Q1[i].value;
if (document.answer.Q2[i].checked == true)
answer[1] = document.answer.Q2[i].value;
if (document.answer.Q3[i].checked == true)
answer[2] = document.answer.Q3[i].value;
if (document.answer.Q4[i].checked == true)
answer[3] = document.answer.Q4[i].value;
if (document.answer.Q5[i].checked == true)
answer[4] = document.answer.Q5[i].value;
}
for (i=0; i<radioNum; i++) {
if (answer[i] == correct[i])
YourScore += radioTax;
}
//==============BUILDING THE SCORE CARD=============
var scoreSheet = window.open("","","width=350,height=400,toolbars=no,status=no,scrollbars=yes,resizable=yes");
var timeTurnIn = new Date();
var firstname = document.answer.firstname.value;
scoreSheet.document.writeln("<h1 align='center'>Test Results<\/h1>");
scoreSheet.document.writeln("<b>Name:<\/b> " + firstname + "<br>");
scoreSheet.document.writeln("<b>Time Started:<\/b> " + timeStart.getHours() + ":" + timeStart.getMinutes() + ":" + timeStart.getSeconds() + "<br>");
scoreSheet.document.writeln("<b>Time Turned In:<\/b> " + timeTurnIn.getHours() + ":" + timeTurnIn.getMinutes() + ":" + timeTurnIn.getSeconds() + "<br>");
scoreSheet.document.writeln("<b>Summary:<\/b><br><table width='100%' align='center'>");
scoreSheet.document.writeln("<tr align='center'><td>Question<\/td><td>Answer<\/td><td>Your Answer<\/td><td>Status<\/td><\/tr>");
for (var i=0; i<radioNum; i++) {
scoreSheet.document.write("<tr align='center'><td>" + (i+1) + "<\/td><td>" + correct[i] + "<\/td><td>" + answer[i]);
if (answer[i] == correct[i])
scoreSheet.document.writeln("<td>Correct<\/td><\/tr>");
else
scoreSheet.document.writeln("<td>Incorrect<\/td><\/tr>");
}
scoreSheet.document.writeln("<\/table><br>");
scoreSheet.document.writeln("<b>Score:<\/b> " + YourScore + " out of " + maxPt + " possible points.<br>");
scoreSheet.document.writeln("<b>Comments:<\/b> ");
if (YourScore == 100) {
scoreSheet.document.writeln("Way to go!!<br>");
}
else if (YourScore >= 80) { scoreSheet.document.writeln("Pretty good!<br>"); }
else if (YourScore >= 60) { scoreSheet.document.writeln("Come on, you can do better than that!<br>"); }
else { scoreSheet.document.writeln("You need to study harder.<br>"); }
scoreSheet.document.close()
scoreSheet.focus()
}
//-->
</script>
</head>
<body>
<!-- ***************** QUESTIONS FORM *******************-->
<form name="answer" onSubmit="return CheckSum(this)" method="post" action="">
<div>
Name: <input type="text" name="firstname"><br>
<hr>
1. If I have 3 apples, and I ate 2 of them, how many apples do I have left?
<br>
<input name="Q1" type="radio" value="A">A Four apples
<br>
<input name="Q1" type="radio" value="B">B Three apples
<br>
<input name="Q1" type="radio" value="C">C Two apples
<br>
<input name="Q1" type="radio" value="D">D One apple
<hr>
2. Ice will turn into water if the temperature is higher than __<sup>o</sup>C?
<br>
<input name="Q2" type="radio" value="A">A 50
<br>
<input name="Q2" type="radio" value="B">B 0
<br>
<input name="Q2" type="radio" value="C">C 100
<br>
<input name="Q2" type="radio" value="D">D 32
<hr>
3. Which of the following is correct?
<br>
<input name="Q3" type="radio" value="A">A The Sun is surrounding the Earth
<br>
<input name="Q3" type="radio" value="B">B The Earth is the center of the Solar System
<br>
<input name="Q3" type="radio" value="C">C The Earth is surrounding the Moon
<br>
<input name="Q3" type="radio" value="D">D The Earth is surrounding the Sun
<hr>
4. Which of the following is NOT a part of speech?<br>
<input name="Q4" type="radio" value="A">A Bold
<br>
<input name="Q4" type="radio" value="B">B Verb
<br>
<input name="Q4" type="radio" value="C">C Preposition
<br>
<input name="Q4" type="radio" value="D">D Noun
<hr>
5. Who is the first president of United States?
<br>
<input name="Q5" type="radio" value="A">A Bill Clinton
<br>
<input name="Q5" type="radio" value="B">B Abraham Lincoln
<br>
<input name="Q5" type="radio" value="C">C George Washington
<br>
<input name="Q5" type="radio" value="D">D Thomas Jefferson
<hr>
<input type='submit' value='GRADE IT'>
<input type='reset' value='Erase All Answers'>
</div>
</form>
</body>
</html>