Assignment 2
Assignment 2
a. 0xAC12 to binary
Solution:
We can easily represent hexadecimal number in binary by using 4 bit
number for each bit of hexadecimal number. AC12 is the number in hexadecimal
that has to be converted to binary.
A16 can be written as 10102 in binary numbers.
C16 can be written as 11002 in binary numbers.
116 can be written as 00012 in binary numbers.
216 can be written as 00102 in binary numbers.
So, the solution is
= 1010 1100 0001 0010
= 10101100000100102
Solution:
During representation of number in 2’s complement, the most
significant bit(MSB) determines whether the number is positive or negative.
Since, the number -107 is a negative number the MSB will be negative. Also
10710 is 11010112 in binary number.
So,
Step1: 1 1101011 where 1 in MSB represents negative number
Step 2: Converting all the ones to zeros and zeros to one we get,
1 0010100
Step 3: Adding 1 to the above result we get,
1 0010101
Solution:
During representation of number in 2’s complement, the most
significant bit(MSB) determines whether the number is positive or negative.
Since the number given is 10011110 where the most significant bit is 1 which
represents that the given number is negative.
So,
Step 1: Grouping most significant bit and the remaining 7 bits, we get
1 0011110
Step 2: Since 1 is added after complementing in the process, we
process the remaining 7 bits of number by subtracting 1, we get
0011110 -1= 0011101
Step 3: Now, converting all the ones to zeros and all the zeros to one,
we get
1100010
Step4: Converting the above values into decimal we get,
98
Step 4: since the msb is 1 the value will be negative so we get,
-98
Therefore,
100111102 (2’s complement representation in 8-bit) = -98 10
d. 11010110102 into hexadecimal
Solution:
Since hexadecimal can be represented in binary number system by using 4 bits
number for each bit. So we group the binary into the chunks of four and then convert
them into hexadecimal respectively.
So,
Step 1: 11 0101 1010
Step 2: Grouping into chunks of four starting from LSB
0011 0101 1010
Step 3:
00112 can be represented as 316 in hexadecimal.
01012 can be represented as 516 in hexadecimal.
10102 can be represented as A16 in hexadecimal.
Step4: Converting each chunked four bits to respective hexadecimal numbers
we get, 35A16
Therefore,
11010110102 = 35A16 .
e. 1108 into hexadecimal
Solution:
Since octal can be represented in binary number system by using 3 bits
number for each bit. So we convert each octal digit into binary.
So,
48
Therefore,
1108 = 4816 .
Q.N.2. The following binary number is stored using the floating point representation of IEEE-
754 single precision format. Find out the value in decimal.
11101000011010000000000000000000
Solution:
11101000011010000000000000000000
Step 1: The MSB i.e, bit 32(leftmost bit) represents the sign which is 1 incase
of negative number and 0 incase of positive number. Since the number is 1,
the given number is negative.
Step 2: Converting the binary into decimal we get, first of all we convert
exponential value into decimal value,we get
110100002 = 20410
0.11012 =1*2-1+1*2-2+1*2-4
=0.8125
=(-1)sign-bit*(1+fractional value)*2exponent-value
=(-1)*(1.8125)*281
24
= -4.3823561*e