Page 71 - Computer Science Class 11 Without Functions
P. 71

A                 B                     A ● B
                                       0                 0                       0

                                       0                 1                       0
                                       1                 0                       0
                                       1                 1                       1
                                          Table 3.1: AND operator using operand values 0 and 1
            If we use true and false in place of 1 and 0, the above table would appear as shown in Table 3.2.


                                       A                 B                     A ● B
                                     false             false                   false
                                     false             true                    false
                                      true             false                   false

                                      true             true                    true
                                         Table 3.2: AND operator using operands true and false
            A table that describes the result of applying an operator (such as AND) on each combination of values of the variables
            is called truth table (see Table 3.1 and Table 3.2). The electric circuit shown in Fig 3.1 may be used to implement the
            AND operator.






                                          Voltage  ∼
                                                                             A AND B


                                                         A          B

                                                 Fig 3.1: Electric circuit for AND operator
            Fig 3.1 shows two switches in series connected to a voltage source and a bulb. The two switches denote variables A
            and B, and the bulb's output denotes A ● B. The OFF position of the switch denotes 0, and the ON position denotes
            1. Similarly, the OFF position of the bulb denotes 0, and the ON position denotes 1. The bulb will be ON if and only if
            both switches are in the ON position.
            3.2.2 OR Operator

            The OR operator (often called OR gate) is denoted by writing OR or +. For a pair of variables, A and B, A OR B yields 1
            if either A = 1 or B = 1 and yields 0 if A = 0 and B = 0 (see Table 3.3). The electric circuit shown in Fig 3.2 implements
            the OR operator.


                                          A                B                  A OR B
                                          0                0                    0
                                          0                1                    1
                                          1                0                    1
                                          1                1                    1

                                           Table 3.3: OR operator using operand values 0 and 1





                                                                                                  Boolean Logic  69
   66   67   68   69   70   71   72   73   74   75   76