a language has 28 different letters in total. each word in the language is composed of maximum 7 letters. you want to create a data-type to store a word of this language. you decide to store the word as an array of letters. how many bits will you assign to the data-type to be able to store all kinds of words of the language.
Answers
Answered by
117
In binary, there are only two possibilities- zero and one.
Thus, looking at the powers of 2, we realize that 32 is the closest exponential result of 2 to 28, where 2^5 = 32.
Hence, to cover all the possibilities, we need 5 bits at the least.
But there are seven letters. Thus, the number of bits we require is 7 * 5 = 35 bits
Thus, looking at the powers of 2, we realize that 32 is the closest exponential result of 2 to 28, where 2^5 = 32.
Hence, to cover all the possibilities, we need 5 bits at the least.
But there are seven letters. Thus, the number of bits we require is 7 * 5 = 35 bits
Answered by
8
That datatype that will be used for storing the word of this language is:
char word[8];
And I will assign 64 bits or 8 bytes to the data type
char word[8];
And I will assign 64 bits or 8 bytes to the data type
Similar questions
English,
8 months ago
Hindi,
8 months ago
India Languages,
1 year ago
Math,
1 year ago
English,
1 year ago