// Numbas version: finer_feedback_settings {"name": "Truth tables", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [{"variables": ["logic_symbol_list", "latex_symbol_list", "s"], "name": "Lists of symbols"}, {"variables": ["a", "b", "op", "pre_ev1", "ev1"], "name": "First Bracket"}, {"variables": [], "name": "Second Bracket"}, {"variables": ["q", "p", "disp", "disq"], "name": "Truth values"}], "preamble": {"js": "", "css": ""}, "ungrouped_variables": [], "functions": {"convch": {"language": "jme", "parameters": [["ch", "string"]], "definition": "switch(ch=\"\\\\neg p\",\"not p[t]\",ch=\"\\\\neg q\",\"not q[t]\",ch=\"p\",\"p[t]\",\"q[t]\")", "type": "string"}, "conv": {"language": "jme", "parameters": [["op", "string"]], "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "type": "string"}, "evaluate": {"language": "javascript", "parameters": [["expr", "string"], ["dependencies", "list"]], "definition": "return scope.evaluate(expr);", "type": "number"}, "bool_to_label": {"language": "jme", "parameters": [["l", "list"]], "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "type": "number"}}, "extensions": [], "variablesTest": {"condition": "", "maxRuns": "150"}, "metadata": {"description": "

Create a truth table for a logical expression of the form $a \\operatorname{op} b$ where $a, \\;b$ can be the Boolean variables $p,\\;q,\\;\\neg p,\\;\\neg q$ and $\\operatorname{op}$ one of $\\lor,\\;\\land,\\;\\to$.

\n

For example $\\neg q \\to \\neg p$.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

In the following question you are asked to construct a truth table for:

\n

\\[\\var{a} \\var{op} \\var{b}.\\]

\n

\n

Enter T if true, else enter F.

\n

\n

\n

\n

\n

\n

\n

\n

\n

\n

\n

", "variables": {"pre_ev1": {"templateType": "anything", "description": "", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "group": "First Bracket", "name": "pre_ev1"}, "latex_symbol_list": {"templateType": "anything", "description": "", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "group": "Lists of symbols", "name": "latex_symbol_list"}, "b": {"templateType": "anything", "description": "", "definition": "latex(switch(a=\"p\",\"\\\\neg q\",a=\"q\",\"\\\\neg p\",a=\"\\\\neg p\",random(\"q\",\"\\\\neg q\"),random(\"p\",\"\\\\neg p\")))", "group": "First Bracket", "name": "b"}, "op": {"templateType": "anything", "description": "", "definition": "latex(random(\"\\\\lor\",\"\\\\land\"))", "group": "First Bracket", "name": "op"}, "disp": {"templateType": "anything", "description": "", "definition": "bool_to_label(p)", "group": "Truth values", "name": "disp"}, "logic_symbol_list": {"templateType": "anything", "description": "", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "group": "Lists of symbols", "name": "logic_symbol_list"}, "ev1": {"templateType": "anything", "description": "", "definition": "bool_to_label(pre_ev1)", "group": "First Bracket", "name": "ev1"}, "a": {"templateType": "anything", "description": "", "definition": "latex(latex_symbol_list[s[0]])", "group": "First Bracket", "name": "a"}, "s": {"templateType": "anything", "description": "", "definition": "repeat(random(0..3),4)", "group": "Lists of symbols", "name": "s"}, "q": {"templateType": "anything", "description": "", "definition": "[true,false,true,false]", "group": "Truth values", "name": "q"}, "p": {"templateType": "anything", "description": "", "definition": "[true,true,false,false]", "group": "Truth values", "name": "p"}, "disq": {"templateType": "anything", "description": "", "definition": "bool_to_label(q)", "group": "Truth values", "name": "disq"}}, "tags": [], "parts": [{"customName": "", "customMarkingAlgorithm": "", "sortAnswers": false, "scripts": {}, "prompt": "

Complete the following truth table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a} \\var{op} \\var{b}$
$\\var{disp[0]}$$\\var{disq[0]}$[[0]]
$\\var{disp[1]}$$\\var{disq[1]}$[[1]]
$\\var{disp[2]}$$\\var{disq[2]}$[[2]]
$\\var{disp[3]}$$\\var{disq[3]}$[[3]]
", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "gapfill", "showFeedbackIcon": true, "marks": 0, "unitTests": [], "useCustomName": false, "gaps": [{"customName": "", "customMarkingAlgorithm": "", "scripts": {}, "answer": "{ev1[0]}", "matchMode": "regex", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "patternmatch", "showFeedbackIcon": true, "marks": 1, "unitTests": [], "displayAnswer": "{ev1[0]}", "useCustomName": false, "variableReplacements": []}, {"customName": "", "customMarkingAlgorithm": "", "scripts": {}, "answer": "{ev1[1]}", "matchMode": "regex", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "patternmatch", "showFeedbackIcon": true, "marks": 1, "unitTests": [], "displayAnswer": "{ev1[1]}", "useCustomName": false, "variableReplacements": []}, {"customName": "", "customMarkingAlgorithm": "", "scripts": {}, "answer": "{ev1[2]}", "matchMode": "regex", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "patternmatch", "showFeedbackIcon": true, "marks": 1, "unitTests": [], "displayAnswer": "{ev1[2]}", "useCustomName": false, "variableReplacements": []}, {"customName": "", "customMarkingAlgorithm": "", "scripts": {}, "answer": "{ev1[3]}", "matchMode": "regex", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "patternmatch", "showFeedbackIcon": true, "marks": 1, "unitTests": [], "displayAnswer": "{ev1[3]}", "useCustomName": false, "variableReplacements": []}], "variableReplacements": []}], "rulesets": {}, "advice": "

Here is the truth table.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$p$$q$$\\var{a} \\var{op} \\var{b}$
$\\var{disp[0]}$$\\var{disq[0]}$$\\var{ev1[0]}$
$\\var{disp[1]}$$\\var{disq[1]}$$\\var{ev1[1]}$
$\\var{disp[2]}$$\\var{disq[2]}$$\\var{ev1[2]}$
$\\var{disp[3]}$$\\var{disq[3]}$$\\var{ev1[3]}$
", "name": "Truth tables", "type": "question", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Jordan Childs", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3480/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Jordan Childs", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3480/"}]}