In: Computer Science
Convert the following numbers from decimal to hexadecimal (and
for each, indicate how many bytes would be needed to store the
value of that number):
10
15
16
256
250
358
1024
1023
8195
a) 10 Divide 10 successively by 16 until the quotient is 0 10/16 = 0, remainder is 10 Read remainders from the bottom to top as A Answer: 0xA Number of bytes required = 1 b) 15 Divide 15 successively by 16 until the quotient is 0 15/16 = 0, remainder is 15 Read remainders from the bottom to top as F Answer: 0xF Number of bytes required = 1 c) 16 Divide 16 successively by 16 until the quotient is 0 16/16 = 1, remainder is 0 1/16 = 0, remainder is 1 Read remainders from the bottom to top as 10 Answer: 0x10 Number of bytes required = 1 d) 256 Divide 256 successively by 16 until the quotient is 0 256/16 = 16, remainder is 0 16/16 = 1, remainder is 0 1/16 = 0, remainder is 1 Read remainders from the bottom to top as 100 Answer: 0x100 Number of bytes required = 2 e) 250 Divide 250 successively by 16 until the quotient is 0 250/16 = 15, remainder is 10 15/16 = 0, remainder is 15 Read remainders from the bottom to top as FA Answer: 0xFA Number of bytes required = 1 f) 358 Divide 358 successively by 16 until the quotient is 0 358/16 = 22, remainder is 6 22/16 = 1, remainder is 6 1/16 = 0, remainder is 1 Read remainders from the bottom to top as 166 Answer: 0x166 Number of bytes required = 2 g) 1024 Divide 1024 successively by 16 until the quotient is 0 1024/16 = 64, remainder is 0 64/16 = 4, remainder is 0 4/16 = 0, remainder is 4 Read remainders from the bottom to top as 400 Answer: 0x400 Number of bytes required = 2 h) 1023 Divide 1023 successively by 16 until the quotient is 0 1023/16 = 63, remainder is 15 63/16 = 3, remainder is 15 3/16 = 0, remainder is 3 Read remainders from the bottom to top as 3FF Answer: 0x3FF Number of bytes required = 2 i) 8195 Divide 8195 successively by 16 until the quotient is 0 8195/16 = 512, remainder is 3 512/16 = 32, remainder is 0 32/16 = 2, remainder is 0 2/16 = 0, remainder is 2 Read remainders from the bottom to top as 2003 Answer: 0x2003 Number of bytes required = 2