// Numbas version: finer_feedback_settings {"name": "Decimal to Binary", "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", "b7", "b6", "ans1", "ans2", "ans3", "b8"], "name": "Decimal to Binary", "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"}], "extensions": [], "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": []}], "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}]}]}], "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}]}