retagged by
623 views
9 votes
9 votes

Consider the $k$ bit binary pattern on 2’s complement system.

  • $\text{T}_{\max}$ and $\text{T}_{\min}$ are maximum and minimum signed numbers we can represent using $k$ bits.
  • $\text{U}_{\max}$ and $\text{U}_{\min}$ are maximum and minimum unsigned numbers we can represent using $k$ bits.

Which of the following(s) is/are true for $k=32$ ?

  1. $\text{T}_{\min} = 1<<31$
  2. $\text{T}_{\max} = \;\sim(1>>31)$
  3. $\text{U}_{\min} = !(1>>31)$
  4. $\text{U}_{\max} = \;\sim(1>>31)$
retagged by

1 Answer

4 votes
4 votes

Tmin = 100...000 and Tmax = 011...111.

Umin = 000…000 = 0 and Umax = 111...111.

bit pattern of 1 = 000...001.

In all above cases, each number is represented using 32 bits.

  1. 1 < < 31 = 100...000 = Tmin, since we shifted bits left by 31 bits. 
  2. 1 > > 31 = 000...000 = 0, since we shifted bits right by 31 bits.
  3. ~ (1 > > 31)= ~ (000...000) = 111...111 = Umax ≠ Tmax, since we toggled each bit.
  4. ! (1 > > 31) = ! (0) = ! (False) = True = 1.

Option A : True from point a.

Option B : False from point c.

Option C : False from point d.

Option D : True from point c.

Answer – A, D

Answer:

Related questions

9 votes
9 votes
3 answers
2
9 votes
9 votes
1 answer
3