// Numbas version: exam_results_page_options {"name": "Number of digits in another base", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Number of digits in another base", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "http://localhost:8000/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

The student must calculate the number of digits a given decimal number would have when written in a different base. Alternative answers catch some common mal-rules and give appropriate feedback.

Based on table 2 from \"diagnosing student errors in e-assessment questions\" by Philip Walker, D. Rhys Gwynllyw and Karen L. Henderson.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "variables": {"n": {"name": "n", "group": "Ungrouped variables", "definition": "random(10^4..10^6)", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(2,3,5,9)", "description": "", "templateType": "anything"}, "converted": {"name": "converted", "group": "Ungrouped variables", "definition": "to_base(n,b)", "description": "", "templateType": "anything"}, "num_digits": {"name": "num_digits", "group": "Ungrouped variables", "definition": "ceil(log(n,b))", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["b", "n", "converted", "num_digits"], "variable_groups": [], "functions": {"to_base": {"parameters": [["n", "number"], ["b", "number"]], "type": "number", "language": "javascript", "definition": "if(n==0) {\n return '0';\n}\nvar s = '';\nwhile(n>0) {\n var r = n%b;\n s = r+s;\n n = (n-r)/b;\n}\nreturn parseInt(s);"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": true, "customName": "Calculate number of digits", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Number of digits", "prompt": "

How many digits does $\\var{n}_{10}$ have in base $\\var{b}$?

", "alternatives": [{"type": "numberentry", "useCustomName": true, "customName": "Converted to base b", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

You converted $\\var{n}$ to base $b$. You were asked to give the number of digits in this representation.

", "useAlternativeFeedback": false, "minValue": "converted", "maxValue": "converted", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Multiplied n by b", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

You have multiplied $\\var{n}$ and $\\var{b}$ together. You were asked to calculate how many digits the base-$\\var{b}$ representation of $\\var{n}$ has.

", "useAlternativeFeedback": false, "minValue": "n*b", "maxValue": "n*b", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "floor(log(n,b))", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

Did you calculate $\\simplify{floor(log({n},{b}))}$?

\n

Consider the following example:

\n

$\\simplify{floor(log(13,10))} = 1$, but $13$ has two digits.

", "useAlternativeFeedback": false, "minValue": "floor(log(n,b))", "maxValue": "floor(log(n,b))", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "floor(log(n,b))-1", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

Did you calculate $\\simplify{floor(log({n},{b}))}-1$?

\n

Consider the following example:

\n

$\\simplify{floor(log(13,10))}-1 = 0$, but $13$ has two digits.

", "useAlternativeFeedback": false, "minValue": "floor(log(n,b))", "maxValue": "floor(log(n,b))", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "ceil(log(n,b))+1", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "

Did you calculate $\\simplify{ceil(log({n},{b}))}+1$? You might have made an off-by-one error.

\n

Consider the following example:

\n

$\\simplify{ceil(log(13,10))}+1 = 3$, but $13$ has two digits.

", "useAlternativeFeedback": false, "minValue": "ceil(log(n,b))+1", "maxValue": "ceil(log(n,b))+1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "num_digits", "maxValue": "num_digits", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [{"name": "Number of digits", "limit": 1, "mode": "sum"}], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "http://localhost:8000/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}