代写代考 SN2020 : Answers. Q1

SN2020 : Answers. Q1
(a) (i) 1023 = 11 1111 1111 = $3FF. Extending to 32 bits in hex gives $0000 03FF. Any suitable arithmetic method for conversion from base 10 to 2 and then to hex, or directly from base 10 to base 16 [2]
(ii) -1023 is $FFFFFC00 + 1 = $FFFF FC01. Taught method requires use of algorithm to invert a twos’ comp number by taking one’s comp and adding 1. Any other successful arithmetic argument is also acceptable [2]
(b) This depends on the order the calculations are performed in. Using the natural, left-to-right, order, the sum 100+30 will overflow generating the answer 1000 0010 (-126) . If the overflow flag is ignored and 20 is now subtracted from this, the answer will overflow again but will yield the result 0110 1100 (11010). This is the correct answer to the calculation, but two overflows will have occurred. If the subtraction is done first, the correct answer will be obtained with no overflow. [3]

Copyright By PowCoder代写 加微信 powcoder

(c) The statement is not true because not all numbers in a two’s complement have an inverse in the code. The exception is always the most negative value. Thus, in an 8-bit code, the value – 128 does not have an inverse. Thus we can have:
-127 – (-128) = 1 but – (-128) interpreted as an additive inverse is an overflow.
(d) Outline solution…
;for (i=0; iCS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com