@@ -5,31 +5,38 @@ Do not convert any binary numbers to decimal when solving a question unless the
55The goal of these exercises is for you to gain an intuition for binary numbers. Using tools to solve the problems defeats the point.
66
77Convert the decimal number 14 to binary.
8- Answer:
8+ Answer:
9+ 1100
910
1011Convert the binary number 101101 to decimal:
11- Answer:
12+ Answer:
13+ 45
1214
1315Which is larger: 1000 or 0111?
1416Answer:
17+ 1000 because its equal to 8 in decimal and 8 is larger than 7 (0111)
1518
1619Which is larger: 00100 or 01011?
1720Answer:
21+ 01011 is larger
1822
1923What is 10101 + 01010?
2024Answer:
25+ 11111
2126
2227What is 10001 + 10001?
2328Answer:
29+ 100010
2430
2531What's the largest number you can store with 4 bits, if you want to be able to represent the number 0?
2632Answer:
33+ largest number is 1111 = 15 in decimal
2734
2835How many bits would you need in order to store the numbers between 0 and 255 inclusive?
29- Answer:
36+ Answer: 8 bits
3037
3138How many bits would you need in order to store the numbers between 0 and 3 inclusive?
32- Answer:
39+ Answer: 2 bits
3340
3441How many bits would you need in order to store the numbers between 0 and 1000 inclusive?
3542Answer:
@@ -38,28 +45,39 @@ How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)
3845Answer:
3946
4047Convert the decimal number 14 to hex.
41- Answer:
48+ Answer: E
4249
4350Convert the decimal number 386 to hex.
44- Answer:
51+ Answer:
52+ 1- decimal to binary = 110000010
53+ 2- then to hex = 182
4554
4655Convert the hex number 386 to decimal.
4756Answer:
57+ using power of 16 method
58+ = (3* 256)+(8* 16)+6 = 768 + 128 + 6 = 902
4859
4960Convert the hex number B to decimal.
5061Answer:
62+ 11
5163
5264If reading the byte 0x21 as a number, what decimal number would it mean?
5365Answer:
66+ 33
5467
5568If reading the byte 0x21 as an ASCII character, what character would it mean?
5669Answer:
70+ !
5771
5872If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
5973Answer:
74+ dark grey
6075
6176If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
6277Answer:
78+ Mix of blue and red
6379
6480If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be?
6581Answer:
82+ 10101010, 00000000, 11111111
83+ 170, 0, 255
0 commit comments