Skip to content
SPM Tuition
Boolean logic and representation practice

Integrated Boolean logic and representation practice

You want mixed questions on truth tables, conditions and bit sizes to see which skill is weak.

These eight original questions get harder as you go. Write your own table for each one before opening the answer, with every input row listed.

They cover the four skills in Boolean logic and representation. Use the timed original practice session builder to set a repeatable session length.

Questions

Question 1. Complete the truth table for P = A AND NOT B.

Answer
A B NOT B P
0 0 1 0
0 1 0 0
1 0 1 1
1 1 0 0

P is 1 only when A is on and B is off. Lesson: building a truth table from a nested Boolean expression.

Question 2. Build the truth table for Q = (A OR B) AND NOT C and say how many rows give 1.

Answer
A B C A OR B NOT C Q
0 0 0 0 1 0
0 0 1 0 0 0
0 1 0 1 1 1
0 1 1 1 0 0
1 0 0 1 1 1
1 0 1 1 0 0
1 1 0 1 1 1
1 1 1 1 0 0

Q is 1 in 3 rows: those where C is 0 and at least one of A, B is 1.

Question 3. Evaluate R = NOT A OR B when A = 1 and B = 0, showing each step.

Answer

NOT is evaluated first: NOT A = NOT 1 = 0. Then OR: 0 OR B = 0 OR 0 = 0.

A common slip is to apply NOT to the whole expression. That gives NOT (1 OR 0) = 0, which happens to agree here, but it will not agree for other values, so always follow the order.

Question 4. Is A OR (A AND B) equivalent to A? Prove it with a table.

Answer
A B A AND B A OR (A AND B) A
0 0 0 0 0
0 1 0 0 0
1 0 0 1 1
1 1 1 1 1

The last two columns match in all 4 rows, so they are equivalent.

Lesson: checking a claimed equivalence.

Question 5. A student claims NOT (A AND B) is equivalent to NOT A AND NOT B. Show whether the claim is true.

Answer

Try A = 0, B = 1. Left side: A AND B = 0, so NOT 0 = 1. Right side: NOT A = 1 and NOT B = 0, so 1 AND 0 = 0.

The results differ (1 and 0), so the claim is false. One row is enough to show this. The correct law is NOT (A AND B) = NOT A OR NOT B, which gives 1 OR 0 = 1 in this row.

Question 6. Write a condition for: “A student may enter the lab if they have a pass and either a teacher is present or it is before 5 pm.” Use P (has pass), T (teacher present) and E (before 5 pm). Test a student with a pass, no teacher, after 5 pm.

Answer

“Either a teacher is present or it is before 5 pm” is a group, and the pass applies to it. The condition is P AND (T OR E).

Test: P = 1, T = 0, E = 0. So 1 AND (0 OR 0) = 1 AND 0 = 0. The student may not enter, which matches the rule.

Lesson: turning a written requirement into a precise condition.

Question 7. Write the condition for “exactly one of the two doors is open”, using D1 and D2. Check it on the row where both are open.

Answer

Exactly one means one open and the other not: (D1 AND NOT D2) OR (NOT D1 AND D2).

Check with both open: D1 = 1, D2 = 1. First part: 1 AND 0 = 0. Second part: 0 AND 1 = 0.

So 0 OR 0 = 0, which is correct because both open is not “exactly one”. A plain D1 OR D2 would give 1 and be wrong.

Question 8. (a) How many values can 5 bits represent? (b) What is the smallest number of bits for the value 40? (c) What is the value of 00101000, and how many bits are used?

Answer

(a) 2⁵ = 32 patterns, for 0 to 31 if unsigned.

(b) 2⁵ = 32 is less than 40 and 2⁶ = 64 is greater, so 6 bits. The largest 5-bit value is 31, which is too small.

(c) The 1s are in the places worth 32 and 8, so the value is 32 + 8 = 40. The pattern uses 8 bits. Note that (b) and (c) show the same value in different sizes.

Lesson: distinguishing representation size from the value represented.

If you got these wrong

Check any table in the Boolean expression and truth-table explorer. For a teacher to go through your attempts, see online one-to-one Computer Science tuition.

Common questions

Should I draw every row of each table?

Yes. Writing every row is the method, and skipped rows are where marks are lost. Three inputs give 8 rows, which takes only a few minutes with helper columns.

How can I check my answers?

Write your own table first, then compare it with the answer. You can also test your final column in the Boolean expression and truth-table explorer. Look for the first helper column that differs from the answer.

Do I need the exact same working as the answer?

No. A correct table with clear helper columns and a stated conclusion earns the same marks as the model layout. The answers show one clear way, not the only way.

If one question type keeps going wrong, one-to-one Computer Science lessons let a teacher look at your tables and find the exact step that repeats the mistake.

  • Online one-to-one lessons for your child with an experienced teacher.
  • Your first class is a one-hour trial, from RM50. The fee is agreed before you book.
  • Happy with the teacher? Continue with lessons of about 1.5 hours. If not, ask for another teacher.