You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: number-systems/README.md
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,61 +5,61 @@ Do not convert any binary numbers to decimal when solving a question unless the
5
5
The goal of these exercises is for you to gain an intuition for binary numbers. Using tools to solve the problems defeats the point.
6
6
7
7
Convert the decimal number 14 to binary.
8
-
Answer:
8
+
Answer: 1110
9
9
10
10
Convert the binary number 101101 to decimal:
11
-
Answer:
11
+
Answer: 45
12
12
13
13
Which is larger: 1000 or 0111?
14
-
Answer:
14
+
Answer: 1000
15
15
16
16
Which is larger: 00100 or 01011?
17
-
Answer:
17
+
Answer: 01011
18
18
19
19
What is 10101 + 01010?
20
-
Answer:
20
+
Answer: 11111
21
21
22
22
What is 10001 + 10001?
23
-
Answer:
23
+
Answer: 100010
24
24
25
25
What's the largest number you can store with 4 bits, if you want to be able to represent the number 0?
26
-
Answer:
26
+
Answer: 1111
27
27
28
28
How many bits would you need in order to store the numbers between 0 and 255 inclusive?
29
-
Answer:
29
+
Answer: 8bits
30
30
31
31
How many bits would you need in order to store the numbers between 0 and 3 inclusive?
32
-
Answer:
32
+
Answer: 2bits
33
33
34
34
How many bits would you need in order to store the numbers between 0 and 1000 inclusive?
35
-
Answer:
35
+
Answer: 10 bits
36
36
37
-
How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
38
-
Answer:
37
+
How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
38
+
A binary number is a power of 2 if it has exactly one 1 bit. For example: 1, 10, 100, 1000, 10000 are all powers of 2 (1, 2, 4, 8, 16), but 101 or 110 are not because they have multiple 1s.
39
39
40
40
Convert the decimal number 14 to hex.
41
-
Answer:
41
+
Answer: 0xE
42
42
43
43
Convert the decimal number 386 to hex.
44
-
Answer:
44
+
Answer: 0x182
45
45
46
46
Convert the hex number 386 to decimal.
47
-
Answer:
47
+
Answer: 902
48
48
49
49
Convert the hex number B to decimal.
50
-
Answer:
50
+
Answer: 11
51
51
52
52
If reading the byte 0x21 as a number, what decimal number would it mean?
53
-
Answer:
53
+
Answer:33
54
54
55
55
If reading the byte 0x21 as an ASCII character, what character would it mean?
56
-
Answer:
56
+
Answer: !
57
57
58
58
If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
59
-
Answer:
59
+
Answer: very dark grey
60
60
61
61
If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
62
-
Answer:
62
+
Answer: Bright purple
63
63
64
64
If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be?
0 commit comments