Try it yourself · Class 12 Physics · Semiconductor Electronics

Logic gates: pick NOT, AND, OR, NAND, NOR or XOR and toggle inputs A and B

This simulation shows a logic gate with its symbol, its Boolean expression and its truth table. A gate takes inputs that are either 0 or 1 and gives one output . You choose the gate and set the inputs, and the row of the table that matches your inputs lights up.

Every output is computed from the Boolean expression shown. The row of the truth table that matches the inputs is lit.

The simulation needs JavaScript; everything it shows is explained below.

What to change

  • Pick a gate: NOT, AND, OR, NAND, NOR or XOR. NOT has one input; the others have two.
  • Press Toggle A and Toggle B to switch each input between 0 and 1.

What to watch

  • AND gives 1 only when both inputs are 1; OR gives 1 when either input is 1.
  • NAND and NOR are AND and OR followed by NOT, so every output in their tables is flipped.
  • XOR gives 1 only when the inputs differ, which is .
  • With A and B equal, a NAND gate gives the opposite of A: joining its two inputs turns it into a NOT gate.

The formula

A dot means AND, a plus sign means OR and a bar means NOT. NAND is and NOR is .

Try these questions

Work each one out with the simulation, tap to see the answer, then try the chapter quiz.

  1. Our question

    The two inputs of a NAND gate are joined together and a single signal is applied to them. The gate then behaves as a
    1. NOT gate
    2. AND gate
    3. OR gate
    4. NOR gate
    Show the answer
    (A) NOT gate
  2. CBSE

    An X-OR gate has the following truth table:

    (A, B) = (0,0) gives 0; (0,1) gives 1; (1,0) gives 1; (1,1) gives 0.

    Logic relation:

    Build this gate using AND, OR and NOT gates.

    Show the answer
    Two NOT gates give , ; two AND gates give and ; an OR gate combines them: .
  3. JEE Main 2021

    Given below are two statements :

    Statement I : A two input OR gate and a two input AND gate have similar inputs. but outputs may be same or different.

    Statement II : An AND gate has inputs A and B. The input B is always low, the state of input A can effect the output.

    In the light of the above statements, choose the correct answer from the options given below :

    1. Both Statement I and Statement II are true.
    2. Both Statement I and Statement II are false.
    3. Statement I is true but Statement II is false.
    4. Statement I is false but Statement II is true.
    Show the answer
    (C) Statement I is true but Statement II is false.

More to try in Semiconductor Electronics

Intrinsic carriers: choose silicon or germanium and change the temperatureThis simulation draws the energy bands of a pure (intrinsic) semiconductor: the valence band below, the conduction band above and the forbidden gap between them.Energy bands: bring silicon atoms together and watch the levels splitAn isolated silicon atom has sharp energy levels: 3s holds 2 electrons and 3p holds 6.Why silicon's bands hold 4N states each: sp3 hybrids, bonds and bandsWhy does silicon’s valence band hold exactly states, and why do its electrons fill it to the brim?Rectifier: switch half-wave or full-wave, change the knee voltage and the peak inputThis simulation shows what a p-n junction diode does to an alternating voltage at 50 Hz.Zener regulator: change the input voltage, the series resistor and the loadThis simulation shows a Zener diode used as a voltage regulator.LED: pick a colour and change the forward voltageThis simulation shows a light emitting diode (LED).Transistor in CE: change the base current, β, R_C and the supplyThis simulation shows the output characteristics of an npn transistor in the common-emitter (CE) configuration: the collector current against the collector-emitter voltage for base currents from 10 μA to 60 μA.Hole conduction: apply an electric field and watch the hole driftA hole is not a particle.Diode I-V curve: pick silicon or germanium and change the voltageThis simulation shows what the applied voltage does to the potential barrier of a p-n junction and to the current through it.Capacitor filter: change C, the load resistance and half or full waveA rectifier alone gives pulses that fall to zero.CE amplifier: change the signal, the bias current and the collector resistorThis simulation follows a small signal through an npn transistor in the common-emitter amplifier.Solar cell: change the light intensity and the load resistanceA solar cell is a p-n junction that makes a current when light frees electron-hole pairs.

Every simulation in the Lab