Skip to content

Commit fff7fc3

Browse files
committed
Number Systems
1 parent 407b010 commit fff7fc3

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

number-systems/README.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,61 +5,62 @@ Do not convert any binary numbers to decimal when solving a question unless the
55
The goal of these exercises is for you to gain an intuition for binary numbers. Using tools to solve the problems defeats the point.
66

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

1011
Convert the binary number 101101 to decimal:
11-
Answer:
12+
Answer: 45
1213

1314
Which is larger: 1000 or 0111?
14-
Answer:
15+
Answer: 1000
1516

1617
Which is larger: 00100 or 01011?
17-
Answer:
18+
Answer: 01011
1819

1920
What is 10101 + 01010?
20-
Answer:
21+
Answer: 11111
2122

2223
What is 10001 + 10001?
23-
Answer:
24+
Answer: 100010
2425

2526
What's the largest number you can store with 4 bits, if you want to be able to represent the number 0?
26-
Answer:
27+
Answer: 15
2728

2829
How many bits would you need in order to store the numbers between 0 and 255 inclusive?
29-
Answer:
30+
Answer: 8
3031

3132
How many bits would you need in order to store the numbers between 0 and 3 inclusive?
32-
Answer:
33+
Answer: 2
3334

3435
How many bits would you need in order to store the numbers between 0 and 1000 inclusive?
35-
Answer:
36+
Answer: 10
3637

3738
How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
38-
Answer:
39+
Answer: A binary number is a power of two if it has exactly one bit set to 1.
3940

4041
Convert the decimal number 14 to hex.
41-
Answer:
42+
Answer: E
4243

4344
Convert the decimal number 386 to hex.
44-
Answer:
45+
Answer: 182
4546

4647
Convert the hex number 386 to decimal.
47-
Answer:
48+
Answer: 902
4849

4950
Convert the hex number B to decimal.
50-
Answer:
51+
Answer: 11
5152

5253
If reading the byte 0x21 as a number, what decimal number would it mean?
53-
Answer:
54+
Answer: 33
5455

5556
If reading the byte 0x21 as an ASCII character, what character would it mean?
56-
Answer:
57+
Answer: !
5758

5859
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:
60+
Answer: Dark gray
6061

6162
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:
63+
Answer: Purple
6364

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

0 commit comments

Comments
 (0)