Skip to content

Commit 9e3afc7

Browse files
committed
number systems
1 parent f31ca13 commit 9e3afc7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

number-systems/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,60 +6,80 @@ The goal of these exercises is for you to gain an intuition for binary numbers.
66

77
Convert the decimal number 14 to binary.
88
Answer:
9+
1110
910

1011
Convert the binary number 101101 to decimal:
1112
Answer:
13+
45
1214

1315
Which is larger: 1000 or 0111?
1416
Answer:
17+
1000
1518

1619
Which is larger: 00100 or 01011?
1720
Answer:
21+
01011
1822

1923
What is 10101 + 01010?
2024
Answer:
25+
11111
2126

2227
What is 10001 + 10001?
2328
Answer:
29+
100010
2430

2531
What's the largest number you can store with 4 bits, if you want to be able to represent the number 0?
2632
Answer:
33+
15
2734

2835
How many bits would you need in order to store the numbers between 0 and 255 inclusive?
2936
Answer:
37+
8 bits
3038

3139
How many bits would you need in order to store the numbers between 0 and 3 inclusive?
3240
Answer:
41+
2 bits
3342

3443
How many bits would you need in order to store the numbers between 0 and 1000 inclusive?
3544
Answer:
45+
10 bits
3646

3747
How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
3848
Answer:
49+
A number that is a power of two in binary has exactly one bit set to 1.
3950

4051
Convert the decimal number 14 to hex.
4152
Answer:
53+
E
4254

4355
Convert the decimal number 386 to hex.
4456
Answer:
57+
182
4558

4659
Convert the hex number 386 to decimal.
4760
Answer:
61+
902
4862

4963
Convert the hex number B to decimal.
5064
Answer:
65+
11
5166

5267
If reading the byte 0x21 as a number, what decimal number would it mean?
5368
Answer:
69+
33
5470

5571
If reading the byte 0x21 as an ASCII character, what character would it mean?
5672
Answer:
73+
!
5774

5875
If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
5976
Answer:
77+
dark grey
6078

6179
If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
6280
Answer:
81+
purple
6382

6483
If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be?
6584
Answer:
85+
170, 0, 255

0 commit comments

Comments
 (0)