'; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += '
'; var QButtonsOpener = ''; var QButtonsCloser = ''; var TableOpener = '
'; TableOpener += ''; var QRow = ''; QRow += ''; var ARow = ''; var MARow = ''; var CheckButton = ''; TableCloser = '
[QNumber].  

[Question]
 

'; QRow += '
 '; ARow += ''; ARow += ''; ARow += ''; ARow += '
        [Ans]
'; MARow += '[Ans]
'; CheckButton += ''; CheckButton += '
'; function ReduceItems(){ var ItemToDump=0; var j=0; while (I.length > QsToShow){ ItemToDump = Math.floor(I.length*Math.random()); for (j=ItemToDump; j<(I.length-1); j++){ I[j] = I[j+1]; } I.length = I.length-1; } } function Shuffle(InArray){ Temp = new Array(); var Len = InArray.length; var j = Len; for (var i=0; i
'; document.getElementById('FeedbackContent').innerHTML = Output; var FDiv = document.getElementById('FeedbackDiv'); //Calculate and set its left setting topZ++; FDiv.style.zIndex = topZ; //Position the feedback div pg = new PageDim(); FDiv.style.left = Math.floor(pg.W/3) + 'px'; FDiv.style.width = Math.floor(pg.W/3) + 'px'; //Set the top again in case the window has been resized if (is.ns){ FDiv.style.top = Math.floor(pg.H/3) + window.pageYOffset + 'px'; } else{ FDiv.style.top = Math.floor(pg.H/3) + document.body.scrollTop + 'px'; } FDiv.style.display = 'block'; document.getElementById('FeedbackOKButton').focus(); } function HideFeedback(){ document.getElementById('FeedbackOKButton').blur(); document.getElementById('FeedbackContent').innerHTML = ''; document.getElementById('FeedbackDiv').style.display='none'; document.getElementById('NextQButton').focus(); if (Finished == true){ Finish(); } } function WriteToInstructions(Feedback) { Feedback = '' + Feedback + ''; document.getElementById('InstructionsDiv').innerHTML = Feedback; } function WriteScore(Feedback) { Feedback = '' + Feedback + ''; document.getElementById('ScoreDiv').innerHTML = Feedback; } function StartUp(){ //IE bug avoidance -- remove bottom navbar if (is.ie){ if (document.getElementById('BottomNavBar') != null){ document.getElementById('TheBody').removeChild(document.getElementById('BottomNavBar')); } } if (is.ie){ document.attachEvent('onkeydown',SuppressBackspace); window.attachEvent('onkeydown',SuppressBackspace); } else if (is.ns){ window.addEventListener('keypress',SuppressBackspace,false); } //Try to get user name UserName = prompt('\u0050\u006C\u0065\u0061\u0073\u0065\u0020\u0065\u006E\u0074\u0065\u0072\u0020\u0079\u006F\u0075\u0072\u0020\u006E\u0061\u006D\u0065\u003A',''); UserName += ''; if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){ UserName = prompt('\u0050\u006C\u0065\u0061\u0073\u0065\u0020\u0065\u006E\u0074\u0065\u0072\u0020\u0079\u006F\u0075\u0072\u0020\u006E\u0061\u006D\u0065\u003A',''); UserName += ''; if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){ history.back(); } } //Reduce array if required if (QsToShow < I.length){ ReduceItems(); } //Shuffle stuff if required if (ShuffleQs == true){ I = Shuffle(I); } if (ShuffleAs == true){ for (var i=0; i= Status[QNum][1].length-1){ Status[QNum][0] = 1; for (var i=0; i-1){ FirstBit = InString.substring(0, i); LastBit = InString.substring(i + Token.length, InString.length); InString = FirstBit + Replacement + LastBit; i = InString.indexOf(Token); } return InString; } function ChangeQ(ChangeBy){ var NewNum = CurrQNum + ChangeBy; if ((NewNum >= 0)&&(NewNum=0; i--){ //Find any incorrect choices var b = eval('document.QForm.A_' + QNum + '_' + i); if (b != null){ //if it's wrong, count it if (b.checked == true){ Status[QNum][1][i] = 'C'; } else{ Status[QNum][1][i] = 'U'; } if (((b.checked == true) && (b.value == "0"))||((b.checked == false)&&(b.value == "1"))){ TotWrong++; } } } if (TotWrong == 0){ Output = DefaultRight; } else{ Output = DefaultWrong + '
' + (TotAns-TotWrong) + '/' + TotAns; } //If you haven't tried the question before if (Status[QNum][0] == 0){ if (TotWrong > 0){ Status[QNum][2]++; } if (TotWrong == 0){ Status[QNum][0] = 1; //Calculate the score for this question as a floating-point fraction of 1 Status[QNum][3] = ((Status[QNum][1].length - Status[QNum][2]) - 1) / (Status[QNum][1].length - 1); //If less than zero, set to zero if (Status[QNum][3] < 0){Status[QNum][3] = 0;} } } //Check whether the quiz is finished Finished = true; for (var i=0; i' + CurrScore; WriteScore(CurrScore); } if (Finished == true){ var CFT = 0; for (i=0; i 0){ WriteFeedback(Output); } } function CheckAnswer(QNum, ANum){ var Output = I[QNum][1][ANum][1]; if (Output==''){ if (I[QNum][1][ANum][2] == 1){ Output = DefaultRight; } else{ Output = DefaultWrong; } } //If it's not been previously answered correctly if (Status[QNum][0] == 0){ //If it's a correct answer if (I[QNum][1][ANum][2] == 1){ Status[QNum][0] = 1;//Mark the Q as done Status[QNum][1][ANum] = 'R'; MarkAnswer(QNum, ANum, true); //Calculate the score for this question as a floating-point fraction of 1 var PossibleWrongs = 0; for (var i=0; i' + CurrScore; WriteScore(CurrScore); } if (Finished == true){ var CFT = 0; for (i=0; i 0){ WriteFeedback(Output); } } function CalculateScore(){ var TriedQs = 0; var TotalScore = 0; for (var i=0; i 0)||(Status[i][3] == 1)){ TriedQs++; TotalScore += Status[i][3]; } } if (TriedQs == 0){ Score = 0; } else{ Score = (Math.floor(100 * (TotalScore/TriedQs))); } } function MarkAnswer(QNum, ANum, Right, Done){ if (Done == false){ var Mark = CorrectIndicator; if (Right == false){Mark = IncorrectIndicator;} document.getElementById('FB_' + QNum + '_' + ANum).innerHTML = Mark; } else{ if (Right == false){ document.getElementById('FB_' + QNum + '_' + ANum).innerHTML = IncorrectIndicator; } else{ document.getElementById('FB_' + QNum + '_' + ANum).innerHTML = CorrectIndicator; } } } function CheckCheckbox(QNum, ANum){ if (eval('document.QForm.A_' + QNum + '_' + ANum) != null){ eval('document.QForm.A_' + QNum + '_' + ANum).checked = true; } } function SendResults(Score){ var today = new Date; var NewName = '' + today.getTime(); var NewWin = window.open('', NewName, 'toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=no,,width=400,height=300'); NewWin.document.clear(); NewWin.document.open(); NewWin.document.write(ResultForm); NewWin.document.close(); NewWin.document.Results.Score.value = Score + '%'; NewWin.document.Results.realname.value = UserName; NewWin.document.Results.End_Time.value = (new Date()).toLocaleString(); NewWin.document.Results.Start_Time.value = StartTime; NewWin.document.Results.submit(); } function Finish(){ //If there's a form, fill it out and submit it if (document.store != null){ Frm = document.store; Frm.starttime.value = HPNStartTime; Frm.endtime.value = (new Date()).getTime(); Frm.mark.value = Score; Frm.submit(); } } //--> //]]>
Objective Test (A)
Multiple-choice exercise

Choose the correct answer for each question.