Question

In: Computer Science

Assuming integers are represented as 16-bit words and negative numbers are represented using the 2's complementary...

Assuming integers are represented as 16-bit words and negative numbers are represented using the 2's complementary method, convert the following hexadecimal numbers to decimal numbers a. 0xCAFE, b. 0x4DAD, c. 0xFACE

Solutions

Expert Solution

Hexadecimal     Binary
    0           0000
    1           0001
    2           0010
    3           0011
    4           0100
    5           0101
    6           0110
    7           0111
    8           1000
    9           1001
    A           1010
    B           1011
    C           1100
    D           1101
    E           1110
    F           1111
using this table for converting hexadecimal to binary

a)
0xCAFE
in binary it is 1100 1010 1111 1110
since left most bit is 1, this number is negative number.
so, follow these steps below to convert this into a decimal value.
I. first flip all the bits
   1100101011111110 is flipped to 0011010100000001
II. Add 1 to above result
0011010100000001 + 1 = 0011010100000010
III. Now convert this result to decimal value
=> 0011010100000010
=> 0x2^15+0x2^14+1x2^13+1x2^12+0x2^11+1x2^10+0x2^9+1x2^8+0x2^7+0x2^6+0x2^5+0x2^4+0x2^3+0x2^2+1x2^1+0x2^0
=> 0x32768+0x16384+1x8192+1x4096+0x2048+1x1024+0x512+1x256+0x128+0x64+0x32+0x16+0x8+0x4+1x2+0x1
=> 0+0+8192+4096+0+1024+0+256+0+0+0+0+0+0+2+0
=> 13570

Answer: -13570

b)
0x4DAD
in binary it is 0100 1101 1010 1101
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
=> 0100110110101101
=> 0x2^15+1x2^14+0x2^13+0x2^12+1x2^11+1x2^10+0x2^9+1x2^8+1x2^7+0x2^6+1x2^5+0x2^4+1x2^3+1x2^2+0x2^1+1x2^0
=> 0x32768+1x16384+0x8192+0x4096+1x2048+1x1024+0x512+1x256+1x128+0x64+1x32+0x16+1x8+1x4+0x2+1x1
=> 0+16384+0+0+2048+1024+0+256+128+0+32+0+8+4+0+1
=> 19885

Answer: 19885

c)
0xFACE
in binary it is 1111 1010 1100 1110
since left most bit is 1, this number is negative number.
so, follow these steps below to convert this into a decimal value.
I. first flip all the bits
   1111101011001110 is flipped to 0000010100110001
II. Add 1 to above result
0000010100110001 + 1 = 0000010100110010
III. Now convert this result to decimal value
=> 0000010100110010
=> 0x2^15+0x2^14+0x2^13+0x2^12+0x2^11+1x2^10+0x2^9+1x2^8+0x2^7+0x2^6+1x2^5+1x2^4+0x2^3+0x2^2+1x2^1+0x2^0
=> 0x32768+0x16384+0x8192+0x4096+0x2048+1x1024+0x512+1x256+0x128+0x64+1x32+1x16+0x8+0x4+1x2+0x1
=> 0+0+0+0+0+1024+0+256+0+0+32+16+0+0+2+0
=> 1330

Answer: -1330

Related Solutions

Assuming integers are represented as 32-bit words and negative numbers are represented using the 2's complimentary...
Assuming integers are represented as 32-bit words and negative numbers are represented using the 2's complimentary method convert the following decimal numbers to hexadecimal numbers (show your work). a. -1314, b. 2020
Fill in the following table to show how the given integers are represented, assuming 16 bits...
Fill in the following table to show how the given integers are represented, assuming 16 bits are used to store values and the machine uses 2’s complement notation. (This is not necessarily MARIE.) Give values in the last two columns in hexadecimal as they would appear memory assuming the byte at address a is on the left and the byte at the address a+1 is on the right. 2-Byte Big 2-Byte Little Integer Binary Hex Endian (hex) Endian (hex) Example...
add the following numbers using 16-bit 2's complement. show all the steps and calculations. Please also...
add the following numbers using 16-bit 2's complement. show all the steps and calculations. Please also show steps to verify that the answer is correct. -7493 and -6372
add -19 and 79 using 16-bit 2's complement format
add -19 and 79 using 16-bit 2's complement format
add -19 and 79 using 16-bit 2's complement format
add -19 and 79 using 16-bit 2's complement format
add -19 and 79 using 16-bit 2's complement format
add -19 and 79 using 16-bit 2's complement format
The range of integers that can be represented by this 12-bit construction is -255 to 255...
The range of integers that can be represented by this 12-bit construction is -255 to 255 (a 9-bit signed integer has a range of -256 to 255). What are the floating-point representations for the first eight, odd, positive, decimal integers (i.e., 1, 3, 5, 7, 9, 11, 13, 15) in this 12-bit notation?
Convert the following decimal numbers to 16-bit 2’s complement binary. Display your result in hexadecimal. a.3030...
Convert the following decimal numbers to 16-bit 2’s complement binary. Display your result in hexadecimal. a.3030 b.404 c.5050 d.-5050 e.-20000 Show work with steps
Convert the following hexadecimal representations of 16-bit 2’s complement binary numbers to decimal. a.FCAD b.DEAD c.1111...
Convert the following hexadecimal representations of 16-bit 2’s complement binary numbers to decimal. a.FCAD b.DEAD c.1111 d.8000 e.FACE
2) Show how each of the following signed, decimal integers would be stored in 16-bit two's...
2) Show how each of the following signed, decimal integers would be stored in 16-bit two's complement format. Give your answer in hexadecimal. a) -21 (5 points) b) 4096 (5 points)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT