// Numbas version: finer_feedback_settings {"name": "Binary to Decimal", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "ungrouped_variables": ["a", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"], "name": "Binary to Decimal", "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.
\nOnce each power of 2 that should be included has been noted, add them all together.
\n\nFor example, to convert the binary number 1010 to decimal, we start with the rightmost digit, 0.
\nThe 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.
\nNext, 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.
\nNext, 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.
\nFinally, 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.
\nNow, 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:
\n2+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}], "extensions": [], "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
\nConverting 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": []}], "contributors": [{"name": "Clodagh Carroll", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/384/"}]}]}], "contributors": [{"name": "Clodagh Carroll", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/384/"}]}