// Numbas version: finer_feedback_settings {"name": "Luis'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": [{"showQuestionGroupNames": false, "variablesTest": {"maxRuns": "150", "condition": ""}, "tags": [], "metadata": {"notes": "", "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"}, "parts": [{"variableReplacements": [], "gaps": [{"variableReplacements": [], "answer": "{ev1[0]}", "marks": 1, "type": "patternmatch", "showCorrectAnswer": true, "scripts": {}, "displayAnswer": "{ev1[0]}", "variableReplacementStrategy": "originalfirst"}, {"variableReplacements": [], "answer": "{ev1[1]}", "marks": 1, "type": "patternmatch", "showCorrectAnswer": true, "scripts": {}, "displayAnswer": "{ev1[1]}", "variableReplacementStrategy": "originalfirst"}, {"variableReplacements": [], "answer": "{ev1[2]}", "marks": 1, "type": "patternmatch", "showCorrectAnswer": true, "scripts": {}, "displayAnswer": "{ev1[2]}", "variableReplacementStrategy": "originalfirst"}, {"variableReplacements": [], "answer": "{ev1[3]}", "marks": 1, "type": "patternmatch", "showCorrectAnswer": true, "scripts": {}, "displayAnswer": "{ev1[3]}", "variableReplacementStrategy": "originalfirst"}], "marks": 0, "type": "gapfill", "showCorrectAnswer": true, "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]]
", "variableReplacementStrategy": "originalfirst"}], "variables": {"b": {"name": "b", "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", "description": "", "templateType": "anything"}, "logic_symbol_list": {"name": "logic_symbol_list", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "group": "Lists of symbols", "description": "", "templateType": "anything"}, "pre_ev1": {"name": "pre_ev1", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "group": "First Bracket", "description": "", "templateType": "anything"}, "q": {"name": "q", "definition": "[true,false,true,false]", "group": "Truth values", "description": "", "templateType": "anything"}, "p": {"name": "p", "definition": "[true,true,false,false]", "group": "Truth values", "description": "", "templateType": "anything"}, "ev1": {"name": "ev1", "definition": "bool_to_label(pre_ev1)", "group": "First Bracket", "description": "", "templateType": "anything"}, "disq": {"name": "disq", "definition": "bool_to_label(q)", "group": "Truth values", "description": "", "templateType": "anything"}, "disp": {"name": "disp", "definition": "bool_to_label(p)", "group": "Truth values", "description": "", "templateType": "anything"}, "s": {"name": "s", "definition": "repeat(random(0..3),4)", "group": "Lists of symbols", "description": "", "templateType": "anything"}, "a": {"name": "a", "definition": "latex(latex_symbol_list[s[0]])", "group": "First Bracket", "description": "", "templateType": "anything"}, "latex_symbol_list": {"name": "latex_symbol_list", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "group": "Lists of symbols", "description": "", "templateType": "anything"}, "op": {"name": "op", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))", "group": "First Bracket", "description": "", "templateType": "anything"}}, "preamble": {"js": "", "css": ""}, "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": "Luis's copy of Truth tables 0 (v2)", "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

", "type": "question", "ungrouped_variables": [], "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "functions": {"evaluate": {"language": "javascript", "definition": "return scope.evaluate(expr);", "parameters": [["expr", "string"], ["dependencies", "list"]], "type": "number"}, "conv": {"language": "jme", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "parameters": [["op", "string"]], "type": "string"}, "convch": {"language": "jme", "definition": "switch(ch=\"\\\\neg p\",\"not p[t]\",ch=\"\\\\neg q\",\"not q[t]\",ch=\"p\",\"p[t]\",\"q[t]\")", "parameters": [["ch", "string"]], "type": "string"}, "bool_to_label": {"language": "jme", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "parameters": [["l", "list"]], "type": "number"}}, "rulesets": {}, "variable_groups": [{"name": "Lists of symbols", "variables": ["logic_symbol_list", "latex_symbol_list", "s"]}, {"name": "First Bracket", "variables": ["a", "b", "op", "pre_ev1", "ev1"]}, {"name": "Second Bracket", "variables": []}, {"name": "Truth values", "variables": ["q", "p", "disp", "disq"]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Luis Hernandez", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2870/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Luis Hernandez", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2870/"}]}