Code:
<html>
<head>
<title>JavaScriptKit.com Multiple Choice Quiz Script</title>
<link rel="stylesheet" href="../css/my.css" type="text/css">
<script src="../js/quizconfig.js">
</script>
<script>
var actualchoices = [];
document.cookie="ready=yes"
</script>
</head>
<body>
<p align="center">
<form method="POST" name="myquiz">
<div class="gheader">
1)Variables declared outside a function, become
<div class="gselections">
<label><input type="radio" value="a" name="question1">a) International variables</label><br>
<label><input type="radio" value="b" name="question1"> b) Universal variables </label><br>
<label><input type="radio" value="c" name="question1"> c) Global variables </label><br>
<label> <input type="radio" value="d" name="question1"> d) Local variables </label><br>
</div>
</div>
<br>
<div class="gheader">
2)If you add a number and a string, the result will be?
<div class="gselections">
<label><input type="radio" value="a" name="question2"> a) Number</label><br>
<label> <input type="radio" value="b" name="question2"> b) Error</label><br>
<label><input type="radio" value="c" name="question2"> c) String + number </label><br>
<label> <input type="radio" value="d" name="question2"> d) String</label><br>
</div>
</div>
<br>
<div class="gheader">
3) In JavaScript, different kinds of Loop are
<div class="gselections">
<label> <input type="radio" value="a" name="question3">a) for</label><br>
<label> <input type="radio" value="b" name="question3"> b) for/in </label><br>
<label> <input type="radio" value="c" name="question3"> c) while</label><br>
<label> <input type="radio" value="d" name="question3"> d) for/out </label><br>
</div>
</div>
<br>
<div class="gheader">
4) JavaScript is
<div class="gselections">
<label> <input type="radio" value="a" name="question4">a) Prototype based language </label><br>
<label> <input type="radio" value="b" name="question4"></label>b) Class based language</label><br>
<label> <input type="radio" value="c" name="question4"> c) ID based language</label><br>
<label><input type="radio" value="d" name="question4">d) all of above</label><br>
</div>
</div>
<br>
<div class="gheader">
5) The Array object is used to store:
<div class="gselections">
<label><input type="radio" value="a" name="question5">a) Single value </label><br>
<label> <input type="radio" value="b" name="question5"> b) candies </label><br>
<label> <input type="radio" value="c" name="question5"> c) Multiple values </label><br>
<label> <input type="radio" value="d" name="question5"> d) bananas</label><br>
</div>
</div>
<br>
<div class="gheader">
6) What is the DOM?
<div class="gselections">
<label> <input type="radio" value="a" name="question6"> a) Difficult Object Model </label><br>
<label> <input type="radio" value="b" name="question6"> </label>b) Document Object Model<br>
<label><input type="radio" value="c" name="question6">c) Document Open Mouse </label><br>
<label> <input type="radio" value="d" name="question6"> </label>d) Document Open Model</label><br>
</div>
</div>
<br>
<div class="gheader">
7) Where is the correct place to insert a JavaScript
<div class="gselections">
<label><input type="radio" value="a" name="question7">a) The < head > section </label><br>
<label> <input type="radio" value="b" name="question7"> b) The < body > section </label><br>
<label><input type="radio" value="c" name="question7">c) both, a and b are correct </label><br>
<label><input type="radio" value="d" name="question7">d) none of above</label><br>
</div>
</div>
<br>
<div class="gheader">
8) How do you create a variable "x" that is equal to the integer 4?
<div class="gselections">
<label><input type="radio" value="a" name="question8">a) int x = 4;</label><br>
<label><input type="radio" value="b" name="question8">b) var x = 4;</label><br>
<label><input type="radio" value="c" name="question8">c) num x = 4;</label><br>
<label><input type="radio" value="d" name="question8">d) number x = 4;</label><br>
</div>
</div>
<br>
<div class="gheader">
9) The window object represents:
<div class="gselections">
<label><input type="radio" value="a" name="question9">a)an open window in a browser</label><br>
<label><input type="radio" value="b" name="question9">b)closed window in a browser</label><br>
<label><input type="radio" value="c" name="question9">c) an open window in a room</label><br>
<label><input type="radio" value="d" name="question9"> d) closed window in a browser</label><br>
</div>
</div>
<br>
<div class="gheader">
10) Which continent is host to the most countries in the world?
<div class="gselections">
<label><input type="radio" value="a" name="question10"> a) Asia</label><br>
<label><input type="radio" value="b" name="question10">b) Africa</label><br>
<label><input type="radio" value="c" name="question10">c) Europe</label><br>
</div>
</div>
<br>
<br>
<div align="center">
<input type="button" value="Grade Me!" name="B1" onClick="gradeit()"> <input type="button" value="Reset" name="B2" onClick="document.myquiz.reset()"></div>
</div>
</form>
<script type="text/javascript">
/*<![CDATA[*/
var Quiz={
Open:function(nme,n){
var o=this[nme];
if (o&&o.ary[n]){
o.ary[n].style.display='block';
}
},
init:function(o){
var nme=o.FormName,frm=document.forms[nme];
if (frm){
var clds=frm.childNodes,iips,i=0,z0=0;
o.ary=[];
for (;z0<clds.length;z0++){
if ((' '+clds[z0].className+' ').match(' '+o.SectionClass+' ')){
ips=clds[z0].getElementsByTagName('INPUT');
for (var z0a=0;z0a<ips.length;z0a++){
this.addevt(ips[z0a],'click','Open',nme,i+1);
}
clds[z0].style.display=i>0?'none':'block';
o.ary[i++]=clds[z0];
}
}
this[nme]=o;
}
},
addevt:function(o,t,f,p,p1){
var oop=this;
o.addEventListener?o.addEventListener(t,function(e){ return oop[f](p,p1);},false):o.attachEvent?o.attachEvent('on'+t,function(e){ return oop[f](p,p1); }):null;
}
}
Quiz.init({
FormName:'myquiz',
SectionClass:'gheader'
})
/*]]>*/
</script>
</body>
</html>
Bookmarks