Skip to content

Commit c28d0e4

Browse files
committed
add Part-2 task number systems
1 parent 4edc812 commit c28d0e4

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎number-systems/Part-2.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ The goal of these exercises is for you to gain an intuition for binary numbers.
77
The answers to these questions will require a bit of explanation, not just a simple answer.
88

99
Q16: How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
10-
Answer:
10+
Answer: If the binary number has only one bit value of 1, and the rest are values of 0, then it is a power of two. The value of 1 represent 1 multiplied by a 2 to the power of the corresponding position index (0,1,....).
1111

1212
Q17: If reading the byte 0x21 as an ASCII character, what character would it mean?
13-
Answer:
13+
Answer: The hexadecimal value of 21 correspond to the binary value of 00100001, which is the exclamation mark.
1414

1515
Q18: If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
16-
Answer:
16+
Answer: It would be a very dark grey colour because it is close to 0x00 which is black.
1717

1818
Q19: If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be?
19-
Answer:
19+
Answer: 170, 0, 255 ==> 0xAA -> 170, 0x00 -> 0, 0xFF -> 255. On byte is represented by 2 hexadecimal values in the sequence.
2020

2121
Q20: If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
22-
Answer:
22+
Answer: again, we would have a RGB(170, 0, 255), that is quite a lot of red, no green and full value of blue - it would be light purple.

0 commit comments

Comments
 (0)