Skip to content

Commit eb79b7a

Browse files
committed
Validate against the answers
1 parent fc9b260 commit eb79b7a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

number-systems/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ Which is larger: 00100 or 01011?
1717
Answer: 01011 because 01011 = 11 whereas 00100 = 4
1818

1919
What is 10101 + 01010?
20-
Answer: 32 because 10101 = 21 and 01010 = 10
20+
Answer: ~~32 because 10101 = 21 and 01010 = 10~~ 11111 (31 in decimal)
2121

2222
What is 10001 + 10001?
23-
Answer: 34 because 10001 = 17
23+
Answer: ~~34 because 10001 = 17~~ 100010 (34 in decimal)
2424

2525
What's the largest number you can store with 4 bits, if you want to be able to represent the number 0?
2626
Answer: 15; 0b0000
@@ -32,10 +32,10 @@ How many bits would you need in order to store the numbers between 0 and 3 inclu
3232
Answer: 2
3333

3434
How many bits would you need in order to store the numbers between 0 and 1000 inclusive?
35-
Answer: 10
35+
Answer: 10 (Actual answer: 10, but you'd have 23 spare values, so you can actually store between 0 and 1023 with 10 bits.)
3636

3737
How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
38-
Answer: A binary number is a power of two if it has exactly one 1 bit, or equivalently if n & (n - 1) == 0 (for n > 0)
38+
Answer: A binary number is a power of two if it has exactly one 1 bit, or equivalently if n & (n - 1) == 0 (for n > 0) (Actual answer: Test that it has exactly one 1.)
3939

4040
Convert the decimal number 14 to hex.
4141
Answer: E
@@ -56,10 +56,10 @@ If reading the byte 0x21 as an ASCII character, what character would it mean?
5656
Answer: !
5757

5858
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: black
59+
Answer: ~~black~~ Dark grey
6060

6161
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: Red + (No Green) + (Blue) ≈ A bright purple
62+
Answer: Red + (No Green) + (Blue) ≈ A bright purple (Actual answer: Purple)
6363

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

0 commit comments

Comments
 (0)