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
+4-69Lines changed: 4 additions & 69 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ What's the largest number you can store with 4 bits, if you want to be able to r
26
26
Answer: 15
27
27
28
28
How many bits would you need in order to store the numbers between 0 and 255 inclusive?
29
-
Answer: 9 bits
29
+
Answer: 8 bits
30
30
31
31
How many bits would you need in order to store the numbers between 0 and 3 inclusive?
32
32
Answer: 2 bits
@@ -35,7 +35,7 @@ How many bits would you need in order to store the numbers between 0 and 1000 in
35
35
Answer: 10 bits
36
36
37
37
How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
38
-
Answer: n & n-1 == 0
38
+
Answer: n > 0 & (n & n-1 ==0)
39
39
40
40
Convert the decimal number 14 to hex.
41
41
Answer: E
@@ -46,72 +46,7 @@ Answer: 11E
46
46
Convert the hex number 386 to decimal.
47
47
Answer: 902
48
48
49
-
Convert the hex number B to decimal.Do not use any tools or programming to solve these problems. Work it out yourself by hand, and fill in the answers.
50
-
51
-
Do not convert any binary numbers to decimal when solving a question unless the question explicitly tells you to.
52
-
53
-
The goal of these exercises is for you to gain an intuition for binary numbers. Using tools to solve the problems defeats the point.
54
-
55
-
Convert the decimal number 14 to binary.
56
-
Answer:
57
-
58
-
Convert the binary number 101101 to decimal:
59
-
Answer:
60
-
61
-
Which is larger: 1000 or 0111?
62
-
Answer:
63
-
64
-
Which is larger: 00100 or 01011?
65
-
Answer:
66
-
67
-
What is 10101 + 01010?
68
-
Answer:
69
-
70
-
What is 10001 + 10001?
71
-
Answer:
72
-
73
-
What's the largest number you can store with 4 bits, if you want to be able to represent the number 0?
74
-
Answer:
75
-
76
-
How many bits would you need in order to store the numbers between 0 and 255 inclusive?
77
-
Answer:
78
-
79
-
How many bits would you need in order to store the numbers between 0 and 3 inclusive?
80
-
Answer:
81
-
82
-
How many bits would you need in order to store the numbers between 0 and 1000 inclusive?
83
-
Answer:
84
-
85
-
How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
86
-
Answer:
87
-
88
-
Convert the decimal number 14 to hex.
89
-
Answer:
90
-
91
-
Convert the decimal number 386 to hex.
92
-
Answer:
93
-
94
-
Convert the hex number 386 to decimal.
95
-
Answer:
96
-
97
49
Convert the hex number B to decimal.
98
-
Answer:
99
-
100
-
If reading the byte 0x21 as a number, what decimal number would it mean?
101
-
Answer:
102
-
103
-
If reading the byte 0x21 as an ASCII character, what character would it mean?
104
-
Answer:
105
-
106
-
If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
107
-
Answer:
108
-
109
-
If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
110
-
Answer:
111
-
112
-
If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be?
113
-
Answer:
114
-
115
50
Answer: 11
116
51
117
52
If reading the byte 0x21 as a number, what decimal number would it mean?
@@ -121,10 +56,10 @@ If reading the byte 0x21 as an ASCII character, what character would it mean?
121
56
Answer: !
122
57
123
58
If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
124
-
Answer:
59
+
Answer: almost black
125
60
126
61
If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
127
-
Answer: purple but I found the answer on google not from the PDF.
62
+
Answer: purple
128
63
129
64
If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be?
0 commit comments