Skip to content

Commit 3dc3b9f

Browse files
committed
Answering all the questions
1 parent 407b010 commit 3dc3b9f

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

number-systems/README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,60 +6,75 @@ 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 > 0111 as 1000 represents 8 and 0111 is 7.
1518

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

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

2227
What is 10001 + 10001?
2328
Answer:
29+
1 00010 (carrying out 1)
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+
1111 in Binary and 15 in Decimal
2734

2835
How many bits would you need in order to store the numbers between 0 and 255 inclusive?
2936
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
3338

3439
How many bits would you need in order to store the numbers between 0 and 1000 inclusive?
3540
Answer:
41+
2 bits
3642

3743
How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
3844
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.
3946

4047
Convert the decimal number 14 to hex.
41-
Answer:
48+
Answer: 0xE
4249

4350
Convert the decimal number 386 to hex.
4451
Answer:
52+
182
4553

4654
Convert the hex number 386 to decimal.
4755
Answer:
56+
902
4857

4958
Convert the hex number B to decimal.
5059
Answer:
60+
11
5161

5262
If reading the byte 0x21 as a number, what decimal number would it mean?
5363
Answer:
64+
33
5465

5566
If reading the byte 0x21 as an ASCII character, what character would it mean?
5667
Answer:
68+
! - exclamation mark
5769

5870
If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
5971
Answer:
72+
A very Dark shade of Grey.
6073

6174
If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
6275
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)
6377

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

0 commit comments

Comments
 (0)