To know if there is an error in the message or not what we can do is
first of all write down the message and then check for partiy bits value i.e
1 0 0 0 1 1 0
there are 3 parity bits. How ? by using 2 to the power n
2 to the power 0 = 1
2 to the power 1 = 2
2 to the power 2 = 4
2 to the power 3 = 8
and so on.
so here parity bits are at position 1, 2 and 4.
now calculate the parity bits value of P1, P2 and P4
for P1 = value of bit at position 1 from right, value of bit at position 3 from right, value of bit at position 5 from right, value of bit at position 7 from right
i.e 0,1,0,1
since there is no mentioning of parity case i.e even or odd parity we have to consider we take by default the parity case to be even [If you don’t understand it please check for Hamming code]
so 0, 1, 0, 1 have even number of 1’s therefore the value of P1 = 0
Similarly, for P2 = value of bit at position 2 from right, value of bit at position 3 from right, value of bit at position 6 from right, value of bit at position 7 from right
i.e 1, 1,0,1
it has odd number of ones therefore P2 should be 1 to make it a even parity.
for P3 = value of bit at position 4 from right, value of bit at position 5 from right, value of bit at position 6 from right, value of bit at position 7 from right
i.e 0,0,0,1
it has odd number of ones therefore P3 should be 1
now if all the parity bits would have been come out as 0 then there would be no error but in this case P2 and P3 are 1. That means there is an error in the message.
Now how to know if which bit contains the error.
simply write P3, P2, P1 in sequence i.e 110 and calculate the decimal value of it
110 in decimal is 6
and therefore the 6th bit contains an error. and accordingly then you can give the correct message by replacing the erroneous bit and correct message is 1 1 0 0 1 1 0