View as PDF

COMPUTING AND DIGITAL LITERACY

Logic Gates

Difficulty level: Intermediate

Computing and Digital Literacy

This document was made by AI and there may be mistakes. If a question or answer looks wrong, use the Flag a mistake button to let Brett know so he can fix it.

Overview of the concept

This is how a computer makes yes or no decisions from tiny on and off signals, like a lock that opens only when you enter the right code and press enter. A logic gate takes one or two signals and gives back a yes or no, and millions of them together are what make a computer think. You meet them in a combination lock, a light that turns on only when two switches are both on, or a security system that needs a code and a fingerprint before it opens.

Rule

Logic gates: an AND gate gives 1 only when both inputs are 1. An OR gate gives 1 when at least one input is 1. A NOT gate has one input and flips it: 1 becomes 0, and 0 becomes 1.

A truth table lists every input combination. Read the row that matches your inputs to find the output.

Worked examples

Example 1

An AND gate and an OR gate both get the inputs 1 and 0. What does each output?

Diagram for Worked example 1: AND and OR gates

Solution

This is a read-the-gate question, and the one rule to remember is: AND gives 1 only when both inputs are 1; OR gives 1 when at least one input is 1.

For the AND gate, the inputs are 1 and 0. They are not both 1, so the AND gate outputs 0.

For the OR gate, at least one input is 1, so the OR gate outputs 1.

Example 2

What does a NOT gate output for input 1, and what does an AND gate output for inputs A = 1, B = 0?

NOT

Solution

A NOT gate takes a single input and turns it over: 1 becomes 0, so NOT 1 is 0.

For the AND gate, look up the truth table row with A = 1 and B = 0. AND needs both inputs to be 1, and B is 0.

A B A AND B 0 0 0 0 1 0 1 0 0 1 1 1

The AND gate outputs 0.

Practice questions

1

What does an AND gate output for inputs 1 and 1?

2

An AND gate gets inputs 1 and 1. Its output goes into a NOT gate. What is the final output?

3

What does an OR gate output for inputs 0 and 0?

4

An OR gate outputs 0. What were its inputs?

5

A NOT gate gets input 1. Its output goes into a second NOT gate. What is the final output?

6

What does a NOT gate output for input 0?

7

A NAND gate outputs 0 only when both inputs are 1. What does it output for inputs 1 and 0?

8

An XOR gate outputs 1 when the inputs are different. What does it output for inputs 1 and 1?

9

How many rows does a two-input truth table have?

10

A light needs switch A AND switch B both on. A is on, B is off. Is the light on?

ANSWER KEY

1. 1

2. 0

3. 0

4. 0 and 0

5. 1

6. 1

7. 1

8. 0

9. 4

10. No