Skip to main content
ScotlandEngineering ScienceSyllabus dot point

How do logic gates combine digital inputs to make decisions, and how do you work out the output of a combinational logic circuit?

The logic gates AND, OR, NOT, NAND and NOR with their truth tables, and analysing combinational logic circuits that combine several gates.

An SQA Higher Engineering Science answer on the logic gates AND, OR, NOT, NAND and NOR with their truth tables, and how to analyse combinational logic circuits that combine several gates to make a decision.

Generated by Claude Opus 4.812 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this key area is asking
  2. The basic gates
  3. Truth tables
  4. Combinational logic
  5. Examples in context
  6. Try this

What this key area is asking

The SQA wants you to know the logic gates AND, OR, NOT, NAND and NOR, recall their truth tables, and analyse combinational logic circuits in which several gates are connected so the output depends only on the present combination of inputs. Logic gates are the digital processing of this course, making yes/no decisions from two-state inputs.

The basic gates

The three basic gates and their two inverted forms:

  • AND - output is 1 only when all inputs are 1 (think "this and that"). Output 1 in the all-high row only.
  • OR - output is 1 when any input is 1 (think "this or that"). Output 0 only in the all-low row.
  • NOT (inverter) - one input; output is the opposite of the input (1 becomes 0, 0 becomes 1).
  • NAND - Not-AND: an AND followed by a NOT. Output is 1 except when all inputs are 1.
  • NOR - Not-OR: an OR followed by a NOT. Output is 1 only when all inputs are 0.

Truth tables

For two inputs A and B there are four combinations. The table below gives all five gates (NOT acts on A alone):

A B AND OR NAND NOR NOT A
0 0 0 0 1 1 1
0 1 0 1 1 0 1
1 0 0 1 1 0 0
1 1 1 1 0 0 0

Notice the inverted columns are exactly the opposite of their base gate: NAND is the inverse of AND, and NOR is the inverse of OR. Learning AND and OR plus the rule "N means invert the output" gives you all five.

Combinational logic

You analyse a combinational circuit by working through it gate by gate: evaluate the gates nearest the inputs first, then feed their outputs into the next gates, until you reach the final output. Equivalently, write the Boolean expression for the output and substitute the input values.

flowchart LR A["A"] --> AND["AND"] B["B"] --> AND AND --> OR["OR"] C["C"] --> OR OR --> Y["output Y = (A AND B) OR C"]

Examples in context

A washing machine will only spin if the door is closed and the water has drained: that is an AND of two sensor inputs. A burglar alarm sounds if the front door or a window or the back door is opened: an OR of several inputs. A safety interlock on a machine guard often uses a NAND or combination so that the machine runs only when every guard is in place, stopping the moment any one is removed. In each case the control logic is built from a handful of gates wired as a combinational circuit, and the truth table (or Boolean expression) is the precise statement of when the output acts.

Try this

Q1. State the only input combination for which a two-input AND gate outputs 1. [1 mark]

  • Cue. Both inputs high: A = 1 and B = 1.

Q2. A two-input NOR gate has inputs A = 0 and B = 0. State its output. [1 mark]

  • Cue. Output 1 (NOR outputs 1 only when all inputs are 0).

Q3. Write the Boolean expression for an OR gate fed by C and by the output of an AND gate fed by A and B. [1 mark]

  • Cue. Output = (A AND B) OR C.

Exam-style practice questions

Practice questions written in the style of SQA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

SQA Higher (specimen)4 marksA machine should sound an alarm only when its guard is open (input A = 1) AND the motor is running (input B = 1). State which single gate is needed, give its truth table, and name the gate that gives the opposite output.
Show worked answer →

The condition "A and B both 1" is an AND gate.

Truth table for a two-input AND gate (output 1 only when both inputs are 1):
A=0, B=0 gives 0; A=0, B=1 gives 0; A=1, B=0 gives 0; A=1, B=1 gives 1.

The gate giving the opposite (inverted) output is a NAND gate: its output is 1 except when both inputs are 1, where it is 0.

Markers reward identifying the AND gate, a correct four-row truth table with the single 1 in the both-inputs-high row, and naming NAND as the inverted-output gate.

SQA Higher (specimen)4 marksA combinational logic circuit has the output of an AND gate (fed by inputs A and B) connected to one input of an OR gate, whose other input is C. Work out the output for the input combination A = 1, B = 0, C = 1, and state the condition for the final output to be 1.
Show worked answer →

Work through the circuit gate by gate.

AND gate: inputs A = 1 and B = 0, so the AND output is 0 (an AND gate needs both inputs 1).

OR gate: its inputs are the AND output (0) and C (1). An OR gate outputs 1 if either input is 1, so the final output is 1.

Condition for the final output to be 1: either C = 1, or both A = 1 and B = 1 (which makes the AND output 1). In Boolean form, output = (A AND B) OR C.

Markers reward correctly evaluating the AND stage first, feeding it into the OR stage, the final output of 1, and a correct statement of the overall condition.

Related dot points

Sources & how we know this