// Numbas version: exam_results_page_options {"name": "Numbas website demo", "metadata": {"description": "
Some questions to show off features of Numbas, linked from the Numbas homepage.
", "licence": "Creative Commons Attribution 4.0 International"}, "duration": 0, "percentPass": "0", "showQuestionGroupNames": true, "shuffleQuestionGroups": false, "showstudentname": true, "question_groups": [{"name": "Start here", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": [""], "variable_overrides": [[]], "questions": [{"name": "Determine the formula for a mystery function", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "The student is shown a plot of a mystery function. They can enter values of $x$ check, within the bounds of the plot.
\nThey're asked to give the formula for the function, and then asked for its value at a very large value of $x$.
\nA plot of the student's function updates automatically as they type. Adaptive marking is used for the final part to award credit if the student gives the right value for their incorrect function.
", "licence": null}, "statement": "This question demonstrates some of the most important features of Numbas: randomisation, marking mathematical expressions, interactive graphics, steps, and adaptive marking.
See this question on the public editor.
\nHere's a plot of a function $f(x)$:
\n{static_plot}
", "advice": "The function is periodic and looks like one of the functions $\\sin(x)$ or $\\cos(x)$, scaled in both the horizontal and vertical directions.
\nSo guess that it's either of the form $a\\sin(bx)$ or $a\\cos(bx)$.
\nRemember that $\\sin(0)=0$, while $\\cos(x)=1$.
\nBecause the plot goes through the origin, we can say that $f(x) = 0$, so the form is $a\\sin(bx)$.
\n{advice_plot_amplitude}
\nThe maximum value that $\\sin(bx)$ reaches is $1$, so the highest point reached by the function corresponds to $f(x) = a$.
\nThe peaks shown on the graph are at $y = \\var{amplitude}$, so $a = \\var{amplitude}$.
\n$\\sin(bx) =0 $ at $x=n\\pi/b$, so look at the places that the plot crosses the $x$-axis.
\nSetting $n=1$, the first crossing after the origin, we can find $b = \\dfrac{\\pi}{x}$.
\nThe plot first crosses the $x$-axis at $x = \\var[fractionnumbers]{frequency}$, so $b = \\simplify{pi/{frequency}}$.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"expr_plot": {"name": "expr_plot", "group": "Ungrouped variables", "definition": "jsxgraph(\n 480,300,\n [-x_bound,10,x_bound,-10],\n [\n ['functiongraph',[expr,-x_bound,x_bound], [\"id\": \"target_fn\"]],\n ['functiongraph',[expr,-x_bound,x_bound], [\"id\": \"student_fn\", \"strokeWidth\": 3, strokeColor: \"black\"]]\n ]\n)", "description": "A dynamic plot showing the target function and the student's function in thick black.
", "templateType": "anything", "can_override": false}, "expr": {"name": "expr", "group": "Ungrouped variables", "definition": "expression(\"{amplitude}*sin(pi*x/{frequency})\")", "description": "The mystery function.
", "templateType": "anything", "can_override": false}, "amplitude": {"name": "amplitude", "group": "Ungrouped variables", "definition": "random(3 .. 7#1)", "description": "The amplitude of the function.
", "templateType": "randrange", "can_override": false}, "frequency": {"name": "frequency", "group": "Ungrouped variables", "definition": "random(1 .. 4#1)", "description": "The frequency of the oscillation.
", "templateType": "randrange", "can_override": false}, "x1": {"name": "x1", "group": "Ungrouped variables", "definition": "random(-4..4 except 0)", "description": "", "templateType": "anything", "can_override": false}, "x2": {"name": "x2", "group": "Ungrouped variables", "definition": "random(-99.5..99.5 except -20..20)*frequency", "description": "A large value of $x$ that the student will have to evaluate $f(x)$ at.
", "templateType": "anything", "can_override": false}, "y1": {"name": "y1", "group": "Ungrouped variables", "definition": "precround(eval(expr,[\"x\":x1]),2)", "description": "", "templateType": "anything", "can_override": false}, "y2": {"name": "y2", "group": "Ungrouped variables", "definition": "precround(eval(expr,[\"x\":x2]),2)", "description": "", "templateType": "anything", "can_override": false}, "advice_plot_amplitude": {"name": "advice_plot_amplitude", "group": "Ungrouped variables", "definition": "jsxgraph(\n 800,500,\n [-x_bound,10,x_bound,-10],\n [\n ['functiongraph',[expr,-x_bound,x_bound], [\"id\": \"target_fn\"]],\n ['line',[[0,amplitude],[1,amplitude]], [\"dash\": 2, \"strokeColor\": \"black\"]]\n ]\n)", "description": "", "templateType": "anything", "can_override": false}, "x_bound": {"name": "x_bound", "group": "Ungrouped variables", "definition": "8", "description": "The student is shown values of the function whose absolute value is at most this.
", "templateType": "anything", "can_override": false}, "static_plot": {"name": "static_plot", "group": "Ungrouped variables", "definition": "jsxgraph(\n 800,500,\n [-x_bound,10,x_bound,-10],\n [\n ['functiongraph',[expr,-x_bound,x_bound], [\"id\": \"target_fn\"]]\n ]\n)", "description": "A static plot of the function to go in the statement.
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["amplitude", "frequency", "expr", "x_bound", "static_plot", "expr_plot", "x1", "x2", "y1", "y2", "advice_plot_amplitude"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": true, "customName": "Check precise values", "marks": "0", "scripts": {}, "customMarkingAlgorithm": "y: precround(eval(expr, [\"x\":studentNumber]),5)\n\nin_bounds:\n assert(abs(studentNumber)<=x_bound,\n warn(\"You can only ask for values of $x$ between {-x_bound} and {x_bound}.\");\n fail(\"You can only ask for values of $x$ between {-x_bound} and {x_bound}.\")\n )\n\nmark:\n apply(studentNumber);\n apply(in_bounds);\n feedback(\"$f(\"+studentNumber+\") = \"+y+\"$\")", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "If you'd like to check the value of the function more carefully, type in a value for $x$ and press Submit answer. You'll be shown the corresponding value $f(x)$.
", "minValue": "0", "maxValue": "0", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "gapfill", "useCustomName": true, "customName": "Write $f(x)$", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Here's a plot of $f(x)$ again:
\n{expr_plot}
\nWrite a definition of this function in the form $y = f(x)$.
\nYour function will be plotted in black on top of the given plot above.
\n$y = $ [[0]]
", "stepsPenalty": 0, "steps": [{"type": "information", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "This function is periodic. It looks like it involves either $\\sin(x)$ or $\\cos(x)$.
\nIf you can't tell which one it is, try entering them and see which function looks like the closest match at $x=0$.
"}, {"type": "numberentry", "useCustomName": true, "customName": "Amplitude", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "What is the highest value that this function reaches?
", "minValue": "amplitude", "maxValue": "amplitude", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Wavelength", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "What is the distance between points where the function crosses the horizontal axis?
", "minValue": "frequency", "maxValue": "frequency", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "gaps": [{"type": "jme", "useCustomName": true, "customName": "$f(x)$", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "studentVariables (Variables used in the student's answer):\n if(studentExpr<>nothing,\n scope_case_sensitive(set(findvars(studentExpr)),settings[\"caseSensitive\"]),\n set()\n )\n\n\nstudent_fn (The plot of the student's function in the diagram):\n expr_plot[\"student_fn\"]\n\njxg_input:\n if(studentExpr<>nothing and studentVariables=set(\"x\"),\n [ jxg_set_term(student_fn, studentExpr)\n , jxg_show(student_fn, true)\n ],\n [jxg_show(student_fn, false)]\n )", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{expr}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": true, "singleLetterVariables": true, "allowUnknownFunctions": false, "implicitFunctionComposition": true, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "numberentry", "useCustomName": true, "customName": "$f(\\var{x2})$", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "expr", "part": "p1g0", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": "1", "exploreObjective": null, "prompt": "What is the value of the function at $x = \\var{x2}$?
", "minValue": "y2", "maxValue": "y2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "2", "precisionPartialCredit": "100", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}, {"name": "Question part types", "pickingStrategy": "all-ordered", "pickQuestions": "1", "questionNames": ["All part types", "Mathematical expression", "Number entry", "Matrix entry", "Match text pattern", "Choose one from a list", "Choose several from a list", "Match choices with answers", "Gap-fill", "Custom marking algorithms", "Custom part types"], "variable_overrides": [[], [], [], [], [], [], [], [], [], [], []], "questions": [{"name": "Numbas demo: part types", "extensions": [], "custom_part_types": [{"source": {"pk": 1, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/1/edit"}, "name": "Yes/no", "short_name": "yes-no", "description": "The student is shown two radio choices: \"Yes\" and \"No\". One of them is correct.
", "help_url": "", "input_widget": "radios", "input_options": {"correctAnswer": "if(eval(settings[\"correct_answer_expr\"]), 0, 1)", "hint": {"static": true, "value": ""}, "choices": {"static": true, "value": ["Yes", "No"]}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(studentanswer=correct_answer,\n correct(),\n incorrect()\n)\n\ninterpreted_answer:\nstudentAnswer=0\n\ncorrect_answer:\nif(eval(settings[\"correct_answer_expr\"]),0,1)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=correct_answer,\n correct(),\n incorrect()\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer=0"}, {"name": "correct_answer", "description": "", "definition": "if(eval(settings[\"correct_answer_expr\"]),0,1)"}], "settings": [{"name": "correct_answer_expr", "label": "Is the answer \"Yes\"?", "help_url": "", "hint": "An expression which evaluates totrue
or false
.", "input_type": "mathematical_expression", "default_value": "true", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "Showing off the part types.
", "licence": null}, "statement": "Each part of a Numbas question asks the student to enter an answer, and is marked automatically. There are several part types, each with their own input methods and settings.
\nSee this question on the public editor.
", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"b": {"name": "b", "group": "Ungrouped variables", "definition": "random(1 .. 10#1)", "description": "", "templateType": "randrange", "can_override": false}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(1 .. 10#1)", "description": "", "templateType": "randrange", "can_override": false}, "d": {"name": "d", "group": "Ungrouped variables", "definition": "random(-10 .. 10#1)", "description": "", "templateType": "randrange", "can_override": false}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random(-10..10 except 0)", "description": "", "templateType": "anything", "can_override": false}, "f": {"name": "f", "group": "Ungrouped variables", "definition": "random(-10 .. 10#1)", "description": "", "templateType": "randrange", "can_override": false}}, "variablesTest": {"condition": "a=4 and b=8", "maxRuns": "1000"}, "ungrouped_variables": ["a", "b", "c", "d", "f"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": true, "customName": "Number entry", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The number entry part asks the student to write a single number. It's marked correct if it's in the accepted range.
\nI eat 5 apples per day. How many apples do I eat in a week?
", "minValue": "35", "maxValue": "35", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "jme", "useCustomName": true, "customName": "Mathematical expression", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The mathematical expression part type asks the student to write a mathematical expression as their answer. It's marked correct if it's equivalent to the expected answer.
\nDifferentiate the following function:
\n\\[ f(x) = \\simplify[all,!noLeadingMinus]{{c}x^2+{d}x+{f}} \\]
", "answer": "{2*c}x+{d}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "matrix", "useCustomName": true, "customName": "Matrix entry", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The matrix entry part type asks the student to enter the elements of a matrix. It's marked correct if the student's matrix is equal to the expected matrix.
\nEnter a $3 \\times 3$ identity matrix.
", "correctAnswer": "id(3)", "correctAnswerFractions": false, "numRows": "3", "numColumns": "3", "allowResize": true, "tolerance": 0, "markPerCell": false, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}, {"type": "patternmatch", "useCustomName": true, "customName": "Match text pattern", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The match text pattern part type asks the student to enter a short string of text. It's marked correct if it matches the pattern specified by the author.
\nWrite \"Numbas\".
", "answer": "Numbas", "displayAnswer": "Numbas", "caseSensitive": true, "partialCredit": "50", "matchMode": "exact"}, {"type": "1_n_2", "useCustomName": true, "customName": "Choose one from a list", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The choose one from a list part asks the student to choose one item from a list of options. Each option can award a different number of marks.
\nWhich fruit is biggest?
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Apple", "Strawberry", "Watermelon"], "matrix": [0, 0, "1"], "distractors": ["", "", ""]}, {"type": "m_n_2", "useCustomName": true, "customName": "Choose several from a list", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The choose several from a list part type asks the student to select one or more items from a list. Each option can award or subtract a different number of marks.
\nTick every prime number in the list below.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["13", "7", "2", "6", "9", "51"], "matrix": ["1", "1", "1", "-1", "-1", "-1"], "distractors": ["", "", "", "$6 = 2 \\times 3$.", "$9 = 3 \\times 3$.", "$51 = 3 \\times 17$."]}, {"type": "m_n_x", "useCustomName": true, "customName": "Match choices with answers", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The match choices with answers part asks the student to match each of a list of 'choices' with a corresponding 'answer'. Each possible pair can award a different number of marks.
\nMatch countries with their capital cities.
", "minMarks": 0, "maxMarks": 0, "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": true, "shuffleAnswers": true, "displayType": "radiogroup", "warningType": "none", "showCellAnswerState": true, "choices": ["France", "Argentina", "China"], "matrix": [["1", 0, 0, 0, 0], [0, "1", 0, 0, 0], [0, 0, "1", 0, 0]], "layout": {"type": "all", "expression": ""}, "answers": ["Paris", "Buenos Aires", "Beijing", "Brussels", "Melbourne"]}, {"type": "yes-no", "useCustomName": true, "customName": "Custom part type - Yes/no", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "It's possible to create custom part types, or use one somebody else has published. A custom part type consists of settings for question authors, an input widget, and a marking algorithm. This part uses the \"Yes/No\" custom part type, which provides a simple means of asking if the student agrees with a statement.
\nWas the abacus invented before the mobile phone?
", "settings": {"correct_answer_expr": "true"}}, {"type": "gapfill", "useCustomName": true, "customName": "Gap-fill", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The gap-fill part type allows you to include multiple input areas in one block of text. They're marked independently of each other, but submitted simultaneously, and all the feedback is shown together.
\nMy dog is 3 years older than my cat, who is half the dog's age. What are their ages?
\nMy dog's age: [[0]]
\nMy cat's age: [[1]]
", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "Dog's age", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "6", "maxValue": "6", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Cat's age", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "3", "maxValue": "3", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Numbas demo: mathematical expression part type", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "A demo of the mathematical expression part and its options.
", "licence": null}, "statement": "The mathematical expression part type asks the student to enter a mathematical expression. A rendering of the student's answer is shown next to the input box so they can be sure it's been interpreted correctly.
\nNumbas picks random values for the variables in the expression, and evaluates both the student's answer and the expected answer at those points. If both expressions agree, then the student's answer is considered correct.
\nThis allows the student to rearrange the terms in their expression however they like. If you want the student to write their answer in a particular form, you can use a pattern restriction.
\nSee this question on the public editor.
", "advice": "", "rulesets": {}, "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "random(-5..5 except 0)", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(-5..5)", "description": "", "templateType": "anything"}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random(-5..5)", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a", "b", "c"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "jme", "useCustomName": true, "customName": "A simple expression", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Write $2x+y^2$.
\nUse *
for multiplication and ^
for exponentiation.
You can substitute question variables into the expression.
\nWrite $\\simplify{ {a}x^2+{b}x+{c} }$.
", "answer": "{a}x^2+{b}x+{c}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "jme", "useCustomName": true, "customName": "Implicit multiplication", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Students often omit the multiplication symbol, as they would in handwritten work. Numbas allows for this as much as it can while ensuring its interpretation of the student's answer is unambiguous. You can tell Numbas to interpret strings of letters as a single variable, or as implicit multiplication of single-letter variable names.
Write $x y + x \\sin(y)$.
\nTry x*y + x*sin(y)
and xy + xsin(y)
.
When it's important that the student's answer is in a certain form, you can require that the student's answer matches a pattern. If the answer doesn't match the pattern, you can give the student a tailored feedback message and optionally award partial credit.
\nWrite $\\frac{a \\times a^8}{a^5}$ in the form $a^n$.
\nTry a^4
and a*a^8/a^5
.
If the expression involves undefined functions, the normal marking method won't work. You can apply a pattern restriction to establish equivalence for the parts that can't be evaluated, and only numerically compare the part of the answer that can be evaluated.
\nWrite $f(x^2)$.
", "answer": "f(x^2)", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "mustmatchpattern": {"pattern": "f(?;argument)", "partialCredit": 0, "message": "", "nameToCompare": "argument"}, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "jme", "useCustomName": true, "customName": "Write a formula", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Write $y=5x-2$.
\nTry y = 5x - 2
and 5x - y = 2
.
The default behaviour of the mathematical expression part is to be case-insensitive when marking the student's answer. You can change this, so that variable and function names using the same letters but not the same case are considered different.
The correct answer to this part is $Ax$.
\nTry a*x
, A*x
and x*A
.
A demo of the number entry part and its options.
", "licence": null}, "statement": "The number entry part asks the student to write a single number. It's marked correct if it's in the accepted range.
\nSee this question on the public editor.
", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": true, "customName": "Write a whole number", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Write the number 169.
", "minValue": "169", "maxValue": "169", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Require precision", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can require the student to write their answer to a certain number of decimal places or significant figures, and optionally award partial credit if they don't.
\nWrite 1.23456 to two decimal places.
", "minValue": "1.23456", "maxValue": "1.23456", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "2", "precisionPartialCredit": "50", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Different notation styles", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Numbas supports a few of the number notation styles used around the world.
\nThis part uses the continental European style, with . to separate powers of 1000 and , as the decimal separator.
Write 1234.567 in the continental European style.
", "minValue": "1234.567", "maxValue": "1234.567", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["eu"], "correctAnswerStyle": "eu"}, {"type": "numberentry", "useCustomName": true, "customName": "Accept a number in a range", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The number entry part marks any number in the range specified by the question author as correct.
\nWrite a number between 100 and 1000.
", "minValue": "100", "maxValue": "1000", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Scientific notation for extremely large numbers", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can use E notation to write very small or very large numbers.
\nWrite Avogadro's number, $6.022 \\times 10^{23}$, in E notation.
\nTry 6.022e+23
and 6.022E23
.
You can accept fractions.
\nWrite $\\frac{22}{7}$.
", "minValue": "22/7", "maxValue": "22/7", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Require a reduced fraction", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can require that the student's answer is a reduced fraction.
Write $\\frac{3}{12}$ as a reduced fraction.
\nTry 1/4
and 3/12
.
A demo of the matrix entry part and its options.
", "licence": null}, "statement": "The matrix entry part type asks the student to write a matrix - a two-dimensional array of numbers. The student's answer is correct if their matrix is the expected size, and each cell is equal to the corresponding cell in the expected answer. You can award partial marks for each correct cell.
\nSee this question on the public editor.
", "advice": "", "rulesets": {}, "variables": {"random_matrix": {"name": "random_matrix", "group": "Ungrouped variables", "definition": "matrix(\n repeat( repeat(random(1..5#0),3), 2)\n)", "description": "", "templateType": "anything"}, "fraction_matrix": {"name": "fraction_matrix", "group": "Ungrouped variables", "definition": "matrix([\n [1,2],\n [3,4]\n])/7", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["random_matrix", "fraction_matrix"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "matrix", "useCustomName": true, "customName": "Identity matrix", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Write a $3 \\times 3$ identity matrix, $\\var{id(3)}$.
", "correctAnswer": "id(3)", "correctAnswerFractions": false, "numRows": 1, "numColumns": 1, "allowResize": true, "tolerance": 0, "markPerCell": false, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}, {"type": "matrix", "useCustomName": true, "customName": "Set the initial size", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can set the initial size of the matrix.
\nWrite $\\var{matrix([[2,3],[4,-1]])}$.
", "correctAnswer": "matrix([[2,3],[4,-1]])", "correctAnswerFractions": false, "numRows": "2", "numColumns": "2", "allowResize": true, "tolerance": 0, "markPerCell": false, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}, {"type": "matrix", "useCustomName": true, "customName": "Fixed size", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can fix the size of the matrix.
\nWrite the vector $\\var{vector(1,2,3)}$.
", "correctAnswer": "vector(1,2,3)", "correctAnswerFractions": false, "numRows": "3", "numColumns": "1", "allowResize": false, "tolerance": 0, "markPerCell": false, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}, {"type": "matrix", "useCustomName": true, "customName": "Precision restriction", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Like the number entry part, you can ask for the student to give each entry in the matrix to a certain number of decimal places.
\nWrite $\\var{random_matrix}$ to two decimal places.
", "correctAnswer": "random_matrix", "correctAnswerFractions": false, "numRows": "numrows(random_matrix)", "numColumns": "numcolumns(random_matrix)", "allowResize": false, "tolerance": 0, "markPerCell": false, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0, "precisionType": "dp", "precision": "2", "precisionPartialCredit": "50", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true}, {"type": "matrix", "useCustomName": true, "customName": "Award marks for each correct cell", "marks": "9", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Rather than requiring the entire matrix to be correct, you can award partial credit for each correct cell.
\nWrite $\\var{id(3)}$.
", "correctAnswer": "id(3)", "correctAnswerFractions": false, "numRows": "3", "numColumns": "3", "allowResize": false, "tolerance": 0, "markPerCell": true, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}, {"type": "matrix", "useCustomName": true, "customName": "Allow fractions", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can allow the student to enter fractions in each cell.
\nWrite $\\var[fractionnumbers,flatfractions]{fraction_matrix}$.
", "correctAnswer": "fraction_matrix", "correctAnswerFractions": true, "numRows": "numrows(fraction_matrix)", "numColumns": "numcolumns(fraction_matrix)", "allowResize": false, "tolerance": 0, "markPerCell": false, "allowFractions": true, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Numbas demo: match text pattern part type", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "A demo of the match text pattern part and its options.
", "licence": null}, "statement": "The match text pattern part type asks the student to enter a short string of text. It is marked correct if it matches the given pattern, or if it exactly matches the expected string.
\nSee this question on the public editor.
", "advice": "", "rulesets": {}, "variables": {"titlecase_pattern": {"name": "titlecase_pattern", "group": "Ungrouped variables", "definition": "safe(\"(\\\\p{Lu}|\\\\p{N})(\\\\p{L}|\\\\p{P}|\\\\p{N})*(\\\\s+(\\\\p{Lu}|\\\\p{N})(\\\\p{L}|\\\\p{P}|\\\\p{N})*)*\")", "description": "The regular expression for the title case part. The \\p
escape characters select unicode character properties.
In this part, the student's string must exactly match the expected string.
\nWrite e-assessment.
", "answer": "e-assessment", "displayAnswer": "e-assessment", "matchMode": "exact"}, {"type": "patternmatch", "useCustomName": true, "customName": "Require letter case to match", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can require that the case of the characters in the student's answer matches the expected answer.
\nWrite \"Numbas\".
\nTry Numbas
and NUMBAS
.
You can accept any string which matches a given regular expression pattern.
\nWrite a headline in title case.
\nTry Numbas Marks Answer Correctly
, Student informed of mistake
and Family von Trapp Outraged.
A demo of the choose one from a list part and its options.
", "licence": null}, "statement": "The choose one from a list part type presents the student with a list of choices, and asks them to pick the right one. Each choice can award a different number of marks.
\nSee this question on the public editor.
", "advice": "", "rulesets": {}, "variables": {"random_correct_choice": {"name": "random_correct_choice", "group": "Ungrouped variables", "definition": "random(0..2)", "description": "", "templateType": "anything"}, "correct_choice": {"name": "correct_choice", "group": "Ungrouped variables", "definition": "[\"A\",\"B\",\"C\"][random_correct_choice]", "description": "", "templateType": "anything"}, "random_number_of_distractors": {"name": "random_number_of_distractors", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "", "templateType": "anything"}, "random_choices": {"name": "random_choices", "group": "Ungrouped variables", "definition": "[\"Correct choice\"]+map(\"Incorrect choice \"+j,j,1..random_number_of_distractors)", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["random_correct_choice", "correct_choice", "random_number_of_distractors", "random_choices"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "1_n_2", "useCustomName": true, "customName": "One correct answer", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Sometimes there's only one correct answer.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["The correct answer", "An incorrect answer", "Another incorrect answer"], "matrix": ["1", 0, 0], "distractors": ["", "", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "Display choices in columns", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can display the choices in columns.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": "3", "showCellAnswerState": true, "choices": ["Correct", "Incorrect", "Incorrect", "Incorrect", "Incorrect", "Incorrect"], "matrix": ["1", 0, 0, 0, 0, 0], "distractors": ["", "", "", "", "", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "Choices worth different amounts", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Each choice awards a different number of marks.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": "1", "showCellAnswerState": true, "choices": ["This incorrect choice doesn't award any marks.", "This nearly-correct choice awards one mark.", "This completely correct choice awards three marks."], "matrix": [0, "1", "3"], "distractors": ["", "", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "Distractor text", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "For each choice, you can write a message to display to the student if they choose it.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["The right choice.", "The wrong choice."], "matrix": ["1", 0], "distractors": ["Well done spotting the correct choice.", "Why did you pick the wrong choice?"]}, {"type": "1_n_2", "useCustomName": true, "customName": "Drop-down list", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Rather than radio buttons, you can present the choices in a drop-down list.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Correct choice", "Incorrect choice"], "matrix": ["1", 0], "distractors": ["", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "Shuffle the order of choices", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can randomly shuffle the order of the choices.
\nClick the \"Try another question like this one\" button to see these choices in a different order.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": "1", "showCellAnswerState": true, "choices": ["Correct choice", "Incorrect choice 1", "Incorrect choice 2", "Incorrect choice 3"], "matrix": ["1", 0, 0, 0], "distractors": ["", "", "", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "Marking depends on question variables", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can set the number of marks based on question variables.
\nThis time, the correct answer is {correct_choice}.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["A", "B", "C"], "matrix": "map(award(1,j=random_correct_choice),j,0..2)"}, {"type": "1_n_2", "useCustomName": true, "customName": "Variable number of choices", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The choices themselves can depend on question variables, too.
\nThis time, there are {random_number_of_distractors+1} choices.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": "1", "showCellAnswerState": true, "choices": "random_choices", "matrix": "[1]+repeat(0,random_number_of_distractors)"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Numbas demo: choose several from a list part type", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "A demo of the choose several from a list part and its options.
", "licence": null}, "statement": "The choose several from a list part type presents the student with a list of choices, of which they have to select one or more. Each choice awards a different number of marks when it is chosen, and the student is awarded the sum of the marks for their choices.
\nSee this question on the public editor.
", "advice": "", "rulesets": {}, "variables": {"pick_odd_numbers": {"name": "pick_odd_numbers", "group": "Ungrouped variables", "definition": "random(true,false)", "description": "", "templateType": "anything"}, "numbers_to_pick": {"name": "numbers_to_pick", "group": "Ungrouped variables", "definition": "if(pick_odd_numbers,\"odd\",\"even\")", "description": "", "templateType": "anything"}, "numbers_marking_matrix": {"name": "numbers_marking_matrix", "group": "Ungrouped variables", "definition": "map(\n award(1,mod(j,2) = if(pick_odd_numbers,1,0)),\n j,\n 1..4\n)", "description": "", "templateType": "anything"}, "number_of_correct_choices": {"name": "number_of_correct_choices", "group": "Ungrouped variables", "definition": "random(2..total_choices-2 except 5)", "description": "", "templateType": "anything"}, "number_of_distractors": {"name": "number_of_distractors", "group": "Ungrouped variables", "definition": "total_choices - number_of_correct_choices", "description": "", "templateType": "anything"}, "random_choices": {"name": "random_choices", "group": "Ungrouped variables", "definition": "map(\"Correct choice \"+j,j,1..number_of_correct_choices)\n+\nmap(\"Incorrect choice \"+j,j,1..number_of_distractors)", "description": "", "templateType": "anything"}, "random_marking_matrix": {"name": "random_marking_matrix", "group": "Ungrouped variables", "definition": "repeat(12/number_of_correct_choices,number_of_correct_choices) + repeat(-12/number_of_correct_choices,number_of_distractors)", "description": "", "templateType": "anything"}, "total_choices": {"name": "total_choices", "group": "Ungrouped variables", "definition": "random(4..7)", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["pick_odd_numbers", "numbers_to_pick", "numbers_marking_matrix", "total_choices", "number_of_correct_choices", "number_of_distractors", "random_choices", "random_marking_matrix"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "m_n_2", "useCustomName": true, "customName": "Award marks for correct choices", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "In this part, the student is awarded 1 mark for each correct choice. However, selecting all the choices also gives you full marks...
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "checkbox", "displayColumns": 0, "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "markingMethod": "sum ticked cells", "choices": ["Correct choice", "Correct choice", "Incorrect choice", "Incorrect choice"], "matrix": ["1", "1", 0, 0], "distractors": ["", "", "", ""]}, {"type": "m_n_2", "useCustomName": true, "customName": "Display choices in columns", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can display the choices in columns.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "3", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["Correct choice", "Correct choice", "Incorrect choice", "Incorrect choice", "Incorrect choice", "Incorrect choice"], "matrix": ["1", "1", 0, 0, 0, 0], "distractors": ["", "", "", "", "", ""]}, {"type": "m_n_2", "useCustomName": true, "customName": "Restricted number of answers", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You must pick exactly two answers.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": "2", "maxAnswers": "2", "warningType": "prevent", "showCellAnswerState": true, "choices": ["Correct choice", "Correct choice", "Incorrect choice", "Incorrect choice"], "matrix": ["1", "1", 0, 0], "distractors": ["", "", "", ""]}, {"type": "m_n_2", "useCustomName": true, "customName": "Negative marking", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can take away marks when incorrect choices are selected, to discourage the student from picking at random.
\nEach incorrect choice for this part takes away 2 marks.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["Correct choice", "Correct choice", "Correct choice", "Incorrect choice", "Incorrect choice"], "matrix": ["1", "1", "1", "-2", "-2"], "distractors": ["", "", "", "", ""]}, {"type": "m_n_2", "useCustomName": true, "customName": "Score per matched cell", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "This part uses the \"score per matched cell\" marking method - you will be awarded 1 mark for each correct ticked or unticked box.
\nTick each mammal.
", "minMarks": 0, "maxMarks": "2", "shuffleChoices": true, "displayType": "checkbox", "displayColumns": 0, "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "markingMethod": "score per matched cell", "choices": ["Cat", "Dog", "Shark", "Sparrow"], "matrix": ["1", "1", 0, 0], "distractors": ["", "", "", ""]}, {"type": "m_n_2", "useCustomName": true, "customName": "Distractor text", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "For each choice, you can write a message to display to the student if they choose it.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["Correct choice 1", "Correct choice 1", "Incorrect choice 1", "Incorrect choice 2"], "matrix": ["1", "1", "-1", "-1"], "distractors": ["Correct choice 1 is indeed correct!", "Correct choice 2 is indeed correct!", "Incorrect choice 1 is not correct.", "Incorrect choice 2 is not correct."]}, {"type": "m_n_2", "useCustomName": true, "customName": "Shuffle the order of choices", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can randomly shuffle the order of the choices.
\nClick the \"Try another question like this one\" button to see these choices in a different order.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["Correct choice A", "Correct choice B", "Correct choice C", "Incorrect choice 1", "Incorrect choice 2"], "matrix": ["1", "1", "1", 0, 0], "distractors": ["", "", "", "", ""]}, {"type": "m_n_2", "useCustomName": true, "customName": "Marking depends on variables", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can set the number of marks based on question variables.
\nThis time, pick {numbers_to_pick} numbers.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "checkbox", "displayColumns": 0, "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["1", "2", "3", "4"], "matrix": "numbers_marking_matrix"}, {"type": "m_n_2", "useCustomName": true, "customName": "Variable number of choices", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The choices themselves can depend on question variables, too.
\nThis time, there are {number_of_correct_choices} correct choices and {number_of_distractors} incorrect choices.
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": "random_choices", "matrix": "random_marking_matrix"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Numbas demo: match choices with answers part type", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "A demo of the match choices with answers part and its options.
", "licence": null}, "statement": "The match choices with answers part presents the student with a list of choices, and a list of answers. The student must match up choices with answers, either choosing one answer for each choice, or arbitrarily many pairs.
\nEach choice-answer pair awards a different number of marks.
\nSee this question on the public editor.
", "advice": "", "rulesets": {}, "variables": {"target": {"name": "target", "group": "Ungrouped variables", "definition": "random(2,3,4,4,5,6)", "description": "", "templateType": "anything"}, "random_marking_matrix": {"name": "random_marking_matrix", "group": "Ungrouped variables", "definition": "map(\n map(award(1,a+b=target),b,1..3),\n a,\n 1..3\n)", "description": "", "templateType": "anything"}, "number_of_choices": {"name": "number_of_choices", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "", "templateType": "anything"}, "random_choices": {"name": "random_choices", "group": "Ungrouped variables", "definition": "offset+1..offset+number_of_choices", "description": "", "templateType": "anything"}, "offset": {"name": "offset", "group": "Ungrouped variables", "definition": "random(0..8)", "description": "", "templateType": "anything"}, "even_odd_marking_matrix": {"name": "even_odd_marking_matrix", "group": "Ungrouped variables", "definition": "map(\n if(mod(j,2)=0,[1,0],[0,1]),\n j,\n random_choices\n)", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["target", "random_marking_matrix", "number_of_choices", "offset", "random_choices", "even_odd_marking_matrix"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "m_n_x", "useCustomName": true, "customName": "One from each row", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": false, "shuffleAnswers": false, "displayType": "radiogroup", "warningType": "none", "showCellAnswerState": true, "markingMethod": "sum ticked cells", "choices": ["Choice 1", "Choice 2"], "matrix": [["1", 0], [0, "1"]], "layout": {"type": "all", "expression": ""}, "answers": ["Answer 1", "Answer 2"]}, {"type": "m_n_x", "useCustomName": true, "customName": "Checkboxes", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": false, "shuffleAnswers": false, "displayType": "checkbox", "warningType": "none", "showCellAnswerState": true, "choices": ["Choice A", "Choice B"], "matrix": [["1", "1", 0, 0], [0, 0, "1", "1"]], "layout": {"type": "all", "expression": ""}, "answers": ["Answer A1", "Answer A2", "Answer B1", "Answer B2"]}, {"type": "m_n_x", "useCustomName": true, "customName": "Shuffle the order of choices and answers", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can randomise the order of both choices and answers, or just one.
", "minMarks": 0, "maxMarks": 0, "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": true, "shuffleAnswers": true, "displayType": "checkbox", "warningType": "none", "showCellAnswerState": true, "choices": ["Choice A", "Choice B"], "matrix": [["1", "1", 0, 0], [0, 0, "1", "1"]], "layout": {"type": "all", "expression": ""}, "answers": ["Answer A1", "Answer A2", "Answer B1", "Answer B2"]}, {"type": "m_n_x", "useCustomName": true, "customName": "Remove some options", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "When certain selections don't make sense, or there's symmetry, you can remove them by choosing a different layout.
\nSelect pairs of numbers that add up to 4.
", "minMarks": 0, "maxMarks": 0, "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": false, "shuffleAnswers": false, "displayType": "checkbox", "warningType": "none", "showCellAnswerState": true, "choices": ["1", "2", "3"], "matrix": [[0, 0, 0], ["0", "3", 0], ["3", 0, 0]], "layout": {"type": "lowertriangle", "expression": ""}, "answers": ["1", "2", "3"]}, {"type": "m_n_x", "useCustomName": true, "customName": "Marking depends on question variables", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The marks awarded for each selection can depend on question variables.
\nThis time, select pairs of numbers that add up to {target}.
", "minMarks": 0, "maxMarks": 0, "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": false, "shuffleAnswers": false, "displayType": "checkbox", "warningType": "none", "showCellAnswerState": true, "markingMethod": "sum ticked cells", "choices": ["1", "2", "3"], "matrix": "random_marking_matrix", "layout": {"type": "lowertriangle", "expression": ""}, "answers": ["1", "2", "3"]}, {"type": "m_n_x", "useCustomName": true, "customName": "Variable number of choices", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Even the lists of choices and answers can depend on question variables.
\nClassify each of the following numbers as even or odd.
", "minMarks": 0, "maxMarks": 0, "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": false, "shuffleAnswers": false, "displayType": "radiogroup", "warningType": "none", "showCellAnswerState": true, "markingMethod": "sum ticked cells", "choices": "map(string(n),n,random_choices)", "matrix": "even_odd_marking_matrix", "layout": {"type": "all", "expression": ""}, "answers": ["Even", "Odd"]}, {"type": "m_n_x", "useCustomName": true, "customName": "Score per matched cell", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "This part uses the \"score per matched cell\" marking method - you will be awarded 1 mark for each correct ticked or unticked pair.
\nTick each pair of coprime numbers. Two numbers are coprime if their greatest common factor is 1.
", "minMarks": 0, "maxMarks": "12", "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": true, "shuffleAnswers": false, "displayType": "checkbox", "warningType": "none", "showCellAnswerState": true, "markingMethod": "score per matched cell", "choices": ["6", "4", "14"], "matrix": [[0, 0, "1", "1"], [0, "1", "1", "1"], [0, "1", 0, 0]], "layout": {"type": "all", "expression": ""}, "answers": ["18", "9", "7", "35"]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Numbas demo: gap-fill part type", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "A demo of the gap-fill part and its options.
", "licence": null}, "statement": "The gap-fill part presents one or more sub-parts as gaps inside the prompt text. Each gap is marked independently, and the student is awarded the total of their marks for the individual-parts.
\nSee this question on the public editor.
", "advice": "", "rulesets": {}, "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Put the answer input in the middle of a line of text", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "A common use is to show some text before or after the input.
\n$2x - x = $ [[0]]
", "gaps": [{"type": "jme", "useCustomName": true, "customName": "$x$", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "x", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": [{"name": "x", "value": ""}]}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "An answer in several parts", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "On a production line, Person B assembles boxes twice as quickly as Person A. There are 15 boxes to assemble.
\nHow many boxes does each person assemble?
\nPerson A assembles [[0]] boxes.
\nPerson B assembles [[1]] boxes.
", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "Person A", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "5", "maxValue": "5", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Person B", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "10", "maxValue": "10", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Gaps in a table", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can insert gaps in a table.
\nLet $y = 2x$. Fill in the missing values.
\n$x$ | \n1 | \n2 | \n3 | \n
---|---|---|---|
$y$ | \n[[0]] | \n[[1]] | \n[[2]] | \n
A demo of how custom marking algorithms can be used to replace the built-in marking methods.
", "licence": null}, "statement": "When the built-in marking algorithm doesn't do what you want, you can write your own, either starting from scratch or extending the built-in method.
\nSee this question on the public editor.
", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": true, "customName": "Accept any answer with a certain property", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "required_factors (Factors that the student's answer must have):\n [2,3]\n\nisInteger (Is the student's answer an integer?):\n assert(isint(studentNumber),\n fail(\"Your answer is not an integer.\");\n warn(\"Your answer must be an integer.\");\n false\n )\n\ndivisible_by_factors (Is the student's answer divisible by all the required factors?):\n map(\n if(mod(studentNumber,n)=0,\n add_credit(1/len(required_factors), \"Your number is divisible by \"+n+\".\"),\n negative_feedback(\"Your number is not divisible by \"+n+\".\")\n ),\n n,\n required_factors\n )\n\nmark (Mark the student's answer):\n apply(validNumber);\n apply(isInteger);\n apply(divisible_by_factors)\n", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Normally, the number entry part type accepts any number in a given range. In this part, a custom marking algorithm accepts any multiple of 6.
\nWrite a number which is divisible by both 2 and 3.
", "minValue": "6", "maxValue": "6", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": "0", "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "gapfill", "useCustomName": true, "customName": "Combine the answers from a gap-fill part", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "function:\n interpreted_answers[0]\n\nx_value:\n interpreted_answers[1]\n\nvalue_at_point:\n eval(function,[\"x\":x_value])\n\ncorrect_value_at_point:\n if(value_at_point=9,\n correct(),\n incorrect(\"Your function produces the value $\"+value_at_point+\"$ at $x = \"+x_value+\"$.\")\n )\n\nmark:\n assert(all_valid, fail(translate(\"question.can not submit\")));\n apply(correct_value_at_point)", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "A custom marking algorithm for a gap-fill part can combine the student's answers to the gaps, which are normally marked individually.
\nDefine a function $f(x)$, and a value of $x$ at which $f(x)=9$.
\n$f(x) = $ [[0]]
\n$x = $ [[1]]
", "gaps": [{"type": "jme", "useCustomName": true, "customName": "Function definition", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "x", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "numberentry", "useCustomName": true, "customName": "Value of $x$", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "9", "maxValue": "9", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Numbas demo: custom part types", "extensions": ["eukleides", "geogebra", "jsxgraph", "sheets"], "custom_part_types": [{"source": {"pk": 6, "author": {"name": "Christian Lawson-Perfect", "pk": 1}, "edit_page": "/beta/part_type/6/edit"}, "name": "Give a numerical input for an expression", "short_name": "give-a-numerical-input-for-an-expression", "description": "The student gives a point $x$ at which to evaluate a given function $f$. The answer is correct if $f(x)$ is the expected value.
", "help_url": "", "input_widget": "number", "input_options": {"correctAnswer": "settings[\"correctAnswer\"]", "hint": {"static": true, "value": ""}, "allowedNotationStyles": {"static": true, "value": ["plain", "en", "si-en"]}, "allowFractions": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(equal,\n correct()\n,\n incorrect(settings[\"student_value_description\"]+\" $\"+student_value+\"$.\")\n)\n\ninterpreted_answer:\nstudentAnswer\n\nstudent_value:\neval(settings[\"expression\"],[\"x\":studentAnswer])\n\nequal:\nwithintolerance(student_value,settings[\"expected_value\"],0.00001)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(equal,\n correct()\n,\n incorrect(settings[\"student_value_description\"]+\" $\"+student_value+\"$.\")\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer"}, {"name": "student_value", "description": "", "definition": "eval(settings[\"expression\"],[\"x\":studentAnswer])"}, {"name": "equal", "description": "", "definition": "withintolerance(student_value,settings[\"expected_value\"],0.00001)"}], "settings": [{"name": "expected_value", "label": "Expected value", "help_url": "", "hint": "The value that the function should take at the given point.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The value that the student should write.", "input_type": "string", "default_value": "", "subvars": true}, {"name": "student_value_description", "label": "Description of the student's value", "help_url": "", "hint": "", "input_type": "string", "default_value": "The value at your point is", "subvars": true}, {"name": "expression", "label": "Function to evaluate", "help_url": "", "hint": "The function that will be applied to the student's number.The student is shown two radio choices: \"Yes\" and \"No\". One of them is correct.
", "help_url": "", "input_widget": "radios", "input_options": {"correctAnswer": "if(eval(settings[\"correct_answer_expr\"]), 0, 1)", "hint": {"static": true, "value": ""}, "choices": {"static": true, "value": ["Yes", "No"]}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(studentanswer=correct_answer,\n correct(),\n incorrect()\n)\n\ninterpreted_answer:\nstudentAnswer=0\n\ncorrect_answer:\nif(eval(settings[\"correct_answer_expr\"]),0,1)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=correct_answer,\n correct(),\n incorrect()\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer=0"}, {"name": "correct_answer", "description": "", "definition": "if(eval(settings[\"correct_answer_expr\"]),0,1)"}], "settings": [{"name": "correct_answer_expr", "label": "Is the answer \"Yes\"?", "help_url": "", "hint": "An expression which evaluates totrue
or false
.", "input_type": "mathematical_expression", "default_value": "true", "subvars": false}], "public_availability": "restricted", "published": false, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "A demo of some custom part types.
", "licence": "None specified"}, "statement": "Custom part types make it easy to re-use non-standard marking algorithms. A custom part type consists of a list of settings in the editor, an input widget, and a marking algorithm.
\nSee this question on the public editor.
", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "yes-no", "useCustomName": true, "customName": "Yes/no", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "This part type makes it easy to set up answers where the answer is either \"yes\" or \"no\". The question author specifies which choice is correct, and the student is awarded full credit if they choose the right answer. You could achieve the same thing with a \"choose one from a list\" part, but it would take longer to set up.
\nIs 7 a prime number?
", "settings": {"correct_answer_expr": "true"}}, {"type": "give-a-numerical-input-for-an-expression", "useCustomName": true, "customName": "Give a numerical input for an expression", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "This part type asks the student to write a numerical value which, when substituted into a mathematical expression, produces the desired value. The author provides the expression and the target value.
\nFind a number $x$ such that $x^2-5x+13 = 7$.
\nTry 1
, 2
and 3
.
This part type asks the student for a list of numbers. The question author gives a list of numbers to expect. The student's answer is correct if it includes every item in the expected list the same number of times, and nothing else. The order doesn't matter.
List the factors of 15.
\nTry 1,3,5,15
and 1,3,5,10,15
.
A demonstration of embedding various kinds of media in a question.
", "licence": null}, "statement": "You can include all sorts of images, videos and interactive diagrams in Numbas questions.
\nSee this question in the public editor.
", "advice": "", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"mh": {"name": "mh", "group": "JSXGraph part", "definition": "precround(V^2/(2*g),2)", "description": "", "templateType": "anything", "can_override": false}, "t1": {"name": "t1", "group": "JSXGraph part", "definition": "precround(t,2)", "description": "", "templateType": "anything", "can_override": false}, "t": {"name": "t", "group": "JSXGraph part", "definition": "V/g", "description": "", "templateType": "anything", "can_override": false}, "v": {"name": "v", "group": "JSXGraph part", "definition": "random(50..100)", "description": "", "templateType": "anything", "can_override": false}, "g": {"name": "g", "group": "JSXGraph part", "definition": "9.81", "description": "", "templateType": "anything", "can_override": false}, "n1": {"name": "n1", "group": "SVG part", "definition": "random(1..99)", "description": "", "templateType": "anything", "can_override": false}, "n2": {"name": "n2", "group": "SVG part", "definition": "random(1..99)", "description": "", "templateType": "anything", "can_override": false}, "n3": {"name": "n3", "group": "SVG part", "definition": "random(1..99)", "description": "", "templateType": "anything", "can_override": false}, "point_a": {"name": "point_a", "group": "GeoGebra part", "definition": "vector(random(0..2#0.1),random(0..2#0.1))", "description": "", "templateType": "anything", "can_override": false}, "point_b": {"name": "point_b", "group": "GeoGebra part", "definition": "vector(random(2..4#0.1),random(2..4#0.1))", "description": "", "templateType": "anything", "can_override": false}, "euk_diagram": {"name": "euk_diagram", "group": "Eukleides part", "definition": "eukleides(\"An angle in a circle\",let(\n a, point(0,0),\n r, 2,\n b, point(r*cos(turn), r*sin(turn)),\n c, point(r*cos(angle+turn), r*sin(angle+turn)),\n [\n circle(a,r) dashed,\n b..a..c open,\n angle(b,a,c),\n center(c..b) label(dpformat(degrees(angle),0)+\"\u00b0\",rad(angle/2+turn),0.15),\n a,\n b color1 draggable(\"B\"),\n c color2 draggable(\"C\",[\"angle\"])\n ]\n),[\"angle\":pi/6,\"turn\":0])", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": "100"}, "ungrouped_variables": [], "variable_groups": [{"name": "SVG part", "variables": ["n1", "n2", "n3"]}, {"name": "JSXGraph part", "variables": ["g", "mh", "t", "t1", "v"]}, {"name": "GeoGebra part", "variables": ["point_a", "point_b"]}, {"name": "Eukleides part", "variables": ["euk_diagram"]}], "functions": {"graphsolution": {"parameters": [], "type": "html", "language": "javascript", "definition": "var variables = question.unwrappedVariables;\nvar v = variables.v;\nvar mh = variables.mh;\nvar t = variables.t;\nvar g = variables.g;\n\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n {boundingBox:[-3,mh+10,2*t+2,-50],\n axis:false,\n showNavigation:false,\n grid:false});\nvar brd = div.board; \n\nbrd.create('axis',[[0,0],[1,0]], {\n ticks: {\n drawLabels: true,\n label: {offset: [-5, -10]},\n minorTicks: 0\n }\n});\nbrd.create('axis',[[0,0],[0,1]], {\n ticks: {\n drawLabels: true,\n label: {offset: [-30, 0]},\n minorTicks: 0\n }\n});\nvar origin = brd.create('point',[0,0],{fixed:true,name:'',size:1});\nvar tangent = brd.create('line',[origin,[1,v]],{fixed:true,name:'',dash:2});\n\nvar student_formula;\n//create a functiongraph from the student input\nfunction userf(t){\n if(student_formula) {\n try {\n //the user input is evaluated at x=t\n var val = scope.evaluate(student_formula,{t:t});\n if(!jme.isType(val,'number')) {\n return 0;\n } else {\n return jme.castToType(val,'number').value;\n }\n }\n catch(e) {\n return 0;\n }\n }\n else\n return 0;\n}\nvar student_curve = brd.create('functiongraph',[userf,0,2*t],{strokeColor:'red',strokeWidth:2});\n\n//pick up the student answer and parse it\nquestion.signals.on('HTMLAttached',function() {\n var part = question.parts[2].gaps[0];\n \n ko.computed(function(){\n var expr = part.display.studentAnswer();\n try {\n student_formula = Numbas.jme.compile(expr);\n }\n catch(e) {\n student_formula = null;\n }\n student_curve.updateCurve();\n\n brd.update();\n });\n}); \n\nreturn div;"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "information", "useCustomName": true, "customName": "Images", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "It's easy to include an image to illustrate your question, or just liven it up.
\n"}, {"type": "information", "useCustomName": true, "customName": "SVG diagram", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Diagrams in SVG format are drawn using vectors, so don't become blurry when scaled up.
\n"}, {"type": "gapfill", "useCustomName": true, "customName": "JSXGraph", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "JSXGraph is a package for creating geometric diagrams and charts. You create diagrams using JavaScript code. Question variables can be used to randomise elements of the diagram, and answers to question parts can be linked to elements of the diagram.
\n{graphsolution()}
\nWrite a formula for the height $y$ at time $t$ of a projectile launched upwards with a speed of {v} m/s.
\n$y=$ [[0]]
\nYour formula is plotted in the graph above. The vertical axis represents $y$ and the horizontal axis represents $t$.
", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "alternatives": [{"type": "jme", "useCustomName": true, "customName": "Raw value of g", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "", "useAlternativeFeedback": true, "answer": "{v}t-1/2{g}*t^2", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": true, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "t", "value": ""}]}], "answer": "{v}t-1/2g*t^2", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": true, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "g", "value": ""}, {"name": "t", "value": ""}]}], "sortAnswers": false}, {"type": "information", "useCustomName": true, "customName": "GeoGebra", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "GeoGebra is an easy-to-use dynamic geometry package. You create diagrams using a graphical interface. Question variables can be used to randomise the elements of a diagram.
\n{geogebra_applet(\"dw4n67kf\")}
"}, {"type": "information", "useCustomName": true, "customName": "Eukleides", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The Eukleides extension provides a way of creating diagrams inside Numbas. Diagrams can be drawn based on question variables, and elements can be made draggable or animated.
\n{max_width(30,euk_diagram)}
"}, {"type": "information", "useCustomName": true, "customName": "Video", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can easily embed videos.
\n"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}, {"name": "Randomisation", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": [""], "variable_overrides": [[]], "questions": [{"name": "Numbas demo: Randomisation", "extensions": ["random_person"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "Demonstration of randomisation: many elements in this question are randomised. The names of the products and clients are randomly chosen, as are the prices and order amounts.
", "licence": "None specified"}, "statement": "Numbas can randomise every element of a question. In this question, the names of the products and people are randomly chosen, as well as the prices and order amounts.
\nSee this question in the public editor.
\nThe Newcastle Calculating Machines Emporium sells a variety of devices for performing calculations. Their two most popular products are {name_x} and {name_y}.
", "advice": "The formula for the total cost of an order is
\n\\[ \\simplify{{price_x}*{initial_x} + {price_y}*{initial_y}} \\]
\nThe order totals are as follows:
\n{table(zip(names,total_costs),[\"Client\",\"Order total (£)\"])}
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"num_people": {"name": "num_people", "group": "Ungrouped variables", "definition": "5", "description": "", "templateType": "anything", "can_override": false}, "price_x, price_y": {"name": "price_x, price_y", "group": "Ungrouped variables", "definition": "shuffle(2..6)", "description": "The prices of the products. They are never equal.
", "templateType": "anything", "can_override": false}, "orders": {"name": "orders", "group": "Ungrouped variables", "definition": "repeat(shuffle(0..10)[0..2],num_people)", "description": "For each person, how much of each product they ordered. Each quantity is distinct
", "templateType": "anything", "can_override": false}, "all_product_names": {"name": "all_product_names", "group": "Ungrouped variables", "definition": "[ \"Calculon\", \"Subtractrix\", \"Addios\", \"Factroid\", \"Plustre\" ]", "description": "Possible product names. They each start with a different letter.
", "templateType": "list of strings", "can_override": false}, "total_costs": {"name": "total_costs", "group": "Ungrouped variables", "definition": "map(\n eval(cost_formula,dict([[string(initial_x),x],[string(initial_y),y]])),\n [x,y],\n orders\n)", "description": "The total cost of each person's order.
", "templateType": "anything", "can_override": false}, "name_x, name_y": {"name": "name_x, name_y", "group": "Ungrouped variables", "definition": "shuffle(all_product_names)", "description": "The names of the two products.
", "templateType": "anything", "can_override": false}, "order_table_data": {"name": "order_table_data", "group": "Ungrouped variables", "definition": "map([name]+order,[name,order],zip(names,orders))", "description": "The data for the table: the person's name, then the quantities of each product ordered.
", "templateType": "anything", "can_override": false}, "names": {"name": "names", "group": "Ungrouped variables", "definition": "map(p[\"name\"],p,random_people_with_different_initials(num_people))", "description": "Names for the people. They each start with a different letter.
", "templateType": "anything", "can_override": false}, "initial_x,initial_y": {"name": "initial_x,initial_y", "group": "Ungrouped variables", "definition": "map(name(lower(name[0])),name,[name_x,name_y])", "description": "Variable names to use for the two products.
", "templateType": "anything", "can_override": false}, "cost_formula": {"name": "cost_formula", "group": "Ungrouped variables", "definition": "substitute([\"price_x\":price_x, \"price_y\": price_y, \"x\": initial_x, \"y\": initial_y],expression(\"price_x * x + price_y*y\"))", "description": "The formula for the total cost of an order.
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["price_x, price_y", "name_x, name_y", "initial_x,initial_y", "num_people", "names", "orders", "order_table_data", "all_product_names", "cost_formula", "total_costs"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "information", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Here is a page from the Emporium's latest catalogue:
\n"}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Write a formula for the total cost of an order of $\\var{initial_x}$ {name_x} units and $\\var{initial_y}$ {name_y} units.
\nTotal cost = [[0]]
", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{price_x}*{initial_x} + {price_y}*{initial_y}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "information", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The last 5 orders from the Newcastle Calculating Machines Emporium are shown below.
\n{table(order_table_data,[\"Client\",name_x,name_y])}
"}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Calculate the total cost of each order.
\nClient | \nOrder total (£) | \n
---|---|
{names[0]} | \n[[0]] | \n
{names[1]} | \n[[1]] | \n
{names[2]} | \n[[2]] | \n
{names[3]} | \n[[3]] | \n
{names[4]} | \n[[4]] | \n
The \"Alternative answers\" feature allows you to set up copies of a part, with different expected answers or settings. Each alternative can award a different number of marks. When the student submits an answer, the alternative that gives the most marks is used, and a feedback message corresponding to that alternative is shown.
\nIn this question, alternate versions accept ever-wider ranges of numbers around the correct answer, awarding fewer marks for less-precise answers.
\nSee this question in the public editor.
", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "random(1001 .. 8888#1)", "description": "", "templateType": "randrange", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(1001..9999-a)", "description": "", "templateType": "anything", "can_override": false}, "total": {"name": "total", "group": "Ungrouped variables", "definition": "a+b", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a", "b", "total"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": true, "customName": "Add two numbers", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Calculate $\\var{a} + \\var{b}$.
\n(Try getting the answer slightly wrong: you're awarded more marks the closer you get to the correct answer.)
", "alternatives": [{"type": "numberentry", "useCustomName": true, "customName": "Within 10", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "You're within 10 of the correct answer.
", "useAlternativeFeedback": false, "minValue": "total-10", "maxValue": "total+10", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Within 100", "marks": "3", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "You're within 100 of the correct answer.
", "useAlternativeFeedback": false, "minValue": "total-100", "maxValue": "total+100", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Within 1000", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "You're within 1000 of the correct answer.
", "useAlternativeFeedback": false, "minValue": "total-1000", "maxValue": "total+1000", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "total", "maxValue": "total", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}, {"name": "Explore mode", "pickingStrategy": "all-ordered", "pickQuestions": "1", "questionNames": ["Design a probability experiment"], "variable_overrides": [[]], "questions": [{"name": "Numbas demo: explore mode", "extensions": ["stats"], "custom_part_types": [{"source": {"pk": 3, "author": {"name": "Christian Lawson-Perfect", "pk": 1}, "edit_page": "/beta/part_type/3/edit"}, "name": "Yes/no", "short_name": "yes-no", "description": "The student is shown two radio choices: \"Yes\" and \"No\". One of them is correct.
", "help_url": "", "input_widget": "radios", "input_options": {"correctAnswer": "if(eval(settings[\"correct_answer_expr\"]), 0, 1)", "hint": {"static": true, "value": ""}, "choices": {"static": true, "value": ["Yes", "No"]}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(studentanswer=correct_answer,\n correct(),\n incorrect()\n)\n\ninterpreted_answer:\nstudentAnswer=0\n\ncorrect_answer:\nif(eval(settings[\"correct_answer_expr\"]),0,1)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=correct_answer,\n correct(),\n incorrect()\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer=0"}, {"name": "correct_answer", "description": "", "definition": "if(eval(settings[\"correct_answer_expr\"]),0,1)"}], "settings": [{"name": "correct_answer_expr", "label": "Is the answer \"Yes\"?", "help_url": "", "hint": "An expression which evaluates totrue
or false
.", "input_type": "mathematical_expression", "default_value": "true", "subvars": false}], "public_availability": "restricted", "published": false, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"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/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Laura Midgley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18287/"}], "tags": [], "metadata": {"description": "An interactive experiment about probability: the student must first 'design' the experiment by deciding how many times they're going to flip a coin, and define what number of heads would make them believe the coin is biased. They must then enter the results of their coin flips, calculate the percentage of heads, and finally decide if the coin is biased, using the condition they specified in the design stage. There are optional hints at each stage.Explore mode makes it possible to create open-ended questions, where the student is free to choose their own path.
\nIn this question, the student is guided through the steps of designing a probability experiment, and then assessed based on the criteria they chose.
\nSee this question in the public editor.
", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"flips": {"name": "flips", "group": "Ungrouped variables", "definition": "parse_flips_jme(flips_string)", "description": "", "templateType": "anything", "can_override": false}, "flips_string": {"name": "flips_string", "group": "Ungrouped variables", "definition": "join(repeat(random(\"h\",\"t\"),num_flips),\" \")", "description": "", "templateType": "anything", "can_override": false}, "num_flips": {"name": "num_flips", "group": "Ungrouped variables", "definition": "100", "description": "", "templateType": "anything", "can_override": false}, "num_heads": {"name": "num_heads", "group": "Ungrouped variables", "definition": "len(filter(x,x,flips))", "description": "", "templateType": "anything", "can_override": false}, "num_tails": {"name": "num_tails", "group": "Ungrouped variables", "definition": "len(flips)-num_heads", "description": "", "templateType": "anything", "can_override": false}, "percent_heads": {"name": "percent_heads", "group": "Ungrouped variables", "definition": "100*num_heads/len(flips)", "description": "", "templateType": "anything", "can_override": false}, "cleaned_flips_string": {"name": "cleaned_flips_string", "group": "Ungrouped variables", "definition": "join(map(if(x,\"H\",\"T\"),x,flips),\" \")", "description": "", "templateType": "anything", "can_override": false}, "critical_number": {"name": "critical_number", "group": "Ungrouped variables", "definition": "max(raw_critical_number, num_flips-raw_critical_number)", "description": "", "templateType": "anything", "can_override": false}, "is_biased": {"name": "is_biased", "group": "Ungrouped variables", "definition": "num_heads>=critical_number or num_tails>=critical_number", "description": "", "templateType": "anything", "can_override": false}, "raw_critical_number": {"name": "raw_critical_number", "group": "Ungrouped variables", "definition": "60", "description": "", "templateType": "anything", "can_override": false}, "critical_likelihood": {"name": "critical_likelihood", "group": "Ungrouped variables", "definition": "critical_number/num_flips", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["num_flips", "raw_critical_number", "critical_number", "flips_string", "flips", "num_heads", "num_tails", "percent_heads", "cleaned_flips_string", "is_biased", "critical_likelihood"], "variable_groups": [], "functions": {"parse_flips": {"parameters": [["s", "string"]], "type": "list", "language": "javascript", "definition": "s = s.toLowerCase().replace(/[^ht]/g,'');\nreturn s.split('').map(function(c) { return new Numbas.jme.types.TBool(c=='h'); });"}, "parse_flips_jme": {"parameters": [["s", "string"]], "type": "list", "language": "jme", "definition": "map(c='h',c,split(s,' '))"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "information", "useCustomName": true, "customName": "Introduction", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Decide number of flips", "rawLabel": "", "otherPart": 1, "variableReplacements": [], "availabilityCondition": "", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "In this exercise you will decide if a coin is biased by flipping it repeatedly and deciding if it lands heads more often than you'd expect.
"}, {"type": "numberentry", "useCustomName": true, "customName": "Decide number of flips", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Define 'biased'", "rawLabel": "", "otherPart": 2, "variableReplacements": [{"variable": "num_flips", "definition": "interpreted_answer"}], "availabilityCondition": "answered", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Design the experiment", "prompt": "How many times will you flip your coin?
", "minValue": "1", "maxValue": "infinity", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Define 'biased'", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Enter data", "rawLabel": "", "otherPart": 4, "variableReplacements": [{"variable": "raw_critical_number", "definition": "interpreted_answer"}], "availabilityCondition": "answered and credit=1", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}, {"label": "What do you expect an unbiased coin do?", "rawLabel": "", "otherPart": 3, "variableReplacements": [], "availabilityCondition": "not (answered or credit=1)", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Design the experiment", "prompt": "How many heads would make you think the coin is biased?
", "minValue": "0", "maxValue": "100", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "What do you expect an unbiased coin do?", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": true, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "With an unbiased coin, how many flips would you expect to land heads up?
", "minValue": "num_flips/2-0.5", "maxValue": "num_flips/2+0.5", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "patternmatch", "useCustomName": true, "customName": "Enter data", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "right_length:\n if(len(parse_flips(studentAnswer))=num_flips,\n correct(\"You have entered your data correctly.\"),\n incorrect(\"You have not entered the right number of flips.\")\n )\n\nmark:\n apply(right_length)\n", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Calculate proportion of heads", "rawLabel": "", "otherPart": 5, "variableReplacements": [{"variable": "flips_string", "definition": "interpreted_answer"}], "availabilityCondition": "answered", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Enter data", "prompt": "Flip the coin {num_flips} times. Each time it lands heads, write an H in the box below. Each time it lands tails, write a T.
", "answer": "[, hHtT]*", "displayAnswer": "", "matchMode": "regex"}, {"type": "numberentry", "useCustomName": true, "customName": "Calculate proportion of heads", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Show frequencies of heads and tails", "rawLabel": "", "otherPart": 6, "variableReplacements": [], "availabilityCondition": "not (answered and credit=1)", "penalty": "Showed frequencies of heads and tails", "penaltyAmount": "1", "showPenaltyHint": true, "lockAfterLeaving": false}, {"label": "Is the coin biased?", "rawLabel": "", "otherPart": 7, "variableReplacements": [], "availabilityCondition": "answered", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Calculate proportion of heads", "prompt": "Your flips were:
\n{cleaned_flips_string}
\nWhat percentage of the flips landed heads?
", "minValue": "percent_heads", "maxValue": "percent_heads", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": 0, "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "information", "useCustomName": true, "customName": "Show frequencies of heads and tails", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": true, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Result | \nHeads | \nTails | \n
Frequency | \n{num_heads} | \n{num_tails} | \n
Do you think your coin is biased?
", "settings": {"correct_answer_expr": "is_biased"}}, {"type": "numberentry", "useCustomName": true, "customName": "Calculate the critical likelihood", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": true, "adaptiveMarkingPenalty": 0, "exploreObjective": "Decide if the coin is biased", "prompt": "You said that a coin is biased if it comes up heads at least {critical_number} times out of {num_flips}. What's that as a percentage?
", "minValue": "100*critical_likelihood", "maxValue": "100*critical_likelihood", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": 0, "precisionPartialCredit": "100", "precisionMessage": "", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "explore", "maxMarks": 0, "objectives": [{"name": "Calculate proportion of heads", "limit": "2"}, {"name": "Decide if the coin is biased", "limit": "5"}, {"name": "Design the experiment", "limit": "2"}, {"name": "Enter data", "limit": "1"}], "penalties": [{"name": "Showed frequencies of heads and tails", "limit": "1"}, {"name": "Hint about critical likelihood", "limit": "1"}], "objectiveVisibility": "when-active", "penaltyVisibility": "when-active"}]}, {"name": "Adaptive marking", "pickingStrategy": "all-ordered", "pickQuestions": "1", "questionNames": ["Account for an incorrect answer earlier in the question", "Use data provided by the student in later parts"], "variable_overrides": [[], []], "questions": [{"name": "Numbas demo: adaptive marking", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "Demonstration of adaptive marking: the student must first add up the number of apples to buy, then work out how much that would cost. Adaptive marking carries an incorrect number of apples into the cost calculation.
", "licence": null}, "statement": "Adaptive marking allows you to apply 'error-carried-forward' marking, or to base the answers for a question on data entered by the student at the start.
\nIn this question, adaptive marking can use the number of apples the student gives in the first part to work out the total cost in the second part.
\nSee this question in the public editor.
", "advice": "", "rulesets": {}, "variables": {"apples_to_buy": {"name": "apples_to_buy", "group": "Ungrouped variables", "definition": "a_apples + b_apples", "description": "", "templateType": "anything"}, "a_apples": {"name": "a_apples", "group": "Ungrouped variables", "definition": "random(2 .. 5#1)", "description": "", "templateType": "randrange"}, "b_apples": {"name": "b_apples", "group": "Ungrouped variables", "definition": "random(2 .. 5#1)", "description": "", "templateType": "randrange"}, "cost_per_apple": {"name": "cost_per_apple", "group": "Ungrouped variables", "definition": "1.1", "description": "", "templateType": "anything"}, "total_cost": {"name": "total_cost", "group": "Ungrouped variables", "definition": "cost_per_apple * apples_to_buy", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a_apples", "b_apples", "apples_to_buy", "cost_per_apple", "total_cost"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": true, "customName": "How many apples to buy", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "My family wants {a_apples} bags of apples and my friend wants {b_apples} bags of apples. How many bags of apples should I buy?
", "minValue": "apples_to_buy", "maxValue": "apples_to_buy", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "gapfill", "useCustomName": true, "customName": "Total cost", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "One bag of apples costs {currency(cost_per_apple,\"£\",\"p\")}. How much will I spend?
\n£ [[0]]
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "apples_to_buy", "part": "p0", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "total_cost", "maxValue": "total_cost", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Adaptive marking: use data provided by the student in later parts", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "This question models an experiment: the student must collect some data and enter it at the start of the question, and the expected answers to subsequent parts are marked based on that data.
\nA downside of working this way is that you have to set up the variable replacements on each part of the question. You could avoid this by using explore mode.
", "licence": "None specified"}, "statement": "This question demonstrates how to use adaptive marking to take data from the student and use it when marking later parts.
\nView this question in the Numbas editor.
", "advice": "To calculate the volume of your box, multiply its width, depth and height together.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"width": {"name": "width", "group": "Ungrouped variables", "definition": "1", "description": "", "templateType": "anything", "can_override": false}, "height": {"name": "height", "group": "Ungrouped variables", "definition": "2", "description": "", "templateType": "anything", "can_override": false}, "depth": {"name": "depth", "group": "Ungrouped variables", "definition": "3", "description": "", "templateType": "anything", "can_override": false}, "volume": {"name": "volume", "group": "Ungrouped variables", "definition": "width * height * depth", "description": "The volume of the box.
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["width", "height", "depth", "volume"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Longest side", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Measure a cuboid box. Enter its dimension, in centimetres, below.
\nWidth | \n[[0]] | \n
Height | \n[[1]] | \n
Depth | \n[[2]] | \n
What is the volume of your box, in cm³?
", "minValue": "volume", "maxValue": "volume", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Longest side", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "width", "part": "p0g0", "must_go_first": true}, {"variable": "height", "part": "p0g1", "must_go_first": true}, {"variable": "depth", "part": "p0g2", "must_go_first": true}], "variableReplacementStrategy": "alwaysreplace", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "What is the longest dimension of the box, in cm?
", "minValue": "max([width,depth,height])", "maxValue": "max([width,depth,height])", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}, {"name": "Extensions", "pickingStrategy": "all-ordered", "pickQuestions": "1", "questionNames": ["Random people", "Spreadsheets", "Quantities with units"], "variable_overrides": [[], [], []], "questions": [{"name": "Numbas demo: random person extension", "extensions": ["random_person"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}], "tags": [], "metadata": {"description": "A demonstration of the random person extension, which picks representative names of people.
", "licence": "None specified"}, "statement": "When writing word problems, it's good to ensure a fair balance of gender and other characteristics in named characters. The 'random person' extension makes this easy.
\nSee this question in the public editor.
", "advice": "We are told that {pname} gets paid a total of $£\\var{payment}$ at the end of {their} summer job and that {they} work{s} at {their} job for $\\var{weeks}$ weeks.
\nTo calculate the amount of money {pname} gets paid per week, we divide the total amount of money that {they} earn{s} at the end of {their} job by how many weeks that {they} work{s} for.
\n\\[£\\displaystyle\\frac{\\var{payment}}{\\var{weeks}} = £\\var{{payment/weeks}}.\\]
\nTherefore {pname} gets paid $£\\var{{payment/weeks}}$/week.
\nNote that in compound measures, a forward slash symbol / is often used instead of the word 'per'. So $£\\var{{payment/weeks}}$/week means the same as $£\\var{{payment/weeks}}$ per week.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"person": {"name": "person", "group": "A person", "definition": "random_person()", "description": "A random person
", "templateType": "anything", "can_override": false}, "weeks": {"name": "weeks", "group": "Ungrouped variables", "definition": "random(5,8)", "description": "Number of weeks person works for
", "templateType": "anything", "can_override": false}, "payment": {"name": "payment", "group": "Ungrouped variables", "definition": "random(1400,1600,1800)", "description": "amount person gets paid
", "templateType": "anything", "can_override": false}, "pname": {"name": "pname", "group": "A person", "definition": "person[\"name\"]", "description": "", "templateType": "anything", "can_override": false}, "they": {"name": "they", "group": "A person", "definition": "person[\"pronouns\"][\"they\"]", "description": "", "templateType": "anything", "can_override": false}, "their": {"name": "their", "group": "A person", "definition": "person[\"pronouns\"][\"their\"]", "description": "", "templateType": "anything", "can_override": false}, "theirs": {"name": "theirs", "group": "A person", "definition": "person[\"pronouns\"][\"theirs\"]", "description": "", "templateType": "anything", "can_override": false}, "s": {"name": "s", "group": "A person", "definition": "if(person[\"gender\"]=\"neutral\",\"\",\"s\")", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["payment", "weeks"], "variable_groups": [{"name": "A person", "variables": ["person", "pname", "they", "their", "theirs", "s"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "{pname} gets paid a total of $£\\var{payment}$ at the end of {their} summer job; {they} work{s} for $\\var{weeks}$ weeks.
\nHow much does {pname} get paid per week?
\n£[[0]]/week
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{payment}/{weeks}", "maxValue": "{payment}/{weeks}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Product fact sheet", "extensions": ["jsxgraph", "sheets"], "custom_part_types": [{"source": {"pk": 242, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/242/edit"}, "name": "Spreadsheet", "short_name": "spreadsheet", "description": "An editable spreadsheet. Ranges of cells can be disabled, and you can specify ranges of cells to be marked. A cell is marked correct if its value is equal to the value in the expected answer spreadsheet.
", "help_url": "", "input_widget": "spread-sheet", "input_options": {"correctAnswer": "settings[\"correct_answer\"]", "hint": {"static": true, "value": ""}, "initial_sheet": {"static": false, "value": "disable_cells(settings[\"initial_sheet\"], settings[\"disable_ranges\"])"}}, "can_be_gap": true, "can_be_step": true, "marking_script": "correctAnswer:\nsettings[\"correct_answer\"]\n\nmark:\nif(sum(mark_ranges)=0,\n incorrect(),\n apply(mark_ranges)\n)\n\ninterpreted_answer:\nstudentAnswer\n\nrange_cells:\nmap(parse_range(ref),ref,values(settings[\"mark_ranges\"]))\n\ntotal_cells:\nlen(flatten(range_cells))\n\nrange_weights:\nswitch(\n settings[\"marking_method\"]=\"per_cell\",\n map(len(r)/total_cells, r, range_cells),\n // otherwise, mark per range\n repeat(1/len(range_cells), len(range_cells))\n)\n\nmark_ranges:\nmap(\n let(\n range_credit,\n sum(map(\n let(\n correctCellString, correctAnswer[c],\n correctCellNumber, parsenumber(correctCellString, notation_styles),\n studentCellString, studentAnswer[c],\n studentCellNumber, parsenumber(studentCellString, notation_styles),\n award(\n 1/len(cells), \n if(isnan(correctCellNumber) and correctCellString<>\"\",\n lower(correctCellString) = lower(studentCellString),\n abs(studentCellNumber - if(isnan(correctCellNumber),0,correctCellNumber)) <= settings[\"tolerance\"]\n )\n )\n ),\n c,\n cells\n )),\n message,\n switch(\n range_credit=0,\n if(len(cells)=1, \"This entry is incorrect.\", \"All entries in this range are incorrect.\"),\n range_credit=1,\n if(len(cells)=1, \"This entry is correct.\", \"All entries in this range are correct.\"),\n //otherwise\n \"Some entries in this range are correct.\"\n ),\n assert(len(cells)=0, add_credit(range_credit*w, \"{name}: \"+message)); \n range_credit\n ),\n [cells,w,name],\n zip(range_cells, range_weights, keys(settings[\"mark_ranges\"]))\n)\n\nnotation_styles:\n[\"plain\",\"si-en\"]", "marking_notes": [{"name": "correctAnswer", "description": "A spreadsheet representing the expected answer.
", "definition": "settings[\"correct_answer\"]"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(sum(mark_ranges)=0,\n incorrect(),\n apply(mark_ranges)\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer"}, {"name": "range_cells", "description": "For each range to be marked, the addresses of the cells in that range.
", "definition": "map(parse_range(ref),ref,values(settings[\"mark_ranges\"]))"}, {"name": "total_cells", "description": "The total number of cells to be marked. Cells in overlapping ranges will be counted once for each range they're in.
", "definition": "len(flatten(range_cells))"}, {"name": "range_weights", "description": "The weight of each range, as a proportion of the available credit.
", "definition": "switch(\n settings[\"marking_method\"]=\"per_cell\",\n map(len(r)/total_cells, r, range_cells),\n // otherwise, mark per range\n repeat(1/len(range_cells), len(range_cells))\n)"}, {"name": "mark_ranges", "description": "Mark each of the ranges specified by the question author.
", "definition": "map(\n let(\n range_credit,\n sum(map(\n let(\n correctCellString, correctAnswer[c],\n correctCellNumber, parsenumber(correctCellString, notation_styles),\n studentCellString, studentAnswer[c],\n studentCellNumber, parsenumber(studentCellString, notation_styles),\n award(\n 1/len(cells), \n if(isnan(correctCellNumber) and correctCellString<>\"\",\n lower(correctCellString) = lower(studentCellString),\n abs(studentCellNumber - if(isnan(correctCellNumber),0,correctCellNumber)) <= settings[\"tolerance\"]\n )\n )\n ),\n c,\n cells\n )),\n message,\n switch(\n range_credit=0,\n if(len(cells)=1, \"This entry is incorrect.\", \"All entries in this range are incorrect.\"),\n range_credit=1,\n if(len(cells)=1, \"This entry is correct.\", \"All entries in this range are correct.\"),\n //otherwise\n \"Some entries in this range are correct.\"\n ),\n assert(len(cells)=0, add_credit(range_credit*w, \"{name}: \"+message)); \n range_credit\n ),\n [cells,w,name],\n zip(range_cells, range_weights, keys(settings[\"mark_ranges\"]))\n)"}, {"name": "notation_styles", "description": "Accepted number notation styles for a value in an individual cell.
", "definition": "[\"plain\",\"si-en\"]"}], "settings": [{"name": "initial_sheet", "label": "Initial sheet", "help_url": "", "hint": "Aspreadsheet
object giving the initial state of the sheet that the student should fill in.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "correct_answer", "label": "Correct answer", "help_url": "", "hint": "A spreadsheet
object representing a correct answer to the part.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "disable_ranges", "label": "Ranges to disable", "help_url": "", "hint": "A list of cell or range references, denoting the cells that should not be editable.", "input_type": "code", "default_value": "[]", "evaluate": true}, {"name": "mark_ranges", "label": "Ranges to mark", "help_url": "", "hint": "A dictionary of cell or range references, mapping names to ranges of cells, denoting the cells that should be compared for equality with the expected answer.", "input_type": "code", "default_value": "dict()", "evaluate": true}, {"name": "marking_method", "label": "Marking method", "help_url": "", "hint": "", "input_type": "dropdown", "default_value": "per_cell", "choices": [{"value": "per_cell", "label": "Each cell has the same weight"}, {"value": "per_range", "label": "Each range has the same weight"}]}, {"name": "tolerance", "label": "Allowed margin of error", "help_url": "", "hint": "", "input_type": "code", "default_value": "0", "evaluate": true}], "public_availability": "always", "published": true, "extensions": ["sheets"]}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "http://clppc:8000/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "Using some passages of text, fill in a product fact sheet.
\nA simple example showing how to mark entries in a spreadsheet.
", "licence": null}, "statement": "You're considering buying a new {product_name}. The manufacturer's website contains the following information:
\n\n\nThe new {product_name} does everything you need it do. Drawing only {electricity_use}W, it uses much less electricity than most towns. And invention fluid use is lower than ever, at a mere {fluid_use}ml per hour.
\nMeasuring {dimensions[0]}×{dimensions[1]}×{dimensions[2]}cm, where can't you put it?
\nPriced affordably at {currency(price,\"£\",\"p\")}, get one today!
\n
You also found some reviews online:
\n{reviews_table}
\nOne review noted that each {product_name} incurs {currency(externalised_costs,\"£\",\"p\")} in externalised costs.
", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"raw_spreadsheet": {"name": "raw_spreadsheet", "group": "Spreadsheet", "definition": "spreadsheet_from_base64_file(safe(\"product-fact-sheet.xlsx\"), safe(\"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\"))", "description": "", "templateType": "spreadsheet", "can_override": false}, "filled_spreadsheet": {"name": "filled_spreadsheet", "group": "Completed spreadsheet", "definition": "raw_spreadsheet\n|> fill_range(\"B2\",[[product_name]])\n|> fill_range(\"D2\", [[price]])\n|> fill_range(\"F3:F6\", [[electricity_use],[fluid_use],[externalised_costs]])\n|> fill_range(\"A5:C5\", [dimensions])\n|> fill_range(\"B9:D9\", [review_counts])", "description": "", "templateType": "anything", "can_override": false}, "product_names": {"name": "product_names", "group": "Data", "definition": "[ \"Whizzo 3\", \"The New Gloop\", \"Vwlr\", \"Crumpetron\", \"Autocomb Pro\" ]", "description": "", "templateType": "list of strings", "can_override": false}, "product_name": {"name": "product_name", "group": "Data", "definition": "random(product_names)", "description": "", "templateType": "anything", "can_override": false}, "dimensions": {"name": "dimensions", "group": "Data", "definition": "repeat(random(10..100#5),3)", "description": "", "templateType": "anything", "can_override": false}, "electricity_use": {"name": "electricity_use", "group": "Data", "definition": "random(10..200#5)", "description": "", "templateType": "anything", "can_override": false}, "fluid_use": {"name": "fluid_use", "group": "Data", "definition": "random(300..900#10)", "description": "", "templateType": "anything", "can_override": false}, "externalised_costs": {"name": "externalised_costs", "group": "Data", "definition": "random(1000..9000#100)", "description": "", "templateType": "anything", "can_override": false}, "price": {"name": "price", "group": "Data", "definition": "random(59..409#10)", "description": "", "templateType": "anything", "can_override": false}, "individual_reviews": {"name": "individual_reviews", "group": "Data", "definition": "repeat(random(scores),5)", "description": "", "templateType": "anything", "can_override": false}, "all_reviewers": {"name": "all_reviewers", "group": "Data", "definition": "[ \"Invention Review\", \"Product Quarterly\", \"Whence Gizmos\", \"Doodads Today\", \"That Thingamajig\", \"Contraption Action\" ]", "description": "", "templateType": "list of strings", "can_override": false}, "reviewers": {"name": "reviewers", "group": "Data", "definition": "shuffle(all_reviewers)", "description": "", "templateType": "anything", "can_override": false}, "reviews_table": {"name": "reviews_table", "group": "Data", "definition": "table(zip(reviewers,individual_reviews),[\"Reviewer\",\"Score\"])", "description": "", "templateType": "anything", "can_override": false}, "review_counts": {"name": "review_counts", "group": "Data", "definition": "map(len(filter(x=score,x,individual_reviews)),score,scores)", "description": "", "templateType": "anything", "can_override": false}, "scores": {"name": "scores", "group": "Data", "definition": "[ \"Bad\", \"Neutral\", \"Good\" ]", "description": "", "templateType": "list of strings", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "Spreadsheet", "variables": ["raw_spreadsheet"]}, {"name": "Data", "variables": ["product_names", "product_name", "dimensions", "electricity_use", "fluid_use", "externalised_costs", "price", "scores", "individual_reviews", "all_reviewers", "reviewers", "reviews_table", "review_counts"]}, {"name": "Completed spreadsheet", "variables": ["filled_spreadsheet"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "spreadsheet", "useCustomName": false, "customName": "", "marks": "11", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Before making a purchase, you always fill in a product fact sheet. Fill in the product fact sheet for the {product_name}, using the information above.
", "settings": {"initial_sheet": "raw_spreadsheet", "correct_answer": "filled_spreadsheet", "disable_ranges": "[\"A1:F1\", \"A2\",\"C2\",\"E2:F2\",\"A3:C3\",\"A4:C4\",\"E3:E5\",\"A7:D8\",\"A8:A9\"]", "mark_ranges": "[\n \"Product name\": \"B2\",\n \"Price\": \"D2\",\n \"Running costs\": \"F3:F5\",\n \"Dimensions\": \"A5:C5\",\n \"Reviews\": \"B9:D9\"\n]", "marking_method": "per_cell", "tolerance": "0"}}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Numbas demo: quantities with units", "extensions": ["quantities"], "custom_part_types": [{"source": {"pk": 8, "author": {"name": "Christian Lawson-Perfect", "pk": 1}, "edit_page": "/beta/part_type/8/edit"}, "name": "Quantity with units", "short_name": "quantity", "description": "The student enters a quantity with units.
", "help_url": "https://github.com/numbas/numbas-extension-quantities", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings[\"correctAnswer\"])", "hint": {"static": false, "value": "switch(\n settings[\"hint\"]=\"remind units\",\n \"Include units in your answer.\",\n settings[\"hint\"]=\"show units\",\n \"Give your answer in \"+units_string(settings[\"correctAnswer\"])\n ,\n \"\"\n)"}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\napply(valid_number);\napply(student_quantity); \napply(has_units);\napply(compatible);\ntry(\n correctif(close_enough),\n x,\n apply(student_quantity)\n);\napply(same_units)\n\ninterpreted_answer:\nstudent_quantity\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_number:\nmatch_student_number[1]\n\nraw_student_units:\ntry(\n quantity(studentAnswer[len(match_student_number[0])..len(studentAnswer)]),\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)\n\nstudent_units:\nif(compatible(raw_student_units,correct_units) or settings[\"incompatible_units_action\"]<>\"convert\",\n raw_student_units,\n correct_units\n)\n\nstudent_quantity:\napply(student_units);\ntry(\n student_number * student_units,\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\ncompatible:\nif(compatible(raw_student_units,correct_quantity),\n true\n,\n let(message,\"Your answer does not have the correct dimensions.\",\n if(settings[\"incompatible_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n if(settings[\"incompatible_units_action\"]=\"convert\",\n incorrect(\"Your answer does not have the correct dimensions. It will be marked as if the correct dimensions were used, and then a penalty will be applied.\")\n ,\n incorrect(\"Your answer does not have the correct dimensions.\");\n end()\n )\n );\n false\n )\n)\n\ncorrect_units:\nunits(correct_quantity)\n\nsame_units:\nassert(raw_student_units=correct_units,\n let(\n message,if(settings[\"hint\"]=\"show units\",\"You did not give your answer in \"+units_string(correct_units)+\".\", \"Your answer is not in the expected units.\"),\n switch(\n settings[\"different_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n settings[\"different_units_action\"]=\"incorrect\",\n incorrect(message); \n warn(message);\n end()\n ,\n settings[\"different_units_action\"]=\"warn\",\n warn(message);\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n settings[\"different_units_penalty\"]<1,\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n false\n )\n );\n false\n)\n\nhas_units:\nassert(not unitless(student_quantity),\n assert(settings[\"allow_unitless\"],\n warn(\"You must include the units in your answer.\");\n fail(\"You did not include units in your answer.\")\n )\n)\n\ncan_compare:\ncompatible or settings[\"incompatible_units_action\"]=\"convert\"\n\nclose_enough:\nif(can_compare,\n student_quantity>=correct_quantity - wiggle \n and \n student_quantity<=correct_quantity + wiggle \n,\n false\n)\n\nwiggle:\nunits(correct_quantity)*abs(eval(settings[\"wiggle\"]))\n\nvalid_number:\nif(isNaN(student_number),\n warn(translate(\"part.numberentry.answer invalid\"));\n fail(translate(\"part.numberentry.answer invalid\"))\n,\n true\n )", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "apply(valid_number);\napply(student_quantity); \napply(has_units);\napply(compatible);\ntry(\n correctif(close_enough),\n x,\n apply(student_quantity)\n);\napply(same_units)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "student_quantity"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_number", "description": "The scalar part of the student's quantity
", "definition": "match_student_number[1]"}, {"name": "raw_student_units", "description": "The units of the student's quantity, before converting.
", "definition": "try(\n quantity(studentAnswer[len(match_student_number[0])..len(studentAnswer)]),\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)"}, {"name": "student_units", "description": "The units of the student's quantity.
\nIf the student used units incompatible with the units in the expected answer, and the \"what to do if incompatible units used\" option is set to \"mark as if correct units used\", the student's units are ignored and the expected units are used instead.
", "definition": "if(compatible(raw_student_units,correct_units) or settings[\"incompatible_units_action\"]<>\"convert\",\n raw_student_units,\n correct_units\n)"}, {"name": "student_quantity", "description": "The student's answer, interpreted as a quantity.
\nMarking fails if the student does not enter a valid quantity.
", "definition": "apply(student_units);\ntry(\n student_number * student_units,\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]"}, {"name": "compatible", "description": "Are the units of the student's quantity compatible with the units of the expected quantity?
", "definition": "if(compatible(raw_student_units,correct_quantity),\n true\n,\n let(message,\"Your answer does not have the correct dimensions.\",\n if(settings[\"incompatible_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n if(settings[\"incompatible_units_action\"]=\"convert\",\n incorrect(\"Your answer does not have the correct dimensions. It will be marked as if the correct dimensions were used, and then a penalty will be applied.\")\n ,\n incorrect(\"Your answer does not have the correct dimensions.\");\n end()\n )\n );\n false\n )\n)"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)"}, {"name": "same_units", "description": "/Are the student's quantity and the expected quantity in exactly the same units?
", "definition": "assert(raw_student_units=correct_units,\n let(\n message,if(settings[\"hint\"]=\"show units\",\"You did not give your answer in \"+units_string(correct_units)+\".\", \"Your answer is not in the expected units.\"),\n switch(\n settings[\"different_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n settings[\"different_units_action\"]=\"incorrect\",\n incorrect(message); \n warn(message);\n end()\n ,\n settings[\"different_units_action\"]=\"warn\",\n warn(message);\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n settings[\"different_units_penalty\"]<1,\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n false\n )\n );\n false\n)"}, {"name": "has_units", "description": "", "definition": "assert(not unitless(student_quantity),\n assert(settings[\"allow_unitless\"],\n warn(\"You must include the units in your answer.\");\n fail(\"You did not include units in your answer.\")\n )\n)"}, {"name": "can_compare", "description": "Can the student's answer be compared with the correct answer? True if compatible units used, or \"mark as if correct units used\" selected.
", "definition": "compatible or settings[\"incompatible_units_action\"]=\"convert\""}, {"name": "close_enough", "description": "Is the student's quantity within the allowed tolerance of the expected answer?
", "definition": "if(can_compare,\n student_quantity>=correct_quantity - wiggle \n and \n student_quantity<=correct_quantity + wiggle \n,\n false\n)"}, {"name": "wiggle", "description": "", "definition": "units(correct_quantity)*abs(eval(settings[\"wiggle\"]))"}, {"name": "valid_number", "description": "Is the scalar part of the student's answer a valid number?
", "definition": "if(isNaN(student_number),\n warn(translate(\"part.numberentry.answer invalid\"));\n fail(translate(\"part.numberentry.answer invalid\"))\n,\n true\n )\n"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The expected quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "hint", "label": "Input hint", "help_url": "", "hint": "", "input_type": "dropdown", "default_value": "remind units", "choices": [{"value": "none", "label": "None"}, {"value": "remind units", "label": "Remind to include units"}, {"value": "show units", "label": "Show required units"}]}, {"name": "allow_unitless", "label": "Allow unitless answer?", "help_url": "", "hint": "If not ticked, the student is prevented from submitting an answer without specifying units.", "input_type": "checkbox", "default_value": true}, {"name": "incompatible_units_action", "label": "What to do if incompatible units used", "help_url": "", "hint": "If the student's answer is given in units incompatible with the correct answer's units:A demo of the \"quantities with units\" extension and custom part type.
", "licence": null}, "statement": "The 'quantities with units' extension adds tools to work with measurements. You can do arithmetic on quantities with associated units, and there's a custom part type which asks the student to enter a quantity along with its units.
\nSee this question on the public editor.
", "advice": "", "rulesets": {}, "variables": {"width": {"name": "width", "group": "Ungrouped variables", "definition": "qty(random(30..80#10),\"cm\")", "description": "", "templateType": "anything"}, "height": {"name": "height", "group": "Ungrouped variables", "definition": "qty(random(20..50#10),\"cm\")", "description": "", "templateType": "anything"}, "length": {"name": "length", "group": "Ungrouped variables", "definition": "qty(random(10..40#10),\"cm\")", "description": "", "templateType": "anything"}, "weight": {"name": "weight", "group": "Ungrouped variables", "definition": "density*length*width*height", "description": "", "templateType": "anything"}, "density": {"name": "density", "group": "Ungrouped variables", "definition": "qty(random(100..200#1),\"kg/m^3\")", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["width", "height", "length", "weight", "density"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "quantity", "useCustomName": true, "customName": "A quantity with associated units", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Write 1kg. Any compatible unit is also acceptable.
\nTry 1kg
, 1000g
.
You can require that the student uses exactly the same units as the expected answer, rather than converting between compatible units.
\nConvert 240cm to metres.
\nTry 2.4m
and 240cm
.
You can prevent the student from submitting an answer without units.
\nWrite 15cm.
", "settings": {"correctAnswer": "qty(15,\"cm\")", "hint": "remind units", "allow_unitless": false, "incompatible_units_action": "incorrect", "different_units_action": "convert", "different_units_penalty": "100", "wiggle": "10^-12"}}, {"type": "quantity", "useCustomName": true, "customName": "Randomised answers", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "You can do arithmetic with quantities. In this part, the dimensions of the box and its density are randomised, and the weight is calculated from that.
\nA box measures {width} by {height} by {length}, and weights {weight}.
\nWhat is the box's density?
\nTry {plain_string(density)}
and{plain_string(density in \"g/cm^3\")}
.
This is Numbas.
\nA Numbas test consists of one or more questions, each of which is split up into one or more parts.
\nTry the questions in this demo exam to see Numbas' advanced features for yourself.
\nUse the Try another question like this one button to re-randomise a question, and the Reveal answers button to see a worked solution along with model answers.
\nSee this exam in the public editor.
", "end_message": "", "reviewshowscore": true, "reviewshowfeedback": true, "reviewshowexpectedanswer": true, "reviewshowadvice": true, "results_options": {"printquestions": true, "printadvice": true}, "feedbackmessages": []}, "diagnostic": {"knowledge_graph": {"topics": [], "learning_objectives": []}, "script": "diagnosys", "customScript": ""}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/beta/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Aamir Khan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4537/"}, {"name": "Laura Midgley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18287/"}], "extensions": ["eukleides", "geogebra", "jsxgraph", "quantities", "random_person", "sheets", "stats"], "custom_part_types": [{"source": {"pk": 6, "author": {"name": "Christian Lawson-Perfect", "pk": 1}, "edit_page": "/beta/part_type/6/edit"}, "name": "Give a numerical input for an expression", "short_name": "give-a-numerical-input-for-an-expression", "description": "The student gives a point $x$ at which to evaluate a given function $f$. The answer is correct if $f(x)$ is the expected value.
", "help_url": "", "input_widget": "number", "input_options": {"correctAnswer": "settings[\"correctAnswer\"]", "hint": {"static": true, "value": ""}, "allowedNotationStyles": {"static": true, "value": ["plain", "en", "si-en"]}, "allowFractions": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(equal,\n correct()\n,\n incorrect(settings[\"student_value_description\"]+\" $\"+student_value+\"$.\")\n)\n\ninterpreted_answer:\nstudentAnswer\n\nstudent_value:\neval(settings[\"expression\"],[\"x\":studentAnswer])\n\nequal:\nwithintolerance(student_value,settings[\"expected_value\"],0.00001)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(equal,\n correct()\n,\n incorrect(settings[\"student_value_description\"]+\" $\"+student_value+\"$.\")\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer"}, {"name": "student_value", "description": "", "definition": "eval(settings[\"expression\"],[\"x\":studentAnswer])"}, {"name": "equal", "description": "", "definition": "withintolerance(student_value,settings[\"expected_value\"],0.00001)"}], "settings": [{"name": "expected_value", "label": "Expected value", "help_url": "", "hint": "The value that the function should take at the given point.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The value that the student should write.", "input_type": "string", "default_value": "", "subvars": true}, {"name": "student_value_description", "label": "Description of the student's value", "help_url": "", "hint": "", "input_type": "string", "default_value": "The value at your point is", "subvars": true}, {"name": "expression", "label": "Function to evaluate", "help_url": "", "hint": "The function that will be applied to the student's number.The student enters a quantity with units.
", "help_url": "https://github.com/numbas/numbas-extension-quantities", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings[\"correctAnswer\"])", "hint": {"static": false, "value": "switch(\n settings[\"hint\"]=\"remind units\",\n \"Include units in your answer.\",\n settings[\"hint\"]=\"show units\",\n \"Give your answer in \"+units_string(settings[\"correctAnswer\"])\n ,\n \"\"\n)"}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\napply(valid_number);\napply(student_quantity); \napply(has_units);\napply(compatible);\ntry(\n correctif(close_enough),\n x,\n apply(student_quantity)\n);\napply(same_units)\n\ninterpreted_answer:\nstudent_quantity\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_number:\nmatch_student_number[1]\n\nraw_student_units:\ntry(\n quantity(studentAnswer[len(match_student_number[0])..len(studentAnswer)]),\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)\n\nstudent_units:\nif(compatible(raw_student_units,correct_units) or settings[\"incompatible_units_action\"]<>\"convert\",\n raw_student_units,\n correct_units\n)\n\nstudent_quantity:\napply(student_units);\ntry(\n student_number * student_units,\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\ncompatible:\nif(compatible(raw_student_units,correct_quantity),\n true\n,\n let(message,\"Your answer does not have the correct dimensions.\",\n if(settings[\"incompatible_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n if(settings[\"incompatible_units_action\"]=\"convert\",\n incorrect(\"Your answer does not have the correct dimensions. It will be marked as if the correct dimensions were used, and then a penalty will be applied.\")\n ,\n incorrect(\"Your answer does not have the correct dimensions.\");\n end()\n )\n );\n false\n )\n)\n\ncorrect_units:\nunits(correct_quantity)\n\nsame_units:\nassert(raw_student_units=correct_units,\n let(\n message,if(settings[\"hint\"]=\"show units\",\"You did not give your answer in \"+units_string(correct_units)+\".\", \"Your answer is not in the expected units.\"),\n switch(\n settings[\"different_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n settings[\"different_units_action\"]=\"incorrect\",\n incorrect(message); \n warn(message);\n end()\n ,\n settings[\"different_units_action\"]=\"warn\",\n warn(message);\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n settings[\"different_units_penalty\"]<1,\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n false\n )\n );\n false\n)\n\nhas_units:\nassert(not unitless(student_quantity),\n assert(settings[\"allow_unitless\"],\n warn(\"You must include the units in your answer.\");\n fail(\"You did not include units in your answer.\")\n )\n)\n\ncan_compare:\ncompatible or settings[\"incompatible_units_action\"]=\"convert\"\n\nclose_enough:\nif(can_compare,\n student_quantity>=correct_quantity - wiggle \n and \n student_quantity<=correct_quantity + wiggle \n,\n false\n)\n\nwiggle:\nunits(correct_quantity)*abs(eval(settings[\"wiggle\"]))\n\nvalid_number:\nif(isNaN(student_number),\n warn(translate(\"part.numberentry.answer invalid\"));\n fail(translate(\"part.numberentry.answer invalid\"))\n,\n true\n )", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "apply(valid_number);\napply(student_quantity); \napply(has_units);\napply(compatible);\ntry(\n correctif(close_enough),\n x,\n apply(student_quantity)\n);\napply(same_units)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "student_quantity"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_number", "description": "The scalar part of the student's quantity
", "definition": "match_student_number[1]"}, {"name": "raw_student_units", "description": "The units of the student's quantity, before converting.
", "definition": "try(\n quantity(studentAnswer[len(match_student_number[0])..len(studentAnswer)]),\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)"}, {"name": "student_units", "description": "The units of the student's quantity.
\nIf the student used units incompatible with the units in the expected answer, and the \"what to do if incompatible units used\" option is set to \"mark as if correct units used\", the student's units are ignored and the expected units are used instead.
", "definition": "if(compatible(raw_student_units,correct_units) or settings[\"incompatible_units_action\"]<>\"convert\",\n raw_student_units,\n correct_units\n)"}, {"name": "student_quantity", "description": "The student's answer, interpreted as a quantity.
\nMarking fails if the student does not enter a valid quantity.
", "definition": "apply(student_units);\ntry(\n student_number * student_units,\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]"}, {"name": "compatible", "description": "Are the units of the student's quantity compatible with the units of the expected quantity?
", "definition": "if(compatible(raw_student_units,correct_quantity),\n true\n,\n let(message,\"Your answer does not have the correct dimensions.\",\n if(settings[\"incompatible_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n if(settings[\"incompatible_units_action\"]=\"convert\",\n incorrect(\"Your answer does not have the correct dimensions. It will be marked as if the correct dimensions were used, and then a penalty will be applied.\")\n ,\n incorrect(\"Your answer does not have the correct dimensions.\");\n end()\n )\n );\n false\n )\n)"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)"}, {"name": "same_units", "description": "/Are the student's quantity and the expected quantity in exactly the same units?
", "definition": "assert(raw_student_units=correct_units,\n let(\n message,if(settings[\"hint\"]=\"show units\",\"You did not give your answer in \"+units_string(correct_units)+\".\", \"Your answer is not in the expected units.\"),\n switch(\n settings[\"different_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n settings[\"different_units_action\"]=\"incorrect\",\n incorrect(message); \n warn(message);\n end()\n ,\n settings[\"different_units_action\"]=\"warn\",\n warn(message);\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n settings[\"different_units_penalty\"]<1,\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n false\n )\n );\n false\n)"}, {"name": "has_units", "description": "", "definition": "assert(not unitless(student_quantity),\n assert(settings[\"allow_unitless\"],\n warn(\"You must include the units in your answer.\");\n fail(\"You did not include units in your answer.\")\n )\n)"}, {"name": "can_compare", "description": "Can the student's answer be compared with the correct answer? True if compatible units used, or \"mark as if correct units used\" selected.
", "definition": "compatible or settings[\"incompatible_units_action\"]=\"convert\""}, {"name": "close_enough", "description": "Is the student's quantity within the allowed tolerance of the expected answer?
", "definition": "if(can_compare,\n student_quantity>=correct_quantity - wiggle \n and \n student_quantity<=correct_quantity + wiggle \n,\n false\n)"}, {"name": "wiggle", "description": "", "definition": "units(correct_quantity)*abs(eval(settings[\"wiggle\"]))"}, {"name": "valid_number", "description": "Is the scalar part of the student's answer a valid number?
", "definition": "if(isNaN(student_number),\n warn(translate(\"part.numberentry.answer invalid\"));\n fail(translate(\"part.numberentry.answer invalid\"))\n,\n true\n )\n"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The expected quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "hint", "label": "Input hint", "help_url": "", "hint": "", "input_type": "dropdown", "default_value": "remind units", "choices": [{"value": "none", "label": "None"}, {"value": "remind units", "label": "Remind to include units"}, {"value": "show units", "label": "Show required units"}]}, {"name": "allow_unitless", "label": "Allow unitless answer?", "help_url": "", "hint": "If not ticked, the student is prevented from submitting an answer without specifying units.", "input_type": "checkbox", "default_value": true}, {"name": "incompatible_units_action", "label": "What to do if incompatible units used", "help_url": "", "hint": "If the student's answer is given in units incompatible with the correct answer's units:An editable spreadsheet.
", "help_url": "", "input_widget": "spread-sheet", "input_options": {"correctAnswer": "settings[\"correct_answer\"]", "hint": {"static": true, "value": ""}, "initial_sheet": {"static": false, "value": "disable_cells(settings[\"initial_sheet\"], settings[\"disable_ranges\"])"}}, "can_be_gap": true, "can_be_step": true, "marking_script": "correctAnswer:\nsettings[\"correct_answer\"]\n\nmark:\nif(sum(mark_ranges)=0,\n incorrect(),\n apply(mark_ranges)\n)\n\ninterpreted_answer:\nstudentAnswer\n\nrange_cells:\nmap(parse_range(ref),ref,values(settings[\"mark_ranges\"]))\n\ntotal_cells:\nlen(flatten(range_cells))\n\nrange_weights:\nswitch(\n settings[\"marking_method\"]=\"per_cell\",\n map(len(r)/total_cells, r, range_cells),\n // otherwise, mark per range\n repeat(1/len(range_cells), len(range_cells))\n)\n\nmark_ranges:\nmap(\n let(\n range_credit,\n sum(map(\n let(\n correctCellString, correctAnswer[c],\n correctCellNumber, parsenumber(correctCellString, notation_styles),\n studentCellString, studentAnswer[c],\n studentCellNumber, parsenumber(studentCellString, notation_styles),\n award(\n 1/len(cells), \n if(isnan(correctCellNumber) and correctCellString<>\"\",\n lower(correctCellString) = lower(studentCellString),\n abs(studentCellNumber - if(isnan(correctCellNumber),0,correctCellNumber)) <= settings[\"tolerance\"]\n )\n )\n ),\n c,\n cells\n )),\n message,\n switch(\n range_credit=0,\n if(len(cells)=1, \"This entry is incorrect.\", \"All entries in this range are incorrect.\"),\n range_credit=1,\n if(len(cells)=1, \"This entry is correct.\", \"All entries in this range are correct.\"),\n //otherwise\n \"Some entries in this range are correct.\"\n ),\n assert(len(cells)=0, add_credit(range_credit*w, \"{name}: \"+message)); \n range_credit\n ),\n [cells,w,name],\n zip(range_cells, range_weights, keys(settings[\"mark_ranges\"]))\n)\n\nnotation_styles:\n[\"plain\",\"si-en\"]", "marking_notes": [{"name": "correctAnswer", "description": "", "definition": "settings[\"correct_answer\"]"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(sum(mark_ranges)=0,\n incorrect(),\n apply(mark_ranges)\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer"}, {"name": "range_cells", "description": "", "definition": "map(parse_range(ref),ref,values(settings[\"mark_ranges\"]))"}, {"name": "total_cells", "description": "The total number of cells to be marked.
", "definition": "len(flatten(range_cells))"}, {"name": "range_weights", "description": "", "definition": "switch(\n settings[\"marking_method\"]=\"per_cell\",\n map(len(r)/total_cells, r, range_cells),\n // otherwise, mark per range\n repeat(1/len(range_cells), len(range_cells))\n)"}, {"name": "mark_ranges", "description": "", "definition": "map(\n let(\n range_credit,\n sum(map(\n let(\n correctCellString, correctAnswer[c],\n correctCellNumber, parsenumber(correctCellString, notation_styles),\n studentCellString, studentAnswer[c],\n studentCellNumber, parsenumber(studentCellString, notation_styles),\n award(\n 1/len(cells), \n if(isnan(correctCellNumber) and correctCellString<>\"\",\n lower(correctCellString) = lower(studentCellString),\n abs(studentCellNumber - if(isnan(correctCellNumber),0,correctCellNumber)) <= settings[\"tolerance\"]\n )\n )\n ),\n c,\n cells\n )),\n message,\n switch(\n range_credit=0,\n if(len(cells)=1, \"This entry is incorrect.\", \"All entries in this range are incorrect.\"),\n range_credit=1,\n if(len(cells)=1, \"This entry is correct.\", \"All entries in this range are correct.\"),\n //otherwise\n \"Some entries in this range are correct.\"\n ),\n assert(len(cells)=0, add_credit(range_credit*w, \"{name}: \"+message)); \n range_credit\n ),\n [cells,w,name],\n zip(range_cells, range_weights, keys(settings[\"mark_ranges\"]))\n)"}, {"name": "notation_styles", "description": "", "definition": "[\"plain\",\"si-en\"]"}], "settings": [{"name": "initial_sheet", "label": "Initial sheet", "help_url": "", "hint": "Aspreadsheet
object giving the initial state of the sheet that the student should fill in.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "correct_answer", "label": "Correct answer", "help_url": "", "hint": "A spreadsheet
object representing a correct answer to the part.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "disable_ranges", "label": "Ranges to disable", "help_url": "", "hint": "A list of cell or range references, denoting the cells that should not be editable.", "input_type": "code", "default_value": "[]", "evaluate": true}, {"name": "mark_ranges", "label": "Ranges to mark", "help_url": "", "hint": "A dictionary mapping names to cell or range references, denoting the cells that should be compared for equality with the expected answer.", "input_type": "code", "default_value": "dict()", "evaluate": true}, {"name": "marking_method", "label": "Marking method", "help_url": "", "hint": "", "input_type": "dropdown", "default_value": "per_cell", "choices": [{"value": "per_cell", "label": "Each cell has the same weight"}, {"value": "per_range", "label": "Each range has the same weight"}]}, {"name": "tolerance", "label": "Allowed margin of error", "help_url": "", "hint": "", "input_type": "code", "default_value": "0", "evaluate": true}], "public_availability": "restricted", "published": false, "extensions": ["sheets"]}, {"source": {"pk": 3, "author": {"name": "Christian Lawson-Perfect", "pk": 1}, "edit_page": "/beta/part_type/3/edit"}, "name": "Yes/no", "short_name": "yes-no", "description": "The student is shown two radio choices: \"Yes\" and \"No\". One of them is correct.
", "help_url": "", "input_widget": "radios", "input_options": {"correctAnswer": "if(eval(settings[\"correct_answer_expr\"]), 0, 1)", "hint": {"static": true, "value": ""}, "choices": {"static": true, "value": ["Yes", "No"]}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(studentanswer=correct_answer,\n correct(),\n incorrect()\n)\n\ninterpreted_answer:\nstudentAnswer=0\n\ncorrect_answer:\nif(eval(settings[\"correct_answer_expr\"]),0,1)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=correct_answer,\n correct(),\n incorrect()\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer=0"}, {"name": "correct_answer", "description": "", "definition": "if(eval(settings[\"correct_answer_expr\"]),0,1)"}], "settings": [{"name": "correct_answer_expr", "label": "Is the answer \"Yes\"?", "help_url": "", "hint": "An expression which evaluates totrue
or false
.", "input_type": "mathematical_expression", "default_value": "true", "subvars": false}], "public_availability": "restricted", "published": false, "extensions": []}], "resources": []}