Chapter 2 · Computational Thinking & Algorithms
2.5Truth Tables
A truth table lists every true/false combination and the result for each, so you can see exactly how an expression behaves.
Written and checked by Muhammad Raheel(opens in a new tab)
Full Stack Developer · AI Engineer · Reviewed 21 Oct 2026 · 2 min read
On this page
In topic 2.4 you learned AND, OR and NOT. A truth table puts them to work. It is a small grid that shows every possible case, so nothing is left to guesswork.
A truth table lists every possible mix of true and false for the inputs. Then it shows the final result for each mix. This makes it a good tool for checking whether a logical expression is correct. Here is the book's Figure 2.5, "Truth Table for Logical Expressions":
| A | B | A AND B | A OR B | NOT A |
|---|---|---|---|---|
| True | True | True | True | False |
| True | False | False | True | False |
| False | True | False | True | True |
| False | False | False | False | True |
Read each result column with the rules from 2.4. A AND B is True only in the first row, where both are True. A OR B is False only in the last row, where both are False. NOT A is always the opposite of A.
Purpose of Truth Tables
A truth table tells you exactly when a statement is true and when it is false. Because it lists all input values, it clears up confusion. It lets you check long expressions without mistakes, and compare two statements side by side. This also helps in decision-making.
Creating Truth Tables for Logical Expressions
The book gives a clear order of steps:
- Identify the propositions.
- Give each proposition a truth value of true or false.
- List all possible combinations of truth values.
- Apply the logical connectives step by step.
- Write the final result for each row.
Keep the table neat and organized. Then it is easy to follow.
Truth Values of Propositions
A truth value is simply True (T) or False (F). Each proposition P or Q takes one of these two values.
How many rows does a table need? The book's rule is 2ⁿ rows for n propositions. With one proposition you need 2 rows. With two you need 4, like Figure 2.5. With three you need 8.
The value of a compound proposition depends only on the values of its parts. Change one part, and the result may change.
Practice this topic
Short questions
1.What are truth values?2 marks
Answer
A truth value is the value True or False that a proposition takes. From the book: "Each proposition P or Q can take the value True (T) or False (F)." "Truth value of a compound proposition is determined by the values of its components."
2.What is a truth table?2 marks
Answer
From the book: "Truth tables are used in logic to show the truth values of statements." "A truth table lists all possible combinations of truth values. It shows the final result for each combination." The chapter Summary (page 30) says: "A truth table is a table used to show the truth values of a logical expression for all possible combinations of its inputs."
3.What is the main purpose of truth tables?2 marks
Answer
From the book: "The main purpose of truth tables is to show how a logical expression behaves. They help us find when a statement is true or false. Truth tables list all possible input values. They help remove confusion in logical reasoning."
4.Write the steps for creating a truth table for a logical expression.3 marks
Answer
From the book: "Creating a truth table starts with identifying the propositions. Each proposition is given a truth value of true or false. All possible combinations of truth values are listed. Logical connectives are applied step by step. The final result is written for each row."
5.How many rows are needed in a truth table for n propositions? How many rows for two propositions?2 marks
Answer
From the book: "Truth tables enumerate all possible combinations (2ⁿ rows for n propositions)." For two propositions, 2² = 4 rows, as in Figure 2.5.
6.Make the truth table for A AND B.3 marks
Answer
From Figure 2.5: Truth Table for Logical Expressions (A AND B is True only when both A and B are True):
A B A AND B True True True True False False False True False False False False 7.How is the truth value of a compound proposition found?2 marks
Answer
From the book: "Truth value of a compound proposition is determined by the values of its components." In a truth table, "Logical connectives are applied step by step. The final result is written for each row."
Long questions
1.What are truth tables? Explain how truth tables are created and used to evaluate logical expressions.8 marks
Answer
Cover the whole topic, using the book's text:
- What they are (verbatim): "Truth tables are used in logic to show the truth values of statements. They help us understand how logical expressions work. A truth table lists all possible combinations of truth values. It shows the final result for each combination."
- How they are created (Creating Truth Tables for Logical Expressions): "Creating a truth table starts with identifying the propositions. Each proposition is given a truth value of true or false. All possible combinations of truth values are listed. Logical connectives are applied step by step. The final result is written for each row." "Truth tables must be neat and organized."
- Truth Values of Propositions: "Each proposition P or Q can take the value True (T) or False (F). Truth tables enumerate all possible combinations (2ⁿ rows for n propositions). Truth value of a compound proposition is determined by the values of its components."
- How they are used (Purpose of Truth Tables): "to show how a logical expression behaves", "find when a statement is true or false", "remove confusion in logical reasoning", "check complex expressions easily", "compare different logical statements", "useful in decision-making"; also "checking the correctness of logical expressions".
- Draw Figure 2.5: Truth Table for Logical Expressions, with the columns A, B, A AND B, A OR B, NOT A (4 rows, because 2² = 4).
Aim for 200-300 words plus the table.
2.Draw the truth table for A AND B, A OR B and NOT A. Explain how many rows it needs and how each column is filled.6 marks
Answer
Draw Figure 2.5: Truth Table for Logical Expressions exactly:
A B A AND B A OR B NOT A True True True True False True False False True False False True False True True False False False False True Then explain, using the book's text:
- Rows: "Truth tables enumerate all possible combinations (2ⁿ rows for n propositions)." Two propositions A and B give 2² = 4 rows.
- Steps: identify the propositions (A and B), give each "a truth value of true or false", list "All possible combinations", apply the "Logical connectives ... step by step", and write "The final result ... for each row."
- AND column: "AND is used when both statements must be true" (topic 2.4), so only row 1 is True.
- OR column: "OR is used when at least one statement is true", so only the last row is False.
- NOT A column: "NOT is used to reverse the truth of a statement", so NOT A is the opposite of A in every row.
Aim for 150-200 words plus the table.
In this chapter
- 2.1Introduction to Computational Thinking
- 2.2Problem Solving Using Computational Thinking
- 2.3Logic as a Knowledge Representation Framework
- 2.4Propositional Logic
- 2.5Truth TablesYou are here
- 2.6Propositional Equivalence
- 2.7Propositional Satisfiability
- 2.8Predicate Logic
- 2.9Quantifiers in Predicate Logic
- 2.10Applying Predicate Logic to Real-World Problems
- 2.11Logic-Based Reasoning and Inference