Consider Z = X โ€“ Y, where X, Y and Z are all in sign-magnitude form. X and Y are each represented in ๐‘› bits. To avoid overflow, the representation of Z would require a minimum of

Q. Consider Z = X โ€“ Y, where X, Y and Z are all in sign-magnitude form. X and Y are each represented in ๐‘› bits. To avoid overflow, the representation of Z would require a minimum of:

(A) ๐‘› bits

(B) ๐‘› โˆ’ 1 bits

(C) ๐‘› + 1 bits

(D) ๐‘› + 2 bits

Ans: ๐‘› + 1 bits

Solution:

Overflow can occur when two same sign numbers are added or two opposite sign numbers are subtracted.

For example:

let n = 4 bit, X = +6 and Y = -5 (1 bit for sign and 3 bit for magnitude)

Therefore, Z = X – Y = 6 – (-5) = 6+5 = 11

But result (Z) 11 needs 5 (= 4 + 1) bits to store,

Sin integer 11 needs 1 bit for sign and 4 bit for magnitude.

Therefore, to avoid overflow, the representation of Z would require a minimum of (n + 1) bits.

Take Mock Tests

Government Schemes Mock Test Start Test!
Political Science Mock Test โ€“ 42 Start Test
History Test โ€“ 190 Start Test
Quantitative Aptitude Test Start Test!
Data Interpretation - Mock Test Start Test!
General Awareness - Mock Test Start Test!
Reasoning Ability - Mock Test Start Test!
We will be happy to hear your thoughts

Leave a reply

Gkseries.com
Logo
Register New Account