1 Suppose that all integers are represented using 8 bits a W

1. Suppose that all integers are represented using 8 bits.

(a) What is the decimal value of 0xFA when regarded as an unsigned integer? What is the value when it is regarded as a two\'s complement integer?

(b) Give the binary representation of 0xA8.

(c) When working in an 8-bit two\'s complement representation if n=0x7F and m=0x01 what is n+m in hexadecimal? What decimal value will this hexadecimal number represent?

Solution

(a) (FA)16 = ( )2

F= 1111

   A= 1010

(FA)16 =   (11111010)2

IF 11111010 is regarded as two\'s complement integer ,check its leftmost bit. Its 1 so it is a negative number

11111010

complement = 00000101

+1 = +1

value = 00000110 =6

so the number is -6

(b) (A8)16 = ( )2

   A =1010

8=1000

so (A8)16 =(10101000)2

(c) n = 7F

m= 01

converting them to 8 bit binary and consider them as two\'s complement representation

n= 0111 1111

m=0000 0001

+ -----------------

1000 0000

--------------------

There is no overflow no carry out.

1. Suppose that all integers are represented using 8 bits. (a) What is the decimal value of 0xFA when regarded as an unsigned integer? What is the value when it

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site