Class 12 Computer Science Ch 4: Boolean Algebra

Boolean operators

Boolean operators

Boolean operators are used to perform logical operations on Boolean variables.

The three basic Boolean operators are AND, OR and NOT.

3.1 AND operator

The AND operator is represented by a dot (·) or sometimes by multiplication.

Expression:

\[ Y=A\cdot B \]

The output is 1 only when both inputs are 1.

A

B

Y = A·B

0

0

0

0

1

0

1

0

0

1

1

1

Example: Two switches connected in series control a bulb. The bulb glows only when both switches are ON.

3.2 OR operator

The OR operator is represented by a plus (+).

Expression:

\[ Y=A+B \]

The output is 1 when at least one input is 1.

A

B

Y = A+B

0

0

0

0

1

1

1

0

1

1

1

1

Example: Two switches connected in parallel control a bulb. The bulb glows if either switch is ON.

3.3 NOT operator

The NOT operator is also called the complement or negation operator.

It is represented by a bar over the variable, such as \(\overline A\), or by A'.

Expression:

\[ Y=\overline A \]

It reverses the input value.

A

Y = NOT A

0

1

1

0

Example: If A = 1, then NOT A = 0.

Quick interactive practice

ONInput AOFFInput BANDOFFOutput

TRUE AND FALSE evaluates to FALSE.

Input A

FALSETRUE

Input B

FALSETRUE

Logic gate

ANDORNOT

Give feedback

4. Truth table

A truth table is a table that shows all possible input combinations and their corresponding output values for a Boolean expression or logic circuit.

For two variables A and B, the number of input combinations is:

\[ 2^2=4 \]

For three variables A, B and C:

\[ 2^3=8 \]

For four variables:

\[ 2^4=16 \]

Example: Truth table of \(Y=A+\overline B\)

First, find the complement of B. Then apply OR.

A

    B

  B̅   

Y = A + B̅

0

  0

  1

      1

0

  1

  0

      0

1   

  0    

  1

      1

1

  1

 0

      1

We use essential cookies to maintain secure sessions and prevent CSRF attacks. With your consent, we and our authorized partner (Google AdSense) also use cookies to serve relevant educational advertisements and evaluate traffic. Learn more in our Cookie Policy and Privacy Policy.