AS Computer Science
From Problem Statements to Logic Circuits
A rule can be written in ordinary English. We can change the rule into Boolean logic and then build a logic circuit that follows it.
By the end, I can…
- find the input conditions in a short problem;
- translate the conditions into a logic expression;
- plan a circuit using gates with one or two inputs;
- write an expression from the rows of a truth table where X = 1.
1. Read a problem carefully
A community art centre has an interactive sound station. It plays a short sound when a visitor presses START and headphones are connected. A staff member can also play the sound using a test button.
First, give one letter to each condition:
| Letter | When it is 1 | When it is 0 |
|---|---|---|
| A | Visitor presses START | START is not pressed |
| B | Headphones are connected | Headphones are not connected |
| C | Staff test button is pressed | Staff test button is not pressed |
| X | Sound plays | Sound does not play |
A common exam problem
Always check what 1 means. If a question says “B = 1 when the case is locked”, then “case not locked” must be written NOT B.
2. Change words into an expression
Part 1: normal use
Visitor presses START AND headphones are connected.
A AND B
Part 2: staff test
The staff test button is another way to play a sound.
C
Normal use OR staff test gives the full expression:
X = (A AND B) OR C
- Use AND when both conditions are needed.
- Use OR when either route can make the output 1.
- Use NOT when the rule means the opposite of a variable.
- Use brackets to keep connected conditions together.
Important: Do not choose operators from keywords alone. Read the whole rule. In normal English, “or” sometimes means exactly one; in Boolean logic, OR includes both. XOR means exactly one of two inputs is 1.
3. Plan and build the circuit
For X = (A AND B) OR C, make the first part and then join it to C.
A gate takes its inputs from the left and gives an output on the right. P is an intermediate output.
What about a negative condition?
Imagine a remote reading device. It saves a value when (A OR NOT B) AND C is true. Here, B = 1 means “a warning is active”. The device first makes NOT B, then ORs this with A, then ANDs the result with C.
Draw the gates in this order: NOT B → OR with A → AND with C.
4. Make an expression from a truth table
Sometimes the exam gives you the output values but not the expression. One reliable method is to use every row where X = 1.
Consider this original two-input table:
| A | B | X | What to write |
|---|---|---|---|
| 0 | 0 | 1 | NOT A AND NOT B |
| 0 | 1 | 0 | Not used |
| 1 | 0 | 1 | A AND NOT B |
| 1 | 1 | 0 | Not used |
Join the two selected rows with OR:
X = (NOT A AND NOT B) OR (A AND NOT B)
This expression is correct even though it can be simplified to NOT B. You do not need to simplify unless the question asks for it.
Inside one selected row
Use AND to combine all inputs. A 0 becomes NOT A, NOT B, etc.
Between selected rows
Use OR. Each selected row gives another way for X to be 1.
5. Interactive: Logic Translation Studio
Use the first activity to interpret a rule. Use the second to create an expression from truth-table rows. You will get feedback at each step.
For learning, the studio checks expressions in a fixed structured form. Other equivalent expressions may also be correct in an exam.
6. Original exam-style practice
Question A · Translate [3]
A parcel-sorting indicator turns on when a parcel is scanned and the lane is ready, or when a supervisor presses the test switch. Define A, B and C, and write an expression for X.
Show suggested answer
A = parcel scanned; B = lane ready; C = supervisor test active [1 for clear definitions]. X = (A AND B) OR C [2 for the two groups and their correct connection].
Question B · Draw [3]
Draw a circuit for X = A AND (B NOR C). Use only gates with two inputs. Describe your wires if you cannot draw here.
Show suggested answer
Connect B and C to a NOR gate [1]. Connect its result and A to an AND gate [1]. Label the final output X and connect the wires correctly [1].
Question C · Derive [4]
A three-input truth table has X = 1 only for input combinations 011 and 100. Write an expression that gives this output. How should a circuit combine the three conditions inside each row?
Show suggested answer
X = (NOT A AND B AND C) OR (A AND NOT B AND NOT C) [3: correct first term, second term and OR]. Use two two-input AND gates in series for three conditions [1].