Answer:
a) 128 codewords
b) 35 codewords
c) 29 codewords
Explanation:
a) Each 7 bits consist of 0 or 1 digits. Therefore the first bit is two choices (0 or 1), the second bit is also two choices (0 or 1), continues this way till the last bit.
So total number of different code words in 7 bits is 2×2×2×2×2×2×2 = 2⁷ = 128
There are 128 different codewords.
b) A code word contains exactly four 1's this means that it has four 1's and three 0's . Therefore, in 7 bits, we have four of the same kind and three of the same kind. Hence, total number of code words containing exactly four 1's =7!/(4!*3!) = 35 codewords
c) number of code words containing at most two 1's = codewords containing zero 1's + words containing one 1's + words containing two 1's
Now codewords containing zero 1's = 0000000 so 1 word
Codewords containing one 1's = 1000000,0100000,0010000,0001000,0000100,0000010,0000001. That's seven words
Codewords containing two 1's means word containing two 1's and five 0's. So out of seven, two are of one kind and five are of another kind
Therefore, the total number of such words=7!/(2!*5!)=21
Hence, codewords having at most two 1's = 21+7+1 =29 codewords