0% found this document useful (0 votes)
72 views

Assignment 2

The document contains solutions to multiple questions involving number conversions between binary, decimal, hexadecimal, and octal number systems. The first question converts a hexadecimal number to binary by representing each hexadecimal digit with its 4-bit binary equivalent. The second question converts a decimal number to its 8-bit 2's complement binary representation. The third question converts an 8-bit 2's complement binary number to decimal. The remaining questions similarly convert between different number systems.

Uploaded by

Hagi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

Assignment 2

The document contains solutions to multiple questions involving number conversions between binary, decimal, hexadecimal, and octal number systems. The first question converts a hexadecimal number to binary by representing each hexadecimal digit with its 4-bit binary equivalent. The second question converts a decimal number to its 8-bit 2's complement binary representation. The third question converts an 8-bit 2's complement binary number to decimal. The remaining questions similarly convert between different number systems.

Uploaded by

Hagi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Q.N.

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

b. −10710 to 8-bit 2’s Complement

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

Therefore, the 8-bit 2’s complement of -107 10 is 100101012.

c. 10011110 (8-bit 2’s complement representation) to decimal

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,

Step 1: Converting each octal bit into binary, we get


001 001 000
Step 2: Grouping the numbers into the chunk of four since hexadecimal can be
represented in binary by converting each bit into 4 bit binary number, we get
0100 1000
Step 3: Converting the grouped four bits binary into respective hexadecimal
number , we get
01002 can be represented as 416 in hexadecimal.
10002 can be represented as 816 in hexadecimal.

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:

The floating point representation of IEEE-754 is given to us:

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.

The bit 31 to 23(next 8 bit) represents the exponential value i.e,


11010000.

The remaining bit is fractional value i.e, 11010000000000000000000.

Step 2: Converting the binary into decimal we get, first of all we convert
exponential value into decimal value,we get

110100002 = 20410

Subtracting the value by bias valuei.e,127, we get 81 which is


exponential value.

Now. Converting fractional value into decimal we get,

0.11012 =1*2-1+1*2-2+1*2-4

=0.8125

Step3: Now the solution is given by:

=(-1)sign-bit*(1+fractional value)*2exponent-value
=(-1)*(1.8125)*281
24
= -4.3823561*e

You might also like