Docsity

EE 2740 - HW3 Solutions: Binary, Octal, Hex, Sign-Mag, 1's & 2's Complement, 8-bit Arithme, Study notes of Computer Science

Toggle sidebar
bg1
EE 2740 โ€” HW 3 solutions 1
EE 2740 โ€” Homework 3 solutions
Fall 2013
1. (a) Convert (377)10 to binary, octal, and hexadecimal.
(b) Convert (00101101)2 into octal, hexadecimal, and decimal.
(a) (377)10 = (1 0111 1001)2 = (571)8 = (179)16
(b) (00101101)2 = (55)8 = (2D)16 = (45)10
2. Take the 8-bit 1โ€™s complement and the 8-bit 2โ€™s complement of each of the following
binary numbers:
(a) 00000100
(b) 11111011
(c) 00110111
(d) 11100000
To enhance the readability, the answers insert a space between each four bits.
(a)
(b)
(c)
(d)
original
0000 0100
1111 1011
0011 0111
1110 0000
1โ€™s complement
1111 1011
0000 0100
1100 1000
0001 1111
2โ€™s complement
1111 1100
0000 0101
1100 1001
0010 0000
3. Determine the 8-bit sign-and-magnitude, 1โ€™s complement, and 2โ€™s complement
representations for each of the following decimal numbers: +36, โˆ’84. (Note: Be sure to
represent +36 as a positive number and โˆ’84 as a negative number.)
To enhance the readability, the answers insert a space between each four bits.
decimal
+36
โˆ’84
signed magnitude
0010 0100
1101 0100
1โ€™s complement
0010 0100
1010 1011
2โ€™s complement
0010 0100
1010 1100
4. Determine the decimal value of the following 8-bit 2โ€™s complement numbers.
(a) 11111011
(b) 00110111
(c) 11100011
(a) โˆ’5
(b) 55
(c) โˆ’29
pf2

Partial preview of the text

Download EE 2740 - HW3 Solutions: Binary, Octal, Hex, Sign-Mag, 1's & 2's Complement, 8-bit Arithme and more Study notes Computer Science in PDF only on Docsity!

EE 2740 โ€” HW 3 solutions 1

EE 27 40 โ€” Homework 3 solutions

Fall 2013

  1. (a) Convert ( 377 ) 10 to binary, octal, and hexadecimal. (b) Convert ( 00101101 ) 2 into octal, hexadecimal, and decimal. (a) ( 377 ) 10 = (1 0111 1001) 2 = ( 571 ) 8 = ( 179 ) 16 (b) ( 00101101 ) 2 = ( 55 ) 8 = (2D) 16 = ( 45 ) 10

  2. Take the 8-bit 1โ€™s complement and the 8-bit 2โ€™s complement of each of the following binary numbers: (a) 00000100 (b) 11111011 (c) 00110111 (d) 11100000 To enhance the readability, the answers insert a space between each four bits. (a) (b) (c) (d) original 0000 0100 1111 1011 0011 0111 1110 0000 1โ€™s complement 1111 1011 0000 0100 1100 1000 0001 1111 2โ€™s complement 1111 1100 0000 0101 1100 1001 0010 0000

  3. Determine the 8-bit sign-and-magnitude, 1โ€™s complement, and 2โ€™s complement representations for each of the following decimal numbers: +36, โˆ’84. (Note: Be sure to represent +36 as a positive number and โˆ’84 as a negative number.) To enhance the readability, the answers insert a space between each four bits. decimal (^) + 36 โˆ’ 84 signed magnitude 0010 0100 1101 0100 1โ€™s complement 0010 0100 1 010 1011 2โ€™s complement 0010 0100 1 010 1100

  4. Determine the decimal value of the following 8-bit 2โ€™s complement numbers. (a) 11111011 (b) 00110111 (c) 11100011 (a) โˆ’ 5 (b) 55 (c) โˆ’ 29

EE 2740 โ€” HW 3 solutions 2

  1. Perform the following addition or subtraction of the given numbers using 8-bit 2โ€™s complement representation of the numbers. Parts (a) and (b) are given in decimal, while parts (c)-(e) are given in 8-bit 2โ€™s complement. Indicate in each case whether overflow occurs. (a) (โˆ’65) + (+72) (b) (โˆ’65) โˆ’ (+72) (c) 01101100 โˆ’ 01010011 (d) 01101100 + 01010011 (e) 11100011 + 11111001 (a) (โˆ’ 65 ) 1011 1111
  • (+ 72 ) + 0100 1000
  • 7 0000 0111 (Note: discard carry) No overflow (b) (โˆ’65) (โˆ’ 65 ) 1011 1111 โˆ’ (+ 72 ) + (โˆ’ 72 ) + 1011 1000 โˆ’ 137 โˆ’ 137 1 0111 0111 Yes, overflow occurs (c) 0110 1100 โˆ’ 0101 0011 0001 1001 No overflow (Note: Could also add 2โ€™s complement of 0101 0011) (d) 0110 1100
  • 0101 0011 1011 1111 Yes, overflow occurs (e) 1110 0011
  • 1111 1001 1101 1100 (Note: discard carry) No overflow