// Numbas version: finer_feedback_settings {"name": "Daniel's copy of Truth tables 0 (v2)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"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

", "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]}$
", "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": {"css": "", "js": ""}, "variablesTest": {"maxRuns": "150", "condition": ""}, "ungrouped_variables": [], "name": "Daniel's copy of Truth tables 0 (v2)", "extensions": [], "tags": [], "variables": {"q": {"definition": "[true,false,true,false]", "templateType": "anything", "group": "Truth values", "description": "", "name": "q"}, "logic_symbol_list": {"definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "templateType": "anything", "group": "Lists of symbols", "description": "", "name": "logic_symbol_list"}, "latex_symbol_list": {"definition": "[\"p\",\"q\",\"\\{\\\\sim \\}p\",\"\\{\\\\sim \\}q\"]", "templateType": "anything", "group": "Lists of symbols", "description": "", "name": "latex_symbol_list"}, "s": {"definition": "repeat(random(0..3),4)", "templateType": "anything", "group": "Lists of symbols", "description": "", "name": "s"}, "op": {"definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "templateType": "anything", "group": "First Bracket", "description": "", "name": "op"}, "ev1": {"definition": "bool_to_label(pre_ev1)", "templateType": "anything", "group": "First Bracket", "description": "", "name": "ev1"}, "disq": {"definition": "bool_to_label(q)", "templateType": "anything", "group": "Truth values", "description": "", "name": "disq"}, "pre_ev1": {"definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "templateType": "anything", "group": "First Bracket", "description": "", "name": "pre_ev1"}, "p": {"definition": "[true,true,false,false]", "templateType": "anything", "group": "Truth values", "description": "", "name": "p"}, "disp": {"definition": "bool_to_label(p)", "templateType": "anything", "group": "Truth values", "description": "", "name": "disp"}, "a": {"definition": "latex(latex_symbol_list[s[0]])", "templateType": "anything", "group": "First Bracket", "description": "", "name": "a"}, "b": {"definition": "latex(switch(a=\"p\",\"\\{\\\\sim \\}q\",a=\"q\",\"\\{\\\\sim \\}p\",a=\"\\{\\\\sim \\}p\",random(\"q\",\"\\{\\\\sim \\}q\"),random(\"p\",\"\\{\\\\sim \\}p\")))", "templateType": "anything", "group": "First Bracket", "description": "", "name": "b"}}, "functions": {"convch": {"parameters": [["ch", "string"]], "definition": "switch(ch=\"\\{\\\\sim \\}p\",\"not p[t]\",ch=\"\\{\\\\sim \\}q\",\"not q[t]\",ch=\"p\",\"p[t]\",\"q[t]\")", "type": "string", "language": "jme"}, "conv": {"parameters": [["op", "string"]], "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "type": "string", "language": "jme"}, "evaluate": {"parameters": [["expr", "string"], ["dependencies", "list"]], "definition": "return scope.evaluate(expr);", "type": "number", "language": "javascript"}, "bool_to_label": {"parameters": [["l", "list"]], "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "type": "number", "language": "jme"}}, "parts": [{"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]]
", "variableReplacements": [], "showCorrectAnswer": true, "type": "gapfill", "marks": 0, "gaps": [{"displayAnswer": "{ev1[0]}", "variableReplacements": [], "showCorrectAnswer": true, "type": "patternmatch", "marks": 1, "matchMode": "regex", "scripts": {}, "answer": "{ev1[0]}", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true}, {"displayAnswer": "{ev1[1]}", "variableReplacements": [], "showCorrectAnswer": true, "type": "patternmatch", "marks": 1, "matchMode": "regex", "scripts": {}, "answer": "{ev1[1]}", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true}, {"displayAnswer": "{ev1[2]}", "variableReplacements": [], "showCorrectAnswer": true, "type": "patternmatch", "marks": 1, "matchMode": "regex", "scripts": {}, "answer": "{ev1[2]}", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true}, {"displayAnswer": "{ev1[3]}", "variableReplacements": [], "showCorrectAnswer": true, "type": "patternmatch", "marks": 1, "matchMode": "regex", "scripts": {}, "answer": "{ev1[3]}", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true}], "scripts": {}, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true}], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "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$.

"}, "type": "question", "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}]}]}], "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}]}