# Basic Logic Operations (AND, OR, XOR, NOT)

If you are on the path of digging into programming, you should start with basic logic operations that are frequently used in many programming languages like PHP, C++, Java, and others. We picked this topic because it’s popular among students, and we hope that this sample will help them to get a better understanding about logic operations. Also, we have more samples on our blog, so make sure that you check them out.

If you need to write an assignment about basic logic operations, but you feel that you should spend time on other more important things than writing, you can ask our service to help you! We have a group of writers who are gurus in various disciplines. Even if you can’t find your discipline from the list, just mention it in the order form and be sure that your writer will be found! You will have the ability to chat with writers and make sure that you are choosing the right person for your task. So, check the sample below and if you decide that you want a similar paper of high quality, our writers will create a unique paper that adheres to your requirements and expectations completely.

## Basic Logical Operations

The bit is the minimal unit of amount of information. It holds one of two values — 0 (False) or 1 (True). That is, one bit cell can be simultaneously in only one of two possible states.

There are certain operations to manipulate bits. These operations are called logical or Boolean operations, and were named after the mathematician George Boole (1815-1864), who contributed to the development of this field of science.

All these operations can be applied to any bit, regardless of whether its state is 0(zero) or 1(one). The following are the basic logical operations and examples of their use.

AND Logical Operation

AND symbol: &

AND logical operation is performed with two bits; let’s call them a and b. The result of executing the logical AND operation is equal to 1 if a and b are equal to 1; in all other cases, the result will be 0. Look at the truth table of the AND logical operation:

a(bit1) b(bit 2) a(bit 1) & b(bit 2)
0 0 0
0 1 0
1 0 0
1 1 1

OR Logical Operation

OR symbol: |

OR logical operation is performed with two bits (a and b). The result of performing a logical OR operation will be 0 if a and b are equal to 0 (zero), and in all other (other) cases, the result is equal to 1 (one). Look at the truth table of the OR logical operation.

a(bit1) b(bit 2) a(bit 1) | b(bit 2)
0 0 0
0 1 1
1 0 1
1 1 1

XOR Logical Operation

XOR symbol: ^

XOR logical operation is performed with two bits (a and b). The result of logical XOR operation is equal to 1 (one) if one of the bits of a or b equal to 1 (one), and in all other cases, the result is 0 (zero). Look at the truth table of the XOR logical operation.

a(bit1) b(bit 2) a(bit 1) ^b(bit 2)
0 0 0
0 1 1
1 0 1
1 1 0

NOT Logical Operation

NOT symbol: ~

NOT logical operation is executed with one bit. The result of this logical operation directly depends on the state of the bit. If the bit was in the zero state, the output will be vice versa. Look at the truth table for the NOT logical operator:

a(bit1) ~a(bit negation)
0 1
1 0

Thanks for your attention!