# Standard Logic Gates (NOT, AND, OR, NAND, NOR, XOR)

- **Track:** Cambridge IGCSE™ Computer Science (0478 / 0984) (CAMBRIDGE IGCSE 0478)
- **Module:** Section 10: Boolean Logic & Gate Circuits
- **Estimated Duration:** 10 minutes
- **Access:** Open Theory (All-Access for Interactive IDE &amp; Autotests)

---

## Theory & Conceptual Background

Logic gates operate on Boolean inputs: 0 is false and 1 is true. Learn both each gate's behaviour and its drawn symbol. Inputs enter on the left; the output leaves on the right. A small circle indicates inversion (NOT).

![Standard AND, OR, NOT, NAND, NOR and XOR symbols with inputs on the left and outputs on the right](/curriculum/igcse/logic-gates.svg)

  
| Gate | When its output is 1 |
| --- | --- |
| AND | Both inputs are 1 |
| OR | At least one input is 1 |
| NOT | Its single input is 0 |
| NAND | Not both inputs are 1 |
| NOR | Both inputs are 0 |
| XOR | Exactly one input is 1 |

## Worked comparison

For A=1 and B=1, AND and OR output 1, while XOR outputs 0. XOR is not simply another drawing of OR. NOT has one input; the other gates here have two.

## Drawing practice

On paper draw each gate without looking, label its inputs/output, then compare with the symbol sheet. Check the curved AND/OR shapes, the extra input curve for XOR, and the inversion circles for NOT/NAND/NOR. State each gate's output for 0,0 and 1,1 before submitting the structured checks.

---

## Interactive Exercises & Autotest Specifications

### Exercise 1: Exam-Style Check: Operational Behavior of the XOR Gate (Multiple choice, 25 XP)

**Instructions:**
Which of the following describes the exact operating condition under which a 2-input XOR (Exclusive-OR) logic gate outputs a binary `1`?

**Options:**
- **A**: The output is 1 when the two inputs are different from each other (one is 1 and the other is 0).
- **B**: The output is 1 only when both inputs are simultaneously 1.
- **C**: The output is 1 when at least one input is 1, including when both inputs are 1.
- **D**: The output is 1 only when both inputs are 0.


**Autotest Expectations:**
- **XOR operational behavior correctly identified**: `selection_match` -> Expected: `opt_xor_different`

### Exercise 2: Exam-Style Question: Determine Logic Gate Outputs (Fill in blank, 35 XP)

**Instructions:**
Given two inputs A = 1 and B = 0, determine the binary output (0 or 1) for each logic gate:

1. Output of an AND gate (1 AND 0): [blank_1]
2. Output of an OR gate (1 OR 0): [blank_2]
3. Output of an XOR gate (1 XOR 0): [blank_3]
4. Output of a NAND gate (NOT (1 AND 0)): [blank_4]


**Starter Code:**
```text
{"prompt":"Determine the binary output (0 or 1) for inputs A = 1 and B = 0:","template":"1. AND gate: [blank_1]\n2. OR gate: [blank_2]\n3. XOR gate: [blank_3]\n4. NAND gate: [blank_4]","word_bank":["0","1"],"blanks":[{"id":"blank_1"},{"id":"blank_2"},{"id":"blank_3"},{"id":"blank_4"}]}
```

**Autotest Expectations:**
- **AND output for 1 and 0 is 0**: `text_exact` -> Expected: `0`
- **OR output for 1 and 0 is 1**: `text_exact` -> Expected: `1`
- **XOR output for 1 and 0 is 1**: `text_exact` -> Expected: `1`
- **NAND output for 1 and 0 is 1**: `text_exact` -> Expected: `1`

### Exercise 3: Application: Gate behaviour (Fill in blank, 30 XP)

**Instructions:**
Work out each answer before submitting. For inputs 1 and 1, XOR output: For inputs 0 and 0, NOR output: For inputs 1 and 0, NAND output:


**Starter Code:**
```text
{"prompt":"Application: Gate behaviour","template":"1. For inputs 1 and 1, XOR output: [blank_1]\n2. For inputs 0 and 0, NOR output: [blank_2]\n3. For inputs 1 and 0, NAND output: [blank_3]","blanks":[{"id":"blank_1"},{"id":"blank_2"},{"id":"blank_3"}],"word_bank":["0","1"]}
```


