// 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": [{"variables": {"disp": {"templateType": "anything", "group": "Truth values", "name": "disp", "description": "", "definition": "bool_to_label(p)"}, "disq": {"templateType": "anything", "group": "Truth values", "name": "disq", "description": "", "definition": "bool_to_label(q)"}, "p": {"templateType": "anything", "group": "Truth values", "name": "p", "description": "", "definition": "[true,true,false,false]"}, "latex_symbol_list": {"templateType": "anything", "group": "Lists of symbols", "name": "latex_symbol_list", "description": "", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]"}, "ev1": {"templateType": "anything", "group": "First Bracket", "name": "ev1", "description": "", "definition": "bool_to_label(pre_ev1)"}, "pre_ev1": {"templateType": "anything", "group": "First Bracket", "name": "pre_ev1", "description": "", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)"}, "q": {"templateType": "anything", "group": "Truth values", "name": "q", "description": "", "definition": "[true,false,true,false]"}, "s": {"templateType": "anything", "group": "Lists of symbols", "name": "s", "description": "", "definition": "repeat(random(0..3),4)"}, "op": {"templateType": "anything", "group": "First Bracket", "name": "op", "description": "", "definition": "latex(random(\"\\\\lor\",\"\\\\land\",\"\\\\to\"))"}, "logic_symbol_list": {"templateType": "anything", "group": "Lists of symbols", "name": "logic_symbol_list", "description": "", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]"}, "b": {"templateType": "anything", "group": "First Bracket", "name": "b", "description": "", "definition": "latex(switch(a=\"p\",\"\\\\neg q\",a=\"q\",\"\\\\neg p\",a=\"\\\\neg p\",random(\"q\",\"\\\\neg q\"),random(\"p\",\"\\\\neg p\")))"}, "a": {"templateType": "anything", "group": "First Bracket", "name": "a", "description": "", "definition": "latex(latex_symbol_list[s[0]])"}}, "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]}$
", "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"}, "question_groups": [{"pickingStrategy": "all-ordered", "name": "", "questions": [], "pickQuestions": 0}], "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"}], "rulesets": {}, "type": "question", "name": "Luis's copy of Truth tables 0 (v2)", "preamble": {"css": "", "js": ""}, "ungrouped_variables": [], "showQuestionGroupNames": false, "functions": {"convch": {"type": "string", "definition": "switch(ch=\"\\\\neg p\",\"not p[t]\",ch=\"\\\\neg q\",\"not q[t]\",ch=\"p\",\"p[t]\",\"q[t]\")", "language": "jme", "parameters": [["ch", "string"]]}, "bool_to_label": {"type": "number", "definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "language": "jme", "parameters": [["l", "list"]]}, "evaluate": {"type": "number", "definition": "return scope.evaluate(expr);", "language": "javascript", "parameters": [["expr", "string"], ["dependencies", "list"]]}, "conv": {"type": "string", "definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "language": "jme", "parameters": [["op", "string"]]}}, "tags": [], "variablesTest": {"condition": "", "maxRuns": "150"}, "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

", "parts": [{"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]]
", "variableReplacements": [], "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "gapfill", "gaps": [{"scripts": {}, "variableReplacements": [], "answer": "{ev1[0]}", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "patternmatch", "marks": 1, "displayAnswer": "{ev1[0]}"}, {"scripts": {}, "variableReplacements": [], "answer": "{ev1[1]}", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "patternmatch", "marks": 1, "displayAnswer": "{ev1[1]}"}, {"scripts": {}, "variableReplacements": [], "answer": "{ev1[2]}", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "patternmatch", "marks": 1, "displayAnswer": "{ev1[2]}"}, {"scripts": {}, "variableReplacements": [], "answer": "{ev1[3]}", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "patternmatch", "marks": 1, "displayAnswer": "{ev1[3]}"}], "marks": 0}], "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/"}]}