Math, asked by chaitralipare, 5 months ago

There are two integer numbers X and Y, and the value of X and Y is in
between 0 to 25. User stores the value under 5 bit number. How many minimum bit is
required to store the result of the below expression?
Res = 3*(X-Y)
1.7
2.5
3.8
4.6

Answers

Answered by nancychaterjeestar29
0

Answer- Option 3

Given : integers X and Y

Step by Step Solution:

Step 1:

To understand the solution we first have to understand why the user chose a 5 bit number. User said numbers lie between 0 to 25 in binary these values will range from 00000 to 11001

0 in binary is 00000

25 in binary is 11001

Step 2:

Now, it is clear that you need 5 bits to store such a number as the min bits required to store 25 is 5 (as 11001).

Formula for the max number that can be stored per bit is 2X - 1. Where x is the number of bits

Step 3:

The max number that 5 bits can store will be 31 as 11111 = 31.

The range of 3*(X-Y) will be [-75,75]

-75 when X = 0, Y = 25

75 when X = 25, Y = 0

To store 75 in binary we need to calculate the nearest power 2 just greater than 75. Which is 128. Where power of 2 will be 7.

Since the number can also be negative so you need extra binary digital as MSB(Most significant Bit) for negative or positive sign.

Conclusion : So answer is 7 + 1 = 8

#SPJ3

Similar questions