Skip to content

Punjab Board Class 10 Physics · Chapter 19: Electronics

Boolean logic

Section 19.3

Boolean logic treats every input and output as 1 or 0: a closed switch or lit lamp is 1, an open switch or dark lamp is 0. Two switches in series give AND (lamp on only if both are closed); in parallel they give OR (on if either is closed). NOT flips 1 to 0. A bit is one 0 or 1; 8 bits make a byte.

Loading simulation…

Symbols match your course. Open the full circuit builder simulation for more presets and teacher tools.

A switch as a binary decision

A switch in a simple lamp circuit can only be in one of two states. Closed (ON) lets current through; open (OFF) stops it. Boolean logic gives these states numbers:

  • switch closed = 1, switch open = 0 (this is the input);
  • lamp lit = 1, lamp dark = 0 (this is the output).

With one switch, a cell and a lamp, the output simply copies the input: open switch, no current, lamp off (0); closed switch, current flows, lamp on (1).

Bits, bytes and Boolean algebra

The English mathematician George Boole worked out an algebra in which every quantity is either 0 or 1. Today it is called Boolean algebra, and it is the foundation of digital electronics and computing.

  • A single 0 or 1 is a bit (binary digit), the smallest piece of data a computer can store.
  • Eight bits make one byte, for example 01001101.

Boolean algebra is what an analogue-to-digital converter relies on when it writes measured values as binary numbers, and it is the tool engineers use to design digital systems. It has three basic operations: AND, OR and NOT. Circuits that carry out these operations are called logic gates. Their inputs and outputs are always either high (1) or low (0).

AND: switches in series

Put two switches, A and B, in series with a battery and a lamp. There is only one path for the current, and both switches lie on it. The lamp lights only when A and B are both closed. If either one is open, the path is broken.

ABLamp X
0 (open)0 (open)0 (off)
0 (open)1 (closed)0 (off)
1 (closed)0 (open)0 (off)
1 (closed)1 (closed)1 (on)

A table like this, listing every possible combination of inputs with the output for each, is called a truth table. The AND operation is written X=A⋅BX = A \cdot B and read "X equals A AND B".

OR: switches in parallel

Now put switches A and B in parallel with each other, the pair in series with the lamp. Each switch sits on its own branch, so current can reach the lamp through either one. The lamp lights if A is closed, or B is closed, or both. It stays off only when both are open.

ABLamp X
000
011
101
111

The OR operation is written X=A+BX = A + B and read "X equals A OR B". Here the plus sign is a logic symbol, not ordinary addition: 1+11 + 1 in OR logic gives 1.

NOT: the inverter

NOT has a single input and simply flips it: an input of 1 gives an output of 0, and 0 gives 1. It is written X=A‾X = \overline{A} ("X equals NOT A").

AX = NOT A
01
10

A switch circuit can copy this too (beyond the book). Connect a resistor and a lamp in series with the battery, then fit a switch across the lamp. With the switch open, current flows through the lamp and it lights. Closing the switch gives the current an easy path round the lamp, so the lamp goes out: input 1, output 0.

Worked example 1: counting combinations

How many rows does the truth table of a two-input operation need? How many for three inputs?

Each input can be 0 or 1, so every extra input doubles the number of combinations:

two inputs: 2×2=4 rowsthree inputs: 2×2×2=8 rows\text{two inputs: } 2 \times 2 = 4 \text{ rows} \qquad \text{three inputs: } 2 \times 2 \times 2 = 8 \text{ rows}

Worked example 2: three switches in series

A machine runs only when three safety switches, A, B and C, are all closed, because they are wired in series. Which of its 8 input combinations make it run?

Only one: A=1A = 1, B=1B = 1, C=1C = 1. Every other row contains at least one 0, which breaks the single path. This is AND logic with three inputs, X=A⋅B⋅CX = A \cdot B \cdot C.

Worked example 3: bits and bytes

(a) How many bits are there in 4 bytes? (b) How many different patterns can one byte hold?

(a) 4×8=324 \times 8 = 32 bits.

(b) Each of the 8 bits doubles the count, so one byte can hold 28=2562^8 = 256 different patterns (00000000 up to 11111111). This part goes beyond the book.

Boolean logic in the simulation

Use the circuit builder to test both switch models yourself.

  1. Pick Empty under Starting circuits, then place a Lamp and two Switch parts so that everything forms one loop with the battery (join the gaps with Wire).
  2. Use Select, click a switch and tick or untick Switch closed. Work through all four rows of the AND truth table and check that the lamp lights only for 1, 1.
  3. Rebuild it with the two switches on separate branches that rejoin before reaching the lamp. Now the lamp is off only when both switches are open: OR logic.
  4. For NOT, place a resistor and a lamp in the loop and a switch across the lamp's two ends. Closing that switch puts the lamp out.

Common mistakes

  • Reading A + B as ordinary addition. In OR logic 1 + 1 = 1, because the output can only be 0 or 1.
  • Swapping the switch models. Switches in series give AND; switches in parallel give OR.
  • Leaving rows out of a truth table. Two inputs need all four combinations, 00, 01, 10 and 11; three inputs need eight.
  • Writing that a byte is 10 bits or 1000 bits. One byte is exactly 8 bits.
  • Thinking an OR output is 0 when both inputs are 1. OR gives 1 when either input is 1, and that includes the case where both are.
  • Giving a NOT operation two inputs. NOT has one input and simply inverts it.

Exam practice

Exam-style questions

Original questions written in the style of Punjab board exams. Try each one before you reveal the answer.

  1. 1.A lamp circuit uses switches as inputs and the lamp as the output.

    1. (a)Explain how a single switch and lamp can represent the binary digits 1 and 0.

      2 marks
      Show the answer

      Answer: A closed switch (input 1) completes the circuit and the lamp is on (output 1). An open switch (input 0) breaks the circuit and the lamp is off (output 0).

      Marking points

      • Closed switch = 1, lamp on = 1
      • Open switch = 0, lamp off = 0
    2. (b)What is a bit, and how many bits make a byte?

      2 marks
      Show the answer

      Answer: A bit is a single binary digit, 0 or 1, the smallest unit of data. Eight bits make one byte.

      Marking points

      • Bit: one binary digit, 0 or 1
      • 8 bits = 1 byte
  2. 2.Two switches, A and B, control one lamp X.

    1. (a)Draw up the truth table when A and B are in series, and name the logic operation.

      3 marks
      Show the answer

      Answer: A B X: 0 0 0; 0 1 0; 1 0 0; 1 1 1. The lamp lights only when both are closed: this is AND, X = A·B.

      Marking points

      • All four input rows listed
      • Output 1 only for A = 1, B = 1
      • Named as AND
    2. (b)Explain why the output changes to OR when the switches are put in parallel.

      2 marks
      Show the answer

      Answer: Each switch is now on a separate branch, so current reaches the lamp if either switch (or both) is closed. The lamp goes dark just in the case where neither switch is closed.

      Marking points

      • Separate paths: either closed switch completes the circuit
      • Off only when both open
  3. 3.A security light is wired so that it is on when switch A is open and off when switch A is closed.

    1. (a)Name the logic operation and write its logic equation.

      2 marks
      Show the answer

      Answer: NOT (an inverter): X = NOT A, written with a bar over A.

      Marking points

      • NOT
      • X equals A with a bar over it (NOT A)
    2. (b)Write its truth table.

      1 mark
      Show the answer

      Answer: A = 0 gives X = 1; A = 1 gives X = 0.

      Marking points

      • 0 → 1 and 1 → 0

Quiz

Quick check

6 questions

  1. 1.In Boolean logic, a closed switch is represented by:
  2. 2.How many bits make up one byte?
  3. 3.Two switches in series with a lamp behave as which logic operation?
  4. 4.For an OR operation with inputs A = 1 and B = 1, the output is:
  5. 5.How many rows does a complete truth table need for three inputs?
  6. 6.Which three operations are the basic ones in Boolean algebra?

Related articles

Next step

Now see it move

Open the full circuit builder simulation for every preset, graphs and the teacher tools, then test yourself.

Circuit builder simulation: build any circuit you like