Foundationdefault_logicIntermediate function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER%; COR=Correct%QUESTION.NUMBER% ; //displays general feedback ANS= Feedback%QUESTION.NUMBER%; SHOW ="" for (var i=5; iYour answer, "+document.forms.elements[item].value+", was correct.
"} else { if (document.forms.elements[item].value==allowed_input) {document.forms.elements[item+3].value = "
Your answer, "+document.forms.elements[item].value+", is incorrect. Ƥ(B) has "+p+" elements. Therefore, the correct answer ("+c+"th element) is "+COR+"

"+ANS+"
"+SHOW+"
"} else {document.forms.elements[item+3].value = "Your answer, "+document.forms.elements[item].value+", should have been "+COR+".
"+ANS+"
"+SHOW+"
"} } document.forms.elements[item+3].value = QuestionText%QUESTION.NUMBER%+ "
Type impossible if you think there are not that many elements in the power set of B, or if you think it is an empty set type {}"+document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { ///////////////// B set m = displayarray( 1, 3, 5, 1); myBArray = displayarray( m, 0, 9, 1); b_set = ""; for(ip=0; ipWhat is the "+c+ordStringOf(c)+" element of Ƥ(B) when listing elements of the power set B using the ordering shown for the set A (increasing cardinality of subsets, and elements of subsets listed in increasing numerical order)?

" allowed_input = "impossible"; allowed_input2 = "{}"; Correct%QUESTION.NUMBER% = allowed_input; //document.write(Correct%QUESTION.NUMBER%+"

"); Feedback%QUESTION.NUMBER% = "

If B is a finite set with n elements, then the power set of B contains 2n elements.

Since B contains "+m+" elements, the power set of B has 2"+m+" = "+p+" elements.

Therefore it is impossible to find the "+c+ordStringOf(c)+" element of Ƥ(B). " document.write("

"+QuestionText%QUESTION.NUMBER%); document.write("
Type impossible if you think there are not that many elements in the power set of B, or if you think it is an empty set type {}."); document.write("") } if (document.forms.name=="FEEDBACK") {} else {question%QUESTION.NUMBER%()} ]]> "Choice" INCLUDES NOCASE "was correct"Your answer was correct.]]> "Choice" INCLUDES NOCASE "should have been"Your answer was wrong.]]> OTHERYou did not give an answer!]]> if (document.forms.name=="FEEDBACK") { Count=document.forms.elements.length document.write(document.forms.elements[Count-1].value) var titleofpopup = "Related material"; var help = wheretolook("%QUESTION.TAGS%","%QUESTION.TOPIC%"); document.write("

"+""+"
") } ]]>
FoundationIntermediate function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER%; COR=Correct%QUESTION.NUMBER% ; //displays general feedback ANS= Feedback%QUESTION.NUMBER%; SHOW ="" for (var i=5; iYour answer, "+document.forms.elements[item].value+", was correct.
"} else { if (document.forms.elements[item].value==allowed_input) {document.forms.elements[item+3].value = "
Your answer, "+document.forms.elements[item].value+", is incorrect. Ƥ(B) has "+p+" elements. Therefore, the correct answer ("+c+"th element) is "+COR+"

"+ANS+"
"+SHOW+"
"} else {document.forms.elements[item+3].value = "Your answer, "+document.forms.elements[item].value+", should have been "+COR+".
"+ANS+"
"+SHOW+"
"} } document.forms.elements[item+3].value = QuestionText%QUESTION.NUMBER%+ "
Type impossible if you think there are not that many elements in the power set of B, or if you think it is an empty set type {}."+document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { b=3; myAArray = displayarray( 4, 0, 9, 1); a1=myAArray; a2=myAArray; a3=myAArray; var a_set = new Array(""+myAArray+"", ""+myAArray+"", ""+myAArray+""); aset = a_set.sort(function(a,b){return a - b}); aset_string=aset.join(); var power_set = new Array("∅","{"+aset_string.charAt(0)+"}","{"+aset_string.charAt(2)+"}","{"+aset_string.charAt(4)+"}","{"+aset_string.charAt(0)+","+aset_string.charAt(2)+"}","{"+aset_string.charAt(0)+","+aset_string.charAt(4)+"}","{"+aset_string.charAt(2)+","+aset_string.charAt(4)+"}","{"+aset_string.charAt(0)+","+aset_string.charAt(2)+","+aset_string.charAt(4)+"}"); p=Math.pow(2, b); myCArray = displayarray( 1, b+2, p, 1); c=myCArray; QuestionText%QUESTION.NUMBER% = "Let A = {1,2}. Then Ƥ(A) = {∅,{1},{2},{1,2}}.

Now let B = {"+aset_string+"}.

What is the "+c+ordStringOf(c)+" element of Ƥ(B) when listing elements of the power set B using the ordering shown for the set A (increasing cardinality of subsets, and elements of subsets listed in increasing numerical order)?

" allowed_input = "impossible"; allowed_input2 = "{}"; Correct%QUESTION.NUMBER% = power_set[c-1]; //document.write(Correct%QUESTION.NUMBER%+"

"); Feedback%QUESTION.NUMBER% = "

You should have written Ƥ(B) as {"+power_set+"}.

Then counting gives the "+c+ordStringOf(c)+" element of this set as "+Correct%QUESTION.NUMBER%+". " document.write("

"+QuestionText%QUESTION.NUMBER%); document.write("
Type impossible if you think there are not that many elements in the power set of B, or if you think it is an empty set type {}."); document.write("") } if (document.forms.name=="FEEDBACK") {} else {question%QUESTION.NUMBER%()} ]]> "Choice" INCLUDES NOCASE "was correct"Your answer was correct.]]> "Choice" INCLUDES NOCASE "should have been"Your answer was wrong.]]> OTHERYou did not give an answer!]]> if (document.forms.name=="FEEDBACK") { Count=document.forms.elements.length document.write(document.forms.elements[Count-1].value) var titleofpopup = "Related material"; var help = wheretolook("%QUESTION.TAGS%","%QUESTION.TOPIC%"); document.write("

"+""+"
") } ]]>
FoundationIntermediate function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER%; COR=Correct%QUESTION.NUMBER% ; //displays general feedback ANS= Feedback%QUESTION.NUMBER%; SHOW ="" for (var i=5; iYour answer, "+document.forms.elements[item].value+", was correct.
"} else { if (document.forms.elements[item].value==allowed_input) {document.forms.elements[item+3].value = "
Your answer, "+document.forms.elements[item].value+", is incorrect. Ƥ(B) has "+p+" elements. Therefore, the correct answer ("+c+"th element) is "+COR+"

"+ANS+"
"+SHOW+"
"} else {document.forms.elements[item+3].value = "Your answer, "+document.forms.elements[item].value+", should have been "+COR+".
"+ANS+"
"+SHOW+"
"} } document.forms.elements[item+3].value = QuestionText%QUESTION.NUMBER%+ "
Type impossible if you think there are not that many elements in the power set of B, or if you think it is an empty set type {}."+document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { b=4; myAArray = displayarray( 4, 0, 9, 1); a1=myAArray; a2=myAArray; a3=myAArray; a4=myAArray; var a_set = new Array(""+myAArray+"", ""+myAArray+"", ""+myAArray+"", ""+myAArray+""); aset = a_set.sort(function(a,b){return a - b}); aset_string=aset.join(); var power_set = new Array("∅","{"+aset_string.charAt(0)+"}","{"+aset_string.charAt(2)+"}","{"+aset_string.charAt(4)+"}","{"+aset_string.charAt(6)+"}","{"+aset_string.charAt(0)+","+aset_string.charAt(2)+"}","{"+aset_string.charAt(0)+","+aset_string.charAt(4)+"}","{"+aset_string.charAt(0)+","+aset_string.charAt(6)+"}","{"+aset_string.charAt(2)+","+aset_string.charAt(4)+"}","{"+aset_string.charAt(2)+","+aset_string.charAt(6)+"}","{"+aset_string.charAt(4)+","+aset_string.charAt(6)+"}","{"+aset_string.charAt(0)+","+aset_string.charAt(2)+","+aset_string.charAt(4)+"}","{"+aset_string.charAt(0)+","+aset_string.charAt(2)+","+aset_string.charAt(6)+"}","{"+aset_string.charAt(0)+","+aset_string.charAt(4)+","+aset_string.charAt(6)+"}","{"+aset_string.charAt(2)+","+aset_string.charAt(4)+","+aset_string.charAt(6)+"}","{"+aset_string.charAt(0)+","+aset_string.charAt(2)+","+aset_string.charAt(4)+","+aset_string.charAt(6)+"}"); p=Math.pow(2, b); myCArray = displayarray( 1, b+2, p, 1); c=myCArray; QuestionText%QUESTION.NUMBER% = "Let A = {1,2}. Then Ƥ(A) = {∅,{1},{2},{1,2}}.

Now let B = {"+aset_string+"}.

What is the "+c+ordStringOf(c)+" element of Ƥ(B) when listing elements of the power set B using the ordering shown for the set A (increasing cardinality of subsets, and elements of subsets listed in increasing numerical order)?

" allowed_input = "impossible"; allowed_input2 = "{}"; Correct%QUESTION.NUMBER% = power_set[c-1]; //document.write(Correct%QUESTION.NUMBER%+"

"); Feedback%QUESTION.NUMBER% = "

You should have written Ƥ(B) as {"+power_set+"}.

Then counting gives the "+c+ordStringOf(c)+" element of this set as "+Correct%QUESTION.NUMBER%+". " document.write("

"+QuestionText%QUESTION.NUMBER%); document.write("
Type impossible if you think there are not that many elements in the power set of B, or if you think it is an empty set type {}."); document.write("") } if (document.forms.name=="FEEDBACK") {} else {question%QUESTION.NUMBER%()} ]]> "Choice" INCLUDES NOCASE "was correct"Your answer was correct.]]> "Choice" INCLUDES NOCASE "should have been"Your answer was wrong.]]> OTHERYou did not give an answer!]]> if (document.forms.name=="FEEDBACK") { Count=document.forms.elements.length document.write(document.forms.elements[Count-1].value) var titleofpopup = "Related material"; var help = wheretolook("%QUESTION.TAGS%","%QUESTION.TOPIC%"); document.write("

"+""+"
") } ]]>
FoundationEasy function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER% COR=Correct%QUESTION.NUMBER% DISA=Distractor1%QUESTION.NUMBER% DISB=Distractor2%QUESTION.NUMBER% ANS= Feedback%QUESTION.NUMBER%; SHOW ="" for (var i=5; iYour answer, "+document.forms.elements[item].value+", was correct.
"} else { if (document.forms.elements[item].value==DISA) {document.forms.elements[item+3].value = "
Your answer, "+document.forms.elements[item].value+", isn't correct. It should have been "+COR+"

"+ANS+"
"+SHOW+"
"} else { if (document.forms.elements[item].value==DISB) {document.forms.elements[item+3].value = "
Your answer, "+document.forms.elements[item].value+", is incorrect. It should have been "+COR+"

"+ANS+"
"+SHOW+"
"} else {document.forms.elements[item+3].value = "
Your answer "+document.forms.elements[item].value+", ought to have been "+COR+"

"+ANS+"
"+SHOW+"
"} }} document.forms.elements[item+3].value = QT + document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { i = Math.ceil(18*Math.random()); myNumArray = displayarray( 1, 0, 10, 1); n = myNumArray; elements=""; if(n == 0){elements=""+n+" elements"} else if(n == 1){elements="exactly "+n+" distinct element"} else{elements="exactly "+n+" distinct elements"}; QuestionText%QUESTION.NUMBER% = "Suppose "+varname(i,1)+" is a set with "+elements+". How many elements does Ƥ("+varname(i,1)+") have?
" Correct%QUESTION.NUMBER%=Math.pow(2, n); Distractor1%QUESTION.NUMBER% = n; Distractor2%QUESTION.NUMBER% = 2*n; Feedback%QUESTION.NUMBER% = "

Ƥ("+varname(i,1)+") denotes the power set of "+varname(i,1)+". It is the collection of all subsets of a given set "+varname(i,1)+" (including the empty set and the full set "+varname(i,1)+" itself).

If "+varname(i,1)+" is a finite set with n elements, then the power set of "+varname(i,1)+" contains 2n elements.

Since "+varname(i,1)+" is a set with "+elements+", the power set of "+varname(i,1)+" has 2"+n+" = "+Correct%QUESTION.NUMBER%+" element(s). " //document.write(ANS); document.write(QuestionText%QUESTION.NUMBER%); document.write("
") document.write("") } if (document.forms.name=="FEEDBACK") {} else {question%QUESTION.NUMBER%()} ]]> "Choice" INCLUDES NOCASE "was Correct"Well done! "Choice" INCLUDES NOCASE "ought to have been"Write down the question and ask a teacher how to do it.]]> "Choice" INCLUDES NOCASE "isn't correct"You have probably assumed that the number of elements of a given set is the same as the number of elements of its power set. After reading the above explanation you should understand the difference between them. "Choice" INCLUDES NOCASE "is incorrect"You have probably used the wrong formulae (2n instead of 2^n) for the number of elements in the power set. OTHER if (document.forms.name=="FEEDBACK") { Count=document.forms.elements.length document.write(document.forms.elements[Count-1].value) var titleofpopup = "Related material"; var help = wheretolook("%QUESTION.TAGS%","%QUESTION.TOPIC%"); document.write("

"+""+"
") } // Template updated and developed by Daniel Nichols & Martin Greenhow, Brunel University, July 2004, working // on original templates authored by Dominic Smith of Brunel University, July 2001, with // valuable contributions from Professor David Hewitt of Monash University, Australia. ]]>
FoundationEasy function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER% COR=Correct%QUESTION.NUMBER% ANS = Feedback%QUESTION.NUMBER%; SHOW = " " for (var i=5; iYour answer, "+document.forms.elements[item].value+" was correct.
"} else {document.forms.elements[item+3].value = "Your answer "+document.forms.elements[item].value+", should have been "+COR+"

"+ANS+"
"+SHOW+"
"} document.forms.elements[item+3].value = QT + document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { myBArray = displayarray( 1, 0, 10, 1); b=myBArray; myAArray = displayarray( 1, -10, 15, 1); a=myAArray; set = ""; b_floor = a for(ib = 0; ib <= b-2; ib++){ set += b_floor+ib+","} set += (b_floor+b-1); i = Math.ceil(18*Math.random()); if(b == 0){givenset ="∅"}else{givenset = "{"+set+"}"} QuestionText%QUESTION.NUMBER% = "Suppose "+varname(i,1)+" = "+givenset+". How many elements does Ƥ("+varname(i,1)+") have?

" Correct%QUESTION.NUMBER%=Math.pow(2, b); elements=""; if(b == 0){elements="no elements"} else if(b == 1){elements="exactly "+b+" distinct element"} else{elements="exactly "+b+" distinct elements"}; Feedback%QUESTION.NUMBER% = "

Ƥ("+varname(i,1)+") denotes the power set of "+varname(i,1)+". It is the collection of all subsets of a given set "+varname(i,1)+" (including the empty set and the full set "+varname(i,1)+" itself).

If "+varname(i,1)+" is a finite set with n elements, then the power set of "+varname(i,1)+" contains 2n elements.

Since "+varname(i,1)+" contains "+elements+", the power set of "+varname(i,1)+" has 2"+b+" = "+Correct%QUESTION.NUMBER%+" element(s). " //document.write(Correct%QUESTION.NUMBER%); document.write(QuestionText%QUESTION.NUMBER%); document.write("") document.write("") } if (document.forms.name=="FEEDBACK") {} else {question%QUESTION.NUMBER%()} ]]> "Choice" INCLUDES NOCASE "was Correct"Well done!]]> "Choice" INCLUDES NOCASE "should have been"Your answer is wrong! Write down the question and ask someone for help!]]> OTHERYou should have tried this question!]]> if (document.forms.name=="FEEDBACK") { Count=document.forms.elements.length document.write(document.forms.elements[Count-1].value) var titleofpopup = "Related material"; var help = wheretolook("%QUESTION.TAGS%","%QUESTION.TOPIC%"); document.write("

"+""+"
") } // Template updated and developed by Daniel Nichols & Martin Greenhow, Brunel University, July 2004, working // on original templates authored by Dominic Smith of Brunel University, July 2001, with // valuable contributions from Professor David Hewitt of Monash University, Australia. ]]>
FoundationEasy function getGrid(Nrow,Ndomains,Ncolumn) { var Rgrid = new Array Rgrid = new Array; for (k = 1 ; k <= Nrow ; k++) {Rgrid[k] = new Array;} for (var i=1; i<=Nrow; i++) {for (var j=1; j<=Ndomains; j++) {Rgrid[i][j] = new Array; {for (var l=1; l<=Ncolumn; l++) {Rgrid[i][j][l] = "F";} }} } //alert(Rgrid) return (Rgrid); } function process%QUESTION.NUMBER%(QNo) { if ( document.forms.name != "FEEDBACK" ) { QT = QuestionText%QUESTION.NUMBER% COR = Correct%QUESTION.NUMBER% ANS= Feedback%QUESTION.NUMBER%; SHOW ="" //displays the top half of the feedback page. It firstly detects the answer you have inputted. If incorrect it re-displays the question, followed by the answer that you inputted followed by what the correct answer should have been. for ( var i=5; iNone of these!" ) {document.forms.elements[item+3].value = "Your answer "+document.forms.elements[item].value+ " was correct. The actual answer is "+Answer%QUESTION.NUMBER%+".
"} else {document.forms.elements[item+3].value = "Your answer "+document.forms.elements[item].value+" was correct.
"} } else { if (document.forms.elements[item].value==Distractor1%QUESTION.NUMBER%) {document.forms.elements[item+3].value= "1). Your answer "+document.forms.elements[item].value+" should have been "+COR+".
"+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor2%QUESTION.NUMBER%) {document.forms.elements[item+3].value= "2). Your answer "+document.forms.elements[item].value+" should have been "+COR+".
"+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor3%QUESTION.NUMBER%) {document.forms.elements[item+3].value= "3). Your answer "+document.forms.elements[item].value+" should have been "+COR+".
"+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor4%QUESTION.NUMBER%) {document.forms.elements[item+3].value= "4). Your answer "+document.forms.elements[item].value+" should have been "+COR+".
"+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value=="None of these!") {document.forms.elements[item+3].value= "5). Your answer "+document.forms.elements[item].value+" should have been "+COR+".
"+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value=="I don't know!") {document.forms.elements[item+3].value= "6). You did not know! The answer should have been "+COR+".
"+ANS+"
"+SHOW+"
" } } } } } } } } } } document.forms.elements[item+3].value = QT + document.forms.elements[item+3].value } Choice%QUESTION.NUMBER% = new Array(4) function question%QUESTION.NUMBER%() { i = Math.ceil(18*Math.random()); myNArray = displayarray( 3, 1, 9, 1); n1 = myNArray; n2 = myNArray; n3 = myNArray; var a_set = new Array(""+myNArray+"", ""+myNArray+"", ""+myNArray+""); aset = a_set.sort(function(a,b){return a - b}); aset_string=aset.join(); e1=aset_string.charAt(0); e2=aset_string.charAt(2); e3=aset_string.charAt(4); QuestionText%QUESTION.NUMBER% = "Find the power set of the set "+varname(i,1)+" = {"+n1+","+n2+","+n3+"}

"; Correct%QUESTION.NUMBER% = "Ƥ("+varname(i,1)+") = {∅,{"+e1+"},{"+e2+"},{"+e3+"},{"+e1+","+e2+"},{"+e1+","+e3+"},{"+e2+","+e3+"},{"+e1+","+e2+","+e3+"}}"; Distractor1%QUESTION.NUMBER% = "Ƥ("+varname(i,1)+") = {{"+e1+"},{"+e2+"},{"+e3+"},{"+e1+","+e2+"},{"+e1+","+e3+"},{"+e2+","+e3+"}}"; Distractor2%QUESTION.NUMBER% = "Ƥ("+varname(i,1)+") = {{"+e1+"},{"+e2+"},{"+e3+"},{"+e1+","+e2+"},{"+e1+","+e3+"},{"+e2+","+e3+"},{"+e1+","+e2+","+e3+"}}"; Distractor3%QUESTION.NUMBER% = "Ƥ("+varname(i,1)+") = {∅,{"+e1+"},{"+e2+"},{"+e3+"},{"+e1+","+e2+"},{"+e1+","+e3+"},{"+e2+","+e3+"}}"; Distractor4%QUESTION.NUMBER% = "Ƥ("+varname(i,1)+") = {{"+e1+"},{"+e2+"},{"+e3+"}}"; Feedback%QUESTION.NUMBER% = "

The power set of "+varname(i,1)+", denoted Ƥ("+varname(i,1)+"), is the set of all subsets of a given set "+varname(i,1)+" (including the empty set and the full set "+varname(i,1)+" itself). Therefore, the correct answer is "+Correct%QUESTION.NUMBER%+"" //document.write(e1+e2+e3) //document.write(Feedback%QUESTION.NUMBER%) //following code describes the options that the user has NOT = Math.ceil(8*Math.random()); xxx = Math.ceil(4*Math.random()); if ( NOT==1 ) { Answer%QUESTION.NUMBER% = Correct%QUESTION.NUMBER% Correct%QUESTION.NUMBER% = "None of these!" Choice%QUESTION.NUMBER%[xxx] = Distractor4%QUESTION.NUMBER% } else { Choice%QUESTION.NUMBER%[xxx] = Correct%QUESTION.NUMBER% } Choice%QUESTION.NUMBER%[xxx+1] = Distractor1%QUESTION.NUMBER% Choice%QUESTION.NUMBER%[xxx+2] = Distractor2%QUESTION.NUMBER% Choice%QUESTION.NUMBER%[xxx+3] = Distractor3%QUESTION.NUMBER% for ( var yyy=xxx; yyy<=xxx+3; yyy++ ) { if ( yyy>4 ) { Choice%QUESTION.NUMBER%[yyy-4] = Choice%QUESTION.NUMBER%[yyy] } } if ( NOT==1 ) { Choice%QUESTION.NUMBER% = Correct%QUESTION.NUMBER% Choice%QUESTION.NUMBER% = "I don't know!" } else { Choice%QUESTION.NUMBER% = "None of these!" Choice%QUESTION.NUMBER% = "I don't know!" } radio = "" for ( i=1; i<7; i++ ) { if ( i==1 ) {document.write(QuestionText%QUESTION.NUMBER% + radio + Choice%QUESTION.NUMBER%[i] + "
")} else {document.write(radio + Choice%QUESTION.NUMBER%[i] + "