Level 1Intermediate function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER% ET=EquationText%QUESTION.NUMBER% COR=Correct%QUESTION.NUMBER% LB=B.length W=getFontSize()/16*(80*LB); a1="" a2="" a3="" workings=""; for (var place=0; place"+B.charAt(LB-place-1)+"×"+base+""+place+""} else{workings=workings+"+"+B.charAt(LB-place-1)+"×"+base+""+place+""} }; m1%QUESTION.NUMBER%="" feedback=a1+a2+a3+m1%QUESTION.NUMBER%; ANS= "To obtain the decimal representation of a base "+base+" number, we write it in reverse as:
" SHOW = feedback+"
Now we can work this out as a decimal number.

" 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 + ET + document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { base=Math.ceil(7*Math.random()+2); n=8; //denotes the max number of places to be displayed i.e. base^n A = Math.ceil(Math.pow(base,n)*Math.random())+20; B = A.toString(base); C= parseInt(B,base); QuestionText%QUESTION.NUMBER% = "What is the decimal representation of the following base "+base+ " number
" e1=B+" ?"; EquationText%QUESTION.NUMBER%=e1+"
" Correct%QUESTION.NUMBER% = C; document.write(QuestionText%QUESTION.NUMBER%+EquationText%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"You were wrong!]]> 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. ]]>
Level 1Intermediate function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER% ET=EquationText%QUESTION.NUMBER% COR=Correct%QUESTION.NUMBER% LB=B.length W=getFontSize()/16*(80*LB); a1="" a2="" a3="" workings=""; for (var place=0; place"+B.charAt(LB-place-1)+"×"+base+""+place+""} else{workings=workings+"+"+B.charAt(LB-place-1)+"×"+base+""+place+""} }; m1%QUESTION.NUMBER%="" feedback=a1+a2+a3+m1%QUESTION.NUMBER%; ANS= "To obtain the decimal representation of a base "+base+" number, we write it in reverse as:
" SHOW = feedback+"
Now we can work this out as a decimal number.

" 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 + ET + document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { base=2; n=8; //denotes the max number of places to be displayed i.e. base^n A = Math.ceil(Math.pow(base,n)*Math.random())+20; B = A.toString(base); C= parseInt(B,base); QuestionText%QUESTION.NUMBER% = "What is the decimal representation of the following binary number
" e1=B+" ?"; EquationText%QUESTION.NUMBER%=e1+"
" Correct%QUESTION.NUMBER% = C; document.write(QuestionText%QUESTION.NUMBER%+EquationText%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"You were wrong!]]> 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. ]]>
Level 1Intermediate function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER% ET=EquationText%QUESTION.NUMBER% COR=Correct%QUESTION.NUMBER% LB=B.length W=getFontSize()/16*(80*LB); a1="" a2="" a3="" workings=""; for (var place=0; place"+B.charAt(LB-place-1)+"×"+base+""+place+""} else{workings=workings+"+"+B.charAt(LB-place-1)+"×"+base+""+place+""} }; m1%QUESTION.NUMBER%="" feedback=a1+a2+a3+m1%QUESTION.NUMBER%; ANS= "To understand the base "+base+" number "+B+" , we can write it in reverse as:
" rem= (B.length) % 4; if(rem ==0){pB=B}else{if(rem ==1){pB="0"+"0"+"0"+B}else{if(rem ==2){pB="0"+"0"+B}else{pB="0"+B}}} groups=pB.length/4 g = new Array(); gs=""; j = 1; for (i=1; i<=groups; i++){ g[i] = pB.charAt(j-1)+pB.charAt(j)+pB.charAt(j+1)+pB.charAt(j+2); j=j+4; gs =gs+g[i]+","; } SHOW = feedback+"
Now we could work this out as a decimal number, and then convert it to an hexadecimal number ... but fortunately there's an easier way, as follows:

Firstly write down the binary representation of the hexadecimal numbers
0 = 0000, 1 =0001, 2 = 0010, 3 =0011, 4 = 0100, 5 = 0101, 6 = 0110, 7 = 0111, 8=1000, 9=1001, A=1010, B=1011, C=1100, D=1101, E=1110, F=1111.

Secondly, group the digits of the given number into 4's, adding zeroes at the start if needed.
In this case we have "+pB+" = "+gs+"

and finally equate each group of 4 with its hexadecimal equivalent, giving the result required.

"; 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 + ET + document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { base=2; tobase=16; n=13; //denotes the max number of places to be displayed i.e. base^n A = Math.ceil(Math.pow(base,n)*Math.random())+20; B = A.toString(base); C= A.toString(tobase).toUpperCase(); QuestionText%QUESTION.NUMBER% = "What is the hexadecimal representation of the following binary number
" e1=B+" ?"; EquationText%QUESTION.NUMBER%=e1+"
" Correct%QUESTION.NUMBER% = C ; document.write(QuestionText%QUESTION.NUMBER%+EquationText%QUESTION.NUMBER%); document.write("") document.write("") } if (document.forms.name=="FEEDBACK") {} else {question%QUESTION.NUMBER%()} ]]> "Choice" INCLUDES "was correct"Well done!]]> "Choice" INCLUDES NOCASE "should have been"You were wrong!]]> 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. ]]>
Level 1Intermediate function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER% ET=EquationText%QUESTION.NUMBER% COR=Correct%QUESTION.NUMBER% LB=B.length nwidth=getFontSize()/16*80*LB nheight=getFontSize()/16*80 a1="" a2="" a3="" workings=""; for (var place=0; place"+B.charAt(LB-place-1)+"×"+base+""+place+""} else{workings=workings+"+"+B.charAt(LB-place-1)+"×"+base+""+place+""} }; m1%QUESTION.NUMBER%="" feedback=a1+a2+a3+m1%QUESTION.NUMBER%; ANS= "To understand the base "+base+" number "+B+" , we can write it in reverse as:
" rem= (B.length) % 3; if(rem ==0){pB=B}else{if(rem ==1){pB="0"+"0"+B}else{pB="0"+B}} groups=pB.length/3 g = new Array(); gs=""; j = 1; for (i=1; i<=groups; i++){ g[i] = pB.charAt(j-1)+pB.charAt(j)+pB.charAt(j+1); j=j+3; gs =gs+g[i]+","; } SHOW = feedback+"
Now we could work this out as a decimal number, and then convert it to an octal number ... but fortunately there's an easier way, as follows:

Firstly write down the binary representation of the octal numbers
0 = 000, 1 =001, 2 = 010, 3 =011, 4 = 100, 5 = 101, 6 = 110, 7 = 111.

Secondly, group the digits of the given number into 3's, adding zeroes at the start if needed.
In this case we have "+pB+" = "+gs+"

and finally equate each group of 3 with its octal equivalent, giving the result required.

"; 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 + ET + document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { base=2; tobase=8; n=13; //denotes the max number of places to be displayed i.e. base^n A = Math.ceil(Math.pow(base,n)*Math.random())+20; B = A.toString(base); C= A.toString(tobase); QuestionText%QUESTION.NUMBER% = "What is the octal representation of the following binary number
" e1=B+" ?"; EquationText%QUESTION.NUMBER%=e1+"
" Correct%QUESTION.NUMBER% = C ; document.write(QuestionText%QUESTION.NUMBER%+EquationText%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"You were wrong!]]> 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. ]]>
Level 1Intermediate function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER% ET=EquationText%QUESTION.NUMBER% COR=Correct%QUESTION.NUMBER% a=A; workings=""; for (var places=0; places"; a=temp;}else{} } workings=workings+"
 "+a+"/"+base+" = "+" "+temp+" remainder "+custRound(base*((a/base)-temp),0)+"
" ANS= "To convert decimals numbers to base "+base+" numbers, you need to divide successively by "+base+"; for this example this gives:

" SHOW = workings+"
Now read the remainder column in red from the bottom up - hey presto, this gives the base "+base+" representation of the number "+A+"
This is not magic - think about WHY this works and ask your teacher if necessary!

" 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 + ET + document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { QuestionText%QUESTION.NUMBER% = "What is the representation of ...
" base=Math.ceil(7*Math.random()+2); n=8; //denotes the max number of places to be input i.e. base^n A = Math.ceil(Math.pow(base,n)*Math.random())+20; B = A.toString(base); C= parseInt(B,base); e1=A+"
to base "+base+ "?"; EquationText%QUESTION.NUMBER%=e1+"
" Correct%QUESTION.NUMBER% = B; document.write(QuestionText%QUESTION.NUMBER%+EquationText%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"You were wrong!]]> 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. ]]>
Level 1Intermediate function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER% ET=EquationText%QUESTION.NUMBER% COR=Correct%QUESTION.NUMBER% a=A; workings=""; for (var places=0; places"; a=temp;}else{} } workings=workings+"
 "+a+"/2 = "+" "+temp+" remainder "+custRound(2*((a/2)-temp),0)+"
" ANS= "To convert decimals numbers to binary, you need to divide successively by 2; for this example this gives:

" SHOW = workings+"
Now read the remainder column in red from the bottom up - hey presto, this gives the binary representation of the number "+A+"
This is not magic - think about WHY this works and ask your teacher if necessary!

" 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 + ET + document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { QuestionText%QUESTION.NUMBER% = "What is the binary representation of ...
" n=10; //denotes the max number of places to be input i.e. base^n A = Math.ceil(Math.pow(2,n)*Math.random())+20; B = A.toString(2); C= parseInt(B,2); e1=A+" ?"; EquationText%QUESTION.NUMBER%=e1+"
" Correct%QUESTION.NUMBER% = B; document.write(QuestionText%QUESTION.NUMBER%+EquationText%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"You were wrong!]]> 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. ]]>
Level 1Intermediate function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER% ET=EquationText%QUESTION.NUMBER% COR=Correct%QUESTION.NUMBER% COR_Lower=Correct_Lower%QUESTION.NUMBER% a=A; workings=""; for (var places=0; places"; a=temp;}else{} } workings=workings+"
 "+a+"/"+base+" = "+" "+temp+" remainder "+custRound(base*((a/base)-temp),0).toString(16).toUpperCase()+"
" ANS= "To convert decimals numbers to base "+base+" numbers, you need to divide successively by "+base+"; for this example this gives:

" SHOW = workings+"
Now read the remainder column in red from the bottom up - hey presto, this gives the base "+base+" representation of the number "+A+"
This is not magic - think about WHY this works and ask your teacher if necessary!

" 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 + ET + document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { QuestionText%QUESTION.NUMBER% = "What is the hexadecimal representation of ...
" base=16; n=6; //denotes the max number of places to be input i.e. base^n A = Math.ceil(Math.pow(base,n)*Math.random())+20; B = A.toString(base).toUpperCase(); B1=A.toString(base).toLowerCase(); C= parseInt(B,base); e1=A+" ?

Use capitals for A=10 ... F=15 etc

"; EquationText%QUESTION.NUMBER%=e1+"
" Correct%QUESTION.NUMBER% = B; Correct_Lower%QUESTION.NUMBER% = B1; document.write(QuestionText%QUESTION.NUMBER%+EquationText%QUESTION.NUMBER%); document.write("") document.write("") } if (document.forms.name=="FEEDBACK") {} else {question%QUESTION.NUMBER%()} ]]> "Choice" INCLUDES "was correct"Well done!]]> "Choice" INCLUDES NOCASE "should have been"You were wrong!]]> 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. ]]>
Level 1Intermediate function process%QUESTION.NUMBER%(QNo) { QT=QuestionText%QUESTION.NUMBER% ET=EquationText%QUESTION.NUMBER% COR=Correct%QUESTION.NUMBER% LB=B.length W=getFontSize()/16*(90*LB); a1="" a2="" a3="" workings=""; for (var place=0; place"+B.charAt(LB-place-1)+"×"+base+""+place+""} else{workings=workings+"+"+B.charAt(LB-place-1)+"×"+base+""+place+""} }; m1%QUESTION.NUMBER%="" feedback=a1+a2+a3+m1%QUESTION.NUMBER%; ANS= "To obtain the decimal representation of a base "+base+" number, we write it in reverse as:
" SHOW = feedback+"
Now we can work this out as a decimal number, letters in the above being replaced by their decimal equivalents i.e. A=10, B=11 ... F=15.

" 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 + ET + document.forms.elements[item+3].value } function question%QUESTION.NUMBER%() { base=16; n=7; //denotes the max number of places to be displayed i.e. base^n A = Math.ceil(Math.pow(base,n)*Math.random())+20; B = A.toString(base).toUpperCase(); QuestionText%QUESTION.NUMBER% = "What is the decimal representation of the following hexadecimal number
" e1=B+" ?"; EquationText%QUESTION.NUMBER%=e1+"
" Correct%QUESTION.NUMBER% = A; document.write(QuestionText%QUESTION.NUMBER%+EquationText%QUESTION.NUMBER%); document.write("") document.write("") } if (document.forms.name=="FEEDBACK") {} else {question%QUESTION.NUMBER%()} ]]> "Choice" INCLUDES "was correct"Well done!]]> "Choice" INCLUDES NOCASE "should have been"You were wrong!]]> 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. ]]>