The GATE Grind

GATE 2019 CS – Question 18

Digital Logic · Number Representation and Arithmetic · 1 mark · Multiple choice

Consider $Z=X-Y$, where $X$, $Y$ and $Z$ are all in sign-magnitude form. $X$ and $Y$ are each represented in $n$ bits. To avoid overflow, the representation of $Z$ would require a minimum of:

  1. $n$ bits
  2. $n-1$ bits
  3. $n+1$ bits
  4. $n+2$ bits

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (C) $n+1$ bits

Explanation

The magnitudes of $X$ and $Y$ fit in $n-1$ bits, so $|X-Y|$ can be up to twice as large, which needs one more magnitude bit. With the sign bit this gives $n+1$ bits in total.