Question

In: Computer Science

What is the minimum number of bits needed to encode the days of the month in...

What is the minimum number of bits needed to encode the days of the
month in a Canadian calendar.

1.

5

2.

3

3.

6

4.

4

Solutions

Expert Solution

Answer is 5 bits.

Consider the following case. You have to count whole numbers less than 4 in binary. A 1-bit binary can have 2 values exclusively., either 0 or 1. With 2 bits, we can have 4 possible combinatios.

Decimal Binary

1 bit can count - 2values - 0, 1 0, 1

2-bits can count - 4 values - 0,1,2,3 00, 01, 10, 11

n-bits can have - 2n combinations

So, Minimum 2 bits are required to count whole numbers less than 4. In other words, 2-bits are enough to encode numbers less than 4. The General formula is, to count a number X, select a power 'n' of 2 which is closer to x.

2n >=X

To count whole numbers less than 4, we need enough no. of bits which have 4 different combinations.

What about 4 included ? How many bits are required then ?

Now, we have to count 5 numbers(0,1,2,3,4). so we need to find the power of 2, 'n', closer to 5

22 < 5 .

2 bits are not enough to represent 5 numbers as it does not have 5 combinations

23 > 5.

3 bits have 8 different combinations. So, with 3 bits we can count numbers till 23-1 = 7 (0,1,2,3,4,5,6)

Even 4-bits can be used to count numbers less than 5.

0000 - 0

0001 - 1

0010 - 2

0011 - 3

0100 - 4

But the countable range of 4-bits is 24 = 16. Infact any number of bits greater than 3 can be used to count numbers less than 5, but it is just waste of memory.

So, Minimum 3 -bits are required to count 5 numbers.(0,1,2,3,4)

Canadian Calendar:

Now, the Canadian Calendar has 31 days in Odd numbered months and 30 days in even numbered months, except for Febraury which can have either 28 or 29 days depending on its occurance in a Leap year, but No month will more than 31 days in a Calendar year.

25 > 31

Hence minimum 5-bits are required to encode the days of a month in a Canadian Calendar.


Related Solutions

What is the minimum number of bits for representing the opcode if there are 62 different...
What is the minimum number of bits for representing the opcode if there are 62 different instructions? Please explain it, thanks.
What is the theoretical (minimum) number of equivalents of methylmagnesium iodide (CHMgI) needed for reaction with...
What is the theoretical (minimum) number of equivalents of methylmagnesium iodide (CHMgI) needed for reaction with benzoin? How many equivalents of CH3MgI did you use relative to benzoin and why is this number of equivalents necessary for the reaction? In this experiment, we used 0.287g of magnesium turnings with 13mL of a 1.0M solution of methyl iodide (CH3I) in anhydrous diethyl ether to synthesize methylmagnesium iodide (CHMgI) We then reacted methylmagnesium iodide (CHMgI) with 0.507g of a benzoin solution in...
The time required to start a​ business, defined as the number of days needed to complete...
The time required to start a​ business, defined as the number of days needed to complete the procedures to legally operate a​ business, in 20 developed countries and 20 emerging countries is included in the accompanying table. Developed Countries (days) Emerging Countries (days) 26 1 115 27 8 5 31 5 8 16 5 6 27 16 7 7 6 25 10 2 30 29 11 15 18 18 18 12 29 6 12 22 8 14 25 8 18...
The time required to start a​ business, defined as the number of days needed to complete...
The time required to start a​ business, defined as the number of days needed to complete the procedures to legally operate a​ business, in 20 developed countries and 20 emerging countries is included in the accompanying table. Complete parts​ (a) through​ (d) below. DEVELOPED COUNTRIES (DAYS) 24 34    115 11 7 17 33 20 7 30 4 13 27 10 8 26 6 18 10 22 EMERGING COUNTRIES (DAYS) 2 28 28 15 4 17 5 12 12 5...
1) What is the minimum down payment needed?
QUESTIONS:1) What is the minimum down payment needed?2) If he decides to live in his home for more than 5 years and both plans offer him the same loan amount, which mortgage plan is a better choice?3) Work out an amortization table for the corresponding mortgage plan for the first 12 months.4) Work out a cost analysis for the “buy or rent” decision.INFORMATION NEEDED FOR QUESTIONS:Ho is earning HK$30,000 per month and has a saving of total HK$900,000. He is...
In Hamilton county, ohio, the mean number of days needed to sell a house is 86...
In Hamilton county, ohio, the mean number of days needed to sell a house is 86 days (cincinnati Multiple listing Service, april, 2012). data for the sale of 40 houses in a nearby county showed a sample mean of 80 days with a sample standard deviation of 20 days. We want to do a hypothesis test to determine whether the mean number of days until a house is sold is different than the Hamilton county mean of 86 days in...
Write a program that copies the even number of bits from a into the corresponding bits...
Write a program that copies the even number of bits from a into the corresponding bits in b ,only use bit-manipulation instructions, no loop int main () { uint_32 a = 0 xaabbccdd ; uint_32 b = 0 x11223344 ; // Replace bits 0 ,2 ,4 ,... of b with bits 0 ,2 ,4 ,... from a . uint_32 result = ...; // Print out the result as a hexadecimal number }
Use Java (Find the number of days in a month) Write a program that prompts the...
Use Java (Find the number of days in a month) Write a program that prompts the user to enter the month and year and displays the number of days in the month. For example, If the user entered month 2 and year 2012, the program should display that February 2012 has 29 days. If the user entered month 3 and year 2015, the program should display that March 2015 has 31 days. Sample Run 1 Enter a month in the...
For the 12 month period February 2018 through January 2019, the number of degree days that...
For the 12 month period February 2018 through January 2019, the number of degree days that accrued for the Amherst, MA area was 5903. Many houses in New England heat with oil. Suppose a reasonable-size house required a total of 1400 gallons of oil for that recent entire 12- month period. Suppose also that heating oil is priced at $2.90 per gallon. A. What was the total cost to purchase the oil to heat the house for the entire year?...
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code...
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code requirements. Illustrate the error detection and correction scheme using Hamming code method, for both the sender and receiver to detect an error at the following positions: a.6thbit position. b.11thbit position.Assume an odd-parity scheme for this problem.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT