Skip to content

Commit 39135bf

Browse files
committed
COmpleting exercises about bit , decimal and hexadecimal logic.
1 parent b5089a2 commit 39135bf

1 file changed

Lines changed: 28 additions & 21 deletions

File tree

number-systems/README.md

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,60 +6,67 @@ 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-
9+
1110
1010
Convert the binary number 101101 to decimal:
1111
Answer:
12-
12+
45
1313
Which is larger: 1000 or 0111?
1414
Answer:
15-
15+
1000 = 8
16+
0111 = 7
17+
1000 is larger
1618
Which is larger: 00100 or 01011?
1719
Answer:
18-
20+
00100 = 4
21+
01011 = 11
22+
01011 is larger
1923
What is 10101 + 01010?
2024
Answer:
21-
25+
10101 = 21
26+
01010 = 10
27+
21+10 = 31
2228
What is 10001 + 10001?
2329
Answer:
24-
30+
10001 = 17
31+
17+ 17 = 34
2532
What's the largest number you can store with 4 bits, if you want to be able to represent the number 0?
2633
Answer:
27-
34+
1111 = 15
2835
How many bits would you need in order to store the numbers between 0 and 255 inclusive?
2936
Answer:
30-
37+
11111111 = 8 bits
3138
How many bits would you need in order to store the numbers between 0 and 3 inclusive?
3239
Answer:
33-
40+
11 = 2 bits
3441
How many bits would you need in order to store the numbers between 0 and 1000 inclusive?
3542
Answer:
36-
43+
1111101000 = 10 bits = 1024
3744
How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
3845
Answer:
39-
46+
if the bit have only '1' in it, means i'ts a power of two, if have multiple '1' that's not.
4047
Convert the decimal number 14 to hex.
41-
Answer:
48+
Answer: E
4249

4350
Convert the decimal number 386 to hex.
44-
Answer:
51+
Answer: 0x182
4552

4653
Convert the hex number 386 to decimal.
47-
Answer:
54+
Answer:902
4855

4956
Convert the hex number B to decimal.
50-
Answer:
57+
Answer: B = 11
5158

52-
If reading the byte 0x21 as a number, what decimal number would it mean?
59+
If reading the byte 0x21 as a number, what decimal number would it mean?
5360
Answer:
54-
61+
33
5562
If reading the byte 0x21 as an ASCII character, what character would it mean?
56-
Answer:
63+
Answer: 0x21 = "!"
5764

5865
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:
66+
Answer:Dark Grey
6067

6168
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:
69+
Answer: Purple
6370

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

0 commit comments

Comments
 (0)