// JavaScript Document
<!-- Begin
// Insert number of questions
var numQues = 10;

// Insert number of choices in each question
var numChoi = 3;

// Insert number of questions displayed in answer area
var answers = new Array(10);

// Insert answers to questions
answers[0] = "The programs or instructions that tell the computer what to do";
answers[1] = "random-accessed memory";
answers[2] = "Approximately a million bytes";
answers[3] = "Hard copy";
answers[4] = "device that allows your computer to talk to other computers over a telephone line";
answers[5] = "Read only memory";
answers[6] = "central processing unit";
answers[7] = "Uninterrupted power supply";
answers[8] = "Input device";
answers[9] = "A video or computer display device";


// Do not change anything below here ...
function getScore(form) {
  var score = 0;
  var currElt;
  var currSelection;
  for (i=0; i<numQues; i++) {
    currElt = i*numChoi;
    for (j=0; j<numChoi; j++) {
      currSelection = form.elements[currElt + j];
      if (currSelection.checked) {
        if (currSelection.value == answers[i]) {
          score++;
          break;
        }
      }
    }
  }
  score = Math.round(score/numQues*100);
  form.percentage.value = score + "%";
  var correctAnswers = "";
  for (i=1; i<=numQues; i++) {
    correctAnswers += i + ". " + answers[i-1] + "\r\n";
  }
  form.solutions.value = correctAnswers;
}
//  End -->
