// Numbas version: exam_results_page_options {"name": "Julie'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": [{"rulesets": {}, "preamble": {"css": "", "js": ""}, "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"}, "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"]}], "extensions": [], "ungrouped_variables": [], "name": "Julie's copy of Truth tables 0 (v2)", "variables": {"disp": {"description": "", "definition": "bool_to_label(p)", "name": "disp", "templateType": "anything", "group": "Truth values"}, "p": {"description": "", "definition": "[true,true,false,false]", "name": "p", "templateType": "anything", "group": "Truth values"}, "q": {"description": "", "definition": "[true,false,true,false]", "name": "q", "templateType": "anything", "group": "Truth values"}, "latex_symbol_list": {"description": "", "definition": "[\"p\",\"q\",\"\\\\neg p\",\"\\\\neg q\"]", "name": "latex_symbol_list", "templateType": "anything", "group": "Lists of symbols"}, "b": {"description": "", "definition": "latex(switch(a=\"p\",\"\\\\neg q\",a=\"q\",\"\\\\neg p\",a=\"\\\\neg p\",random(\"q\",\"\\\\neg q\"),random(\"p\",\"\\\\neg p\")))", "name": "b", "templateType": "anything", "group": "First Bracket"}, "pre_ev1": {"description": "", "definition": "map(evaluate(convch(a)+\" \"+conv(op)+\" \"+convch(b),[p[t],q[t]]),t,0..3)", "name": "pre_ev1", "templateType": "anything", "group": "First Bracket"}, "disq": {"description": "", "definition": "bool_to_label(q)", "name": "disq", "templateType": "anything", "group": "Truth values"}, "ev1": {"description": "", "definition": "bool_to_label(pre_ev1)", "name": "ev1", "templateType": "anything", "group": "First Bracket"}, "s": {"description": "", "definition": "repeat(random(0..3),4)", "name": "s", "templateType": "anything", "group": "Lists of symbols"}, "op": {"description": "", "definition": "latex(random(\"\\\\lor\",\"\\\\land\"))", "name": "op", "templateType": "anything", "group": "First Bracket"}, "logic_symbol_list": {"description": "", "definition": "[\"p\",\"q\",\"not p\",\"not q\"]", "name": "logic_symbol_list", "templateType": "anything", "group": "Lists of symbols"}, "a": {"description": "", "definition": "latex(latex_symbol_list[s[0]])", "name": "a", "templateType": "anything", "group": "First Bracket"}}, "parts": [{"showCorrectAnswer": true, "scripts": {}, "gaps": [{"showCorrectAnswer": true, "scripts": {}, "matchMode": "regex", "showFeedbackIcon": true, "displayAnswer": "{ev1[0]}", "answer": "{ev1[0]}", "marks": 1, "variableReplacements": [], "type": "patternmatch", "variableReplacementStrategy": "originalfirst"}, {"showCorrectAnswer": true, "scripts": {}, "matchMode": "regex", "showFeedbackIcon": true, "displayAnswer": "{ev1[1]}", "answer": "{ev1[1]}", "marks": 1, "variableReplacements": [], "type": "patternmatch", "variableReplacementStrategy": "originalfirst"}, {"showCorrectAnswer": true, "scripts": {}, "matchMode": "regex", "showFeedbackIcon": true, "displayAnswer": "{ev1[2]}", "answer": "{ev1[2]}", "marks": 1, "variableReplacements": [], "type": "patternmatch", "variableReplacementStrategy": "originalfirst"}, {"showCorrectAnswer": true, "scripts": {}, "matchMode": "regex", "showFeedbackIcon": true, "displayAnswer": "{ev1[3]}", "answer": "{ev1[3]}", "marks": 1, "variableReplacements": [], "type": "patternmatch", "variableReplacementStrategy": "originalfirst"}], "showFeedbackIcon": true, "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]]
", "marks": 0, "variableReplacements": [], "type": "gapfill", "variableReplacementStrategy": "originalfirst"}], "tags": [], "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]}$
", "functions": {"convch": {"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"]], "type": "string"}, "conv": {"definition": "switch(op=\"\\\\land\",\"and\",op=\"\\\\lor\",\"or\",\"implies\")", "language": "jme", "parameters": [["op", "string"]], "type": "string"}, "bool_to_label": {"definition": "map(if(l[x],'T','F'),x,0..length(l)-1)", "language": "jme", "parameters": [["l", "list"]], "type": "number"}, "evaluate": {"definition": "return scope.evaluate(expr);", "language": "javascript", "parameters": [["expr", "string"], ["dependencies", "list"]], "type": "number"}}, "variablesTest": {"maxRuns": "150", "condition": ""}, "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", "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}]}]}], "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}]}