// Numbas version: exam_results_page_options {"name": "Binary ", "feedback": {"allowrevealanswer": true, "showtotalmark": true, "advicethreshold": 0, "intro": "", "feedbackmessages": [], "showanswerstate": true, "showactualmark": true}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "allQuestions": true, "shuffleQuestions": false, "percentPass": 0, "duration": 0, "pickQuestions": 0, "navigation": {"onleave": {"action": "none", "message": ""}, "reverse": true, "allowregen": true, "showresultspage": "oncompletion", "preventleave": true, "browse": true, "showfrontpage": true}, "metadata": {"description": "

Converting decimal numbers to binary numbers and vice versa.

\n

rebel

\n

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "exam", "questions": [], "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": [{"name": "Binary to Decimal", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}], "functions": {}, "ungrouped_variables": ["a", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"], "tags": ["binary", "convert", "REBEL", "rebel", "Rebel", "rebelmaths"], "preamble": {"css": "", "js": ""}, "advice": "

There is a nice video on converting decimal to binary below:

\n

https://www.youtube.com/watch?v=H4BstqvgBow

", "rulesets": {}, "parts": [{"prompt": "

Convert the number $\\var{b3}\\var{b4}\\var{b5}\\var{b6}$ to decimal.

", "allowFractions": false, "variableReplacements": [], "maxValue": "{b6}+{b5}*2+{b4}*4+{b3}*8", "minValue": "{b6}+{b5}*2+{b4}*4+{b3}*8", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": "2", "type": "numberentry", "showPrecisionHint": false}, {"prompt": "

Convert the number $\\var{b1}\\var{b2}\\var{b3}\\var{b4}\\var{b5}$ to decimal.

", "allowFractions": false, "variableReplacements": [], "maxValue": "{b8}*1+{b4}*2+{b3}*4+{b2}*8+{b1}*16", "minValue": "{b5}*1+{b4}*2+{b3}*4+{b2}*8+{b1}*16", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": "2", "type": "numberentry", "showPrecisionHint": false}, {"prompt": "

Convert the number $\\var{b1}\\var{b2}\\var{b3}\\var{b4}\\var{b5}\\var{b6}\\var{b7}\\var{b8}$ to decimal.

", "allowFractions": false, "variableReplacements": [], "maxValue": "{b8}*1+{b7}*2+{b6}*4+{b5}*8+{b4}*16+{b3}*32+{b2}*64+{b1}*128", "minValue": "{b8}*1+{b7}*2+{b6}*4+{b5}*8+{b4}*16+{b3}*32+{b2}*64+{b1}*128", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": "2", "type": "numberentry", "showPrecisionHint": false}], "statement": "", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(1..20#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "a", "description": ""}, "b4": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b4", "description": ""}, "b5": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b5", "description": ""}, "b6": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b6", "description": ""}, "b7": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b7", "description": ""}, "b1": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b1", "description": ""}, "b2": {"definition": "random(0..1 except b3)", "templateType": "anything", "group": "Ungrouped variables", "name": "b2", "description": ""}, "b3": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b3", "description": ""}, "b8": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b8", "description": ""}}, "metadata": {"description": "

Converting Binary to Decimal

\n

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Binary to Decimal", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Clodagh Carroll", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/384/"}], "functions": {}, "ungrouped_variables": ["a", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"], "tags": ["rebelmaths"], "preamble": {"css": "", "js": ""}, "advice": "

The position of each digit indicates a power of 2. Beginning with the power of zero in the rightmost position and increasing by 1 every time you move one digit to the left. A zero in a given position means that that particular power of 2 should not be included. A one in a given position means that that particular power of 2 should be included.

\n

Once each power of 2 that should be included has been noted, add them all together.

\n

\n

For example, to convert the binary number 1010 to decimal, we start with the rightmost digit, 0.

\n

The rightmost digit represents 2 to the power of 0 (i.e., 1). Since the rightmost digit is a 0, we do not include this power of 2. So 1 is not included.

\n

Next, we move to the 2nd digit from the right, 1. This digit represents 2 to the power of 1 (i.e., 2). Since this digit is a 1, we do include this power of 2. So 2 is included.

\n

Next, we move to the 3rd digit from the right, 0. This digit represents 2 to the power of 2 (i.e., 4). Since this digit is a 0, we do not include this power of 2. So 4 is not included.

\n

Finally, we move to the 4th digit from the right, 1. This digit represents 2 to the power of 3 (i.e., 8). Since this digit is a 1, we do include this power of 2. So 8 is included.

\n

Now, since we have gone through all digits in our binary number, we add up all of the powers of 2 that we have identified to be included:

\n

2+8=10.

", "rulesets": {}, "parts": [{"allowFractions": false, "variableReplacements": [], "maxValue": "{b8}*1+{b7}*2+{b6}*4+{b5}*8+{b4}*16+{b3}*32+{b2}*64+{b1}*128", "minValue": "{b8}*1+{b7}*2+{b6}*4+{b5}*8+{b4}*16+{b3}*32+{b2}*64+{b1}*128", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": "2", "type": "numberentry", "showPrecisionHint": false}], "statement": "

Convert the number $\\var{b1}\\var{b2}\\var{b3}\\var{b4}\\var{b5}\\var{b6}\\var{b7}\\var{b8}$ to decimal.

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(1..10000#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "a", "description": ""}, "b4": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b4", "description": ""}, "b5": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b5", "description": ""}, "b6": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b6", "description": ""}, "b7": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b7", "description": ""}, "b1": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b1", "description": ""}, "b2": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b2", "description": ""}, "b3": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b3", "description": ""}, "b8": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b8", "description": ""}}, "metadata": {"description": "

rebelmaths

\n

Converting a number from binary to decimal.

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Decimal to Binary", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}], "functions": {}, "ungrouped_variables": ["a", "b1", "b2", "b3", "b4", "b5", "b7", "b6", "ans1", "ans2", "ans3", "b8"], "tags": ["binary", "rebel", "REBEL", "Rebel", "rebelmaths"], "preamble": {"css": "", "js": ""}, "advice": "

First list the powers of 2 $2^0=1,2^1=2,2^2=4,2^3=8,2^4=16,2^5=32...$ 

\n

(a) $\\var{ans1}=(\\var{b2}\\times4)+(\\var{b3}\\times2)+(\\var{b4}\\times1)$,

\n

So, the answer is $\\var{b2}\\var{b3}\\var{b4}$.

\n

(b) $\\var{ans2}=(\\var{b1}\\times16)+(\\var{b2}\\times8)+(\\var{b3}\\times4)+(\\var{b4}\\times2)+(\\var{b5}\\times1)$,

\n

So, the answer is $\\var{b1}\\var{b2}\\var{b3}\\var{b4}\\var{b5}$.

\n

(c) $\\var{ans3}=(\\var{b1}\\times128)+(\\var{b2}\\times64)+(\\var{b3}\\times32)+(\\var{b4}\\times16)+(\\var{b5}\\times8)+(\\var{b6}\\times4)+(\\var{b7}\\times2)+(\\var{b8}\\times1)$

\n

So, the answer is $\\var{b1}\\var{b2}\\var{b3}\\var{b4}\\var{b5}\\var{b6}\\var{b7}\\var{b8}$.

", "rulesets": {}, "parts": [{"prompt": "

Convert the number $\\var{ans1}$ to binary.

\n

[[0]] [[1]] [[2]] 

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b2}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b3}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b4}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "

Convert the number $\\var{ans2}$ to binary.

\n

[[0]] [[1]] [[2]] [[3]][[4]]

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b1}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b2}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b3}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b4}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b5}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "

Convert the number $\\var{ans3}$ to binary.

\n

[[0]] [[1]] [[2]] [[3]] [[4]] [[5]] [[6]] [[7]]

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b1}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b2}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b3}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b4}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b5}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b6}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b7}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "{b8}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "statement": "

Answer the following questions putting a 1 or 0 in each box.

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(1..20#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "a", "description": ""}, "ans1": {"definition": "{b4}+{b3}*2+{b2}*4", "templateType": "anything", "group": "Ungrouped variables", "name": "ans1", "description": ""}, "ans2": {"definition": "{b5}*1+{b4}*2+{b3}*4+{b2}*8+{b1}*16", "templateType": "anything", "group": "Ungrouped variables", "name": "ans2", "description": ""}, "ans3": {"definition": "{b8}*1+{b7}*2+{b6}*4+{b5}*8+{b4}*16+{b3}*32+{b2}*64+{b1}*128", "templateType": "anything", "group": "Ungrouped variables", "name": "ans3", "description": ""}, "b4": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b4", "description": ""}, "b5": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b5", "description": ""}, "b6": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b6", "description": ""}, "b7": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b7", "description": ""}, "b1": {"definition": "1", "templateType": "anything", "group": "Ungrouped variables", "name": "b1", "description": ""}, "b2": {"definition": "random(0..1 except b3)", "templateType": "anything", "group": "Ungrouped variables", "name": "b2", "description": ""}, "b3": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b3", "description": ""}, "b8": {"definition": "random(0..1#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "b8", "description": ""}}, "metadata": {"description": "

\n

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Decimal to Binary 1", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Clodagh Carroll", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/384/"}], "functions": {}, "ungrouped_variables": ["a"], "tags": ["rebelmaths"], "advice": "

Repeatedly divide the given decimal number by 2, writing the remainder clearly on the right hand side (even if the remainder is 0).

\n

Continue until you eventually reach 1, at which point you get 1/2 = 0, with remainder 1. Now list the remainders in the order from bottom to top.

\n

\n

For example, to convert 363 to decimal:

\n

            Number of times 2 goes in:                     Remainder:

\n

363/2 = 181                                                        1

\n

181/2 = 90                                                          1

\n

90/2   = 45                                                          0

\n

45/2   = 22                                                          1

\n

22/2   = 11                                                          0

\n

11/2   = 5                                                            1

\n

5/2     = 2                                                            1

\n

2/2     = 1                                                            0

\n

1/2     = 0                                                            1

\n

\n

We can go no further, so we stop. Now, listing the remainders in order from bottom to top, we get that 363, in binary, is 101101011.

", "rulesets": {}, "parts": [{"matrix": ["2", 0, 0, 0], "shuffleChoices": true, "marks": 0, "variableReplacements": [], "choices": ["

0010 0000 0111

", "

0001 0010 0111

", "

0000 1110 0010

", "

1000 0110 0101

"], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "maxMarks": 0, "scripts": {}, "distractors": ["", "", "", ""], "displayColumns": 0, "showCorrectAnswer": true, "type": "1_n_2", "minMarks": 0}], "statement": "

Convert the number 519 to binary.

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"a": {"definition": "random(1..10000#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "a", "description": ""}}, "metadata": {"description": "

rebelmaths

\n

Converting a decimal number to binary.

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}]}], "contributors": [{"name": "Deirdre Casey", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/681/"}], "extensions": [], "custom_part_types": [], "resources": []}