Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shivani komandury-Second #89

37 changes: 25 additions & 12 deletions src/lab/exp2/quizconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
***********************************************/

//Enter total number of questions:
var totalquestions=5

var totalquestions=5;
var q=1;
var c=0;
var i=1;
var incorrect=null;
var temp=0;
var actualchoices=new Array(200);
//Enter the solutions corresponding to each question:
var correctchoices=new Array()
var correctchoices=new Array();
correctchoices[1]='a' //question 1 solution
correctchoices[2]='a' //question 2 solution, and so on.
correctchoices[3]='a'
Expand All @@ -20,30 +25,36 @@ correctchoices[5]='e'
/////Don't edit beyond here//////////////////////////

function gradeit(){
var incorrect=null

for (q=1;q<=totalquestions;q++){
var thequestion=eval("document.myquiz.question"+q)
for (c=0;c<thequestion.length;c++){
if (thequestion[c].checked==true)
if (thequestion[c].checked===true){
actualchoices[q]=thequestion[c].value
}
}

if (actualchoices[q]!=correctchoices[q]){ //process an incorrect choice
if (incorrect==null)
if (incorrect===null){
incorrect=q
else
}
else{
incorrect+="/"+q
}
}
}

if (incorrect==null)
if (incorrect===null){
incorrect="a/b"
}
document.cookie='q='+incorrect
if (document.cookie=='')
if (document.cookie===""){
alert("Your browser does not accept cookies. Please adjust your browser settings.")
else
}
else{
window.location="results.htm"
}
}


function showsolution(){
Expand All @@ -56,16 +67,18 @@ win2.document.write('<center><h3>Solution to Quiz</h3></center>')
win2.document.write('<center><font face="Arial">')
for (i=1;i<=totalquestions;i++){
for (temp=0;temp<incorrect.length;temp++){
if (i==incorrect[temp])
if (i===incorrect[temp]){
wrong=1
}
}
if (wrong==1){
win2.document.write("Question "+i+"="+correctchoices[i].fontcolor("red")+"<br>")
wrong=0
}
else
else{
win2.document.write("Question "+i+"="+correctchoices[i]+"<br>")
}
}
win2.document.write('</center></font>')
win2.document.write("<h5>Note: The solutions in red are the ones to the questions you had incorrectly answered.</h5>")
win2.document.close()
Expand Down
37 changes: 25 additions & 12 deletions src/lab/exp5/quizconfig.js → src/lab/exp5/quizconfigexp5.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,50 @@
***********************************************/

//Enter total number of questions:
var totalquestions=1

var totalquestions=1;
var q=1;
var c=0;
var i=1;
var temp=0;
var incorrect=null;
var actualchoices=new Array(200);
//Enter the solutions corresponding to each question:
var correctchoices=new Array()
var correctchoices=new Array();
correctchoices[1]='b' //question 1 solution

/////Don't edit beyond here//////////////////////////

function gradeit(){
var incorrect=null

for (q=1;q<=totalquestions;q++){
var thequestion=eval("document.myquiz.question"+q)
for (c=0;c<thequestion.length;c++){
if (thequestion[c].checked==true)
if (thequestion[c].checked===true){
actualchoices[q]=thequestion[c].value
}
}

if (actualchoices[q]!=correctchoices[q]){ //process an incorrect choice
if (incorrect==null)
if (incorrect==null){
incorrect=q
else
}
else{
incorrect+="/"+q
}
}
}

if (incorrect==null)
if (incorrect===null){
incorrect="a/b"
}
document.cookie='q='+incorrect
if (document.cookie=='')
if (document.cookie===""){
alert("Your browser does not accept cookies. Please adjust your browser settings.")
else
}
else{
window.location="results.htm"
}
}


function showsolution(){
Expand All @@ -51,16 +62,18 @@ win2.document.write('<center><h3>Solution to Quiz</h3></center>')
win2.document.write('<center><font face="Arial">')
for (i=1;i<=totalquestions;i++){
for (temp=0;temp<incorrect.length;temp++){
if (i==incorrect[temp])
if (i===incorrect[temp]){
wrong=1
}
}
if (wrong==1){
win2.document.write("Question "+i+"="+correctchoices[i].fontcolor("red")+"<br>")
wrong=0
}
else
else{
win2.document.write("Question "+i+"="+correctchoices[i]+"<br>")
}
}
win2.document.write('</center></font>')
win2.document.write("<h5>Note: The solutions in red are the ones to the questions you had incorrectly answered.</h5>")
win2.document.close()
Expand Down
37 changes: 24 additions & 13 deletions src/lab/exp7/quizconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,51 @@
***********************************************/

//Enter total number of questions:
var totalquestions=2

var totalquestions=2;
var q=1;
var c=0;
var i=1;
var temp=0;
var incorrect=null;
var actualchoices=new Array(200);
//Enter the solutions corresponding to each question:
var correctchoices=new Array()
var correctchoices=new Array();
correctchoices[1]='c' //question 1 solution
correctchoices[2]='b' //question 2 solution, and so on.


/////Don't edit beyond here//////////////////////////

function gradeit(){
var incorrect=null
for (q=1;q<=totalquestions;q++){
var thequestion=eval("document.myquiz.question"+q)
for (c=0;c<thequestion.length;c++){
if (thequestion[c].checked==true)
if (thequestion[c].checked===true){
actualchoices[q]=thequestion[c].value
}
}

if (actualchoices[q]!=correctchoices[q]){ //process an incorrect choice
if (incorrect==null)
if (incorrect==null){
incorrect=q
else
}
else{
incorrect+="/"+q
}
}
}

if (incorrect==null)
if (incorrect===null){
incorrect="a/b"
}
document.cookie='q='+incorrect
if (document.cookie=='')
if (document.cookie===""){
alert("Your browser does not accept cookies. Please adjust your browser settings.")
else
}
else{
window.location="results.htm"
}

}

function showsolution(){
var win2=window.open("","win2","width=200,height=350, scrollbars")
Expand All @@ -53,16 +62,18 @@ win2.document.write('<center><h3>Solution to Quiz</h3></center>')
win2.document.write('<center><font face="Arial">')
for (i=1;i<=totalquestions;i++){
for (temp=0;temp<incorrect.length;temp++){
if (i==incorrect[temp])
if (i===incorrect[temp]){
wrong=1
}
}
if (wrong==1){
win2.document.write("Question "+i+"="+correctchoices[i].fontcolor("red")+"<br>")
wrong=0
}
else
else{
win2.document.write("Question "+i+"="+correctchoices[i]+"<br>")
}
}
win2.document.write('</center></font>')
win2.document.write("<h5>Note: The solutions in red are the ones to the questions you had incorrectly answered.</h5>")
win2.document.close()
Expand Down