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
+19-4Lines changed: 19 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,60 +6,75 @@ The goal of these exercises is for you to gain an intuition for binary numbers.
6
6
7
7
Convert the decimal number 14 to binary.
8
8
Answer:
9
+
1110
9
10
10
11
Convert the binary number 101101 to decimal:
11
12
Answer:
13
+
45
12
14
13
15
Which is larger: 1000 or 0111?
14
16
Answer:
17
+
1000 > 0111 as 1000 represents 8 and 0111 is 7.
15
18
16
19
Which is larger: 00100 or 01011?
17
20
Answer:
21
+
01011 > 00100
18
22
19
23
What is 10101 + 01010?
20
24
Answer:
25
+
11111
21
26
22
27
What is 10001 + 10001?
23
28
Answer:
29
+
1 00010 (carrying out 1)
24
30
25
31
What's the largest number you can store with 4 bits, if you want to be able to represent the number 0?
26
32
Answer:
33
+
1111 in Binary and 15 in Decimal
27
34
28
35
How many bits would you need in order to store the numbers between 0 and 255 inclusive?
29
36
Answer:
30
-
31
-
How many bits would you need in order to store the numbers between 0 and 3 inclusive?
32
-
Answer:
37
+
8 bits
33
38
34
39
How many bits would you need in order to store the numbers between 0 and 1000 inclusive?
35
40
Answer:
41
+
2 bits
36
42
37
43
How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
38
44
Answer:
45
+
Every binary number is made from sums of powers of 2, but a number is a power of 2 itself if its binary representation has exactly one "1" and all the other bits are 0.
39
46
40
47
Convert the decimal number 14 to hex.
41
-
Answer:
48
+
Answer: 0xE
42
49
43
50
Convert the decimal number 386 to hex.
44
51
Answer:
52
+
182
45
53
46
54
Convert the hex number 386 to decimal.
47
55
Answer:
56
+
902
48
57
49
58
Convert the hex number B to decimal.
50
59
Answer:
60
+
11
51
61
52
62
If reading the byte 0x21 as a number, what decimal number would it mean?
53
63
Answer:
64
+
33
54
65
55
66
If reading the byte 0x21 as an ASCII character, what character would it mean?
56
67
Answer:
68
+
! - exclamation mark
57
69
58
70
If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
59
71
Answer:
72
+
A very Dark shade of Grey.
60
73
61
74
If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
62
75
Answer:
76
+
A bright purple ( Red=170 Strong Red, Green is 0 and Blue =255 is maximum value for Blue so Blue and Red make purple)
63
77
64
78
If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be?
0 commit comments