4. Parity bits –
A parity bit is a bit appended to a data of binary bits to ensure that the total number
of 1’s in the data is even or odd. Parity bits are used for error detection. There are
two types of parity bits:
1. Even parity bit:
In the case of even parity, for a given set of bits, the number of 1’s are counted. If that
count is odd, the parity bit value is set to 1, making the total count of occurrences of
1’s an even number. If the total number of 1’s in a given set of bits is already even, the
parity bit’s value is 0.
2. Odd Parity bit –
In the case of odd parity, for a given set of bits, the number of 1’s is counted. If that
count is even, the parity bit value is set to 1, making the total count of occurrences of
1’s an odd number. If the total number of 1’s in a given set of bits is already odd, the
parity bit’s value is 0.