Brackets in logic expressions

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Brackets in logic expressions

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. In (A AND B) OR C, which gate is worked out first?
A OR, because it is written last
B AND, because it is inside the brackets
2. How many gates are in the expression (A AND B) OR C?
A 2 gates: one AND and one OR
B 3 gates: one for each input letter
3. True or false: (A AND B) OR C and A AND (B OR C) always give the same output.
A True: they use the same letters and the same gates
B False: moving the brackets changes which gate is done first
4. A=0, B=0, C=1. What is the output of (A AND B) OR C?
A 1
B 0
5. A=0, B=0, C=1. What is the output of A AND (B OR C)?
A 0
B 1

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1X = (A AND B) OR C AX = NOT ((A AND B) OR C)
2X = A AND (B OR C) BB OR C is worked out first, then its result goes into AND with A
3Inner brackets are worked out first: A AND B, then OR with C, then the whole result is inverted by NOT CX = A AND (B OR C)
4Same letters with different brackets can give a different output: when A=0, B=0 and C=1 this expression gives 0 DThere are no brackets, so it is unclear which gate is worked out first. It needs brackets such as (A AND B) OR C or A AND (B OR C).
5X = A AND B OR C EA closing bracket is missing, so the brackets do not pair up. It should be X = A AND (B OR C) or X = (A AND (B OR C)).
6X = (A AND (B OR C) FA AND B is worked out first, then its result goes into OR with C

Definitions

(A AND B) OR C

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
X = (A ___ B) OR C
2.
X = A AND (B __ C)
3.
A = 1, B = 0, C = 1 (A AND B) OR C = _
4.
A = 0, B = 1, C = 1 (A AND B) OR C = 1 A AND (B OR C) = _
5.
X = (A AND B) OR C Step 1: P = A AND B Step 2: X = P OR _

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A A = 1, B = 0, C = 1
B X = (A AND B) OR C
C Inner bracket: A AND B = 1
D X = 0 OR 1 = 1
Question 2
A A = 0, B = 1, C = 1
B X = A AND (B OR C)
C Inner bracket B OR C = 0
D X = 0 AND 1 = 0
Question 3
A A = 1, B = 1, C = 0
B X = (A AND B) OR C
C A AND B = 1
D X = 1 OR 0 = 0
Question 4
A X = A AND (B OR C)
B Work out B OR C first
C Then A OR the result
Question 5
A A = 1, B = 0, C = 0
B (A OR B) AND C: A OR B = 0
C then 1 AND C = 1 AND 0 = 0

Answer Key

Brackets in logic expressions
Section A: Quick Questions
Q1
B — AND, because it is inside the brackets
Q2
A — 2 gates: one AND and one OR
Q3
B — False: moving the brackets changes which gate is done first
Q4
A — 1
Q5
A — 0
Section B: Match the Pairs
Q1
X = (A AND B) OR C → A AND B is worked out first, then its result goes into OR with C
Q2
X = A AND (B OR C) → B OR C is worked out first, then its result goes into AND with A
Q3
Inner brackets are worked out first: A AND B, then OR with C, then the whole result is inverted by NOT → X = NOT ((A AND B) OR C)
Q4
Same letters with different brackets can give a different output: when A=0, B=0 and C=1 this expression gives 0 → X = A AND (B OR C)
Q5
X = A AND B OR C → There are no brackets, so it is unclear which gate is worked out first. It needs brackets such as (A AND B) OR C or A AND (B OR C).
Q6
X = (A AND (B OR C) → A closing bracket is missing, so the brackets do not pair up. It should be X = A AND (B OR C) or X = (A AND (B OR C)).
Section C: Definitions
Q1
(A AND B) OR C — Brackets show which gate is worked out first. Here A AND B is done first, then its result goes into OR with C. A AND (B OR C) uses the same letters but gives a different output.
Section D: Fill in the Blanks
Q1
X = (A AND B) OR C
Q2
X = A AND (B OR C)
Q3
A = 1, B = 0, C = 1 (A AND B) OR C = 1
Q4
A = 0, B = 1, C = 1 (A AND B) OR C = 1 A AND (B OR C) = 0
Q5
X = (A AND B) OR C Step 1: P = A AND B Step 2: X = P OR C
Section E: Spot the Error
Q1
C — The inner bracket is worked out first. With A = 1 and B = 0, A AND B = 0, not 1, because AND needs both inputs to be 1.
Q2
C — The bracket B OR C is worked out first. With B = 1 and C = 1, OR gives 1, not 0, because OR outputs 1 when at least one input is 1.
Q3
D — The result of the bracket (1) goes into OR with C (0). 1 OR 0 = 1, because OR outputs 1 when at least one input is 1. So X = 1, not 0.
Q4
C — The expression is A AND (B OR C). After the bracket is worked out, its result goes into an AND gate with A, not an OR gate.
Q5
B — The bracket is worked out first. A OR B with A = 1 and B = 0 gives 1, not 0, because OR outputs 1 when at least one input is 1.