Skip to content

Commit 3e44d1c

Browse files
Boshra MahmoudiBoshra Mahmoudi
authored andcommitted
part 2 number system
1 parent 19015e5 commit 3e44d1c

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

number-systems/Part-2.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@ 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 there is just one 1 in a binary number, then it is a power of 2. This is because each bit represents a power of 2, so if there is just one 1 bit in a binary number, the value represents a power of 2.
1111

1212
Q17: If reading the byte 0x21 as an ASCII character, what character would it mean?
13-
Answer:
13+
Answer: !
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 represents 33, which is in the range of 0–255 from dark to light. This value represents a very dark grey.
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: three one-byte =>
20+
AA | 00 | FF ==> AA : 10 * 16 + 10 * 1 = 170 | 00 : 0 * 16 + 0 * 1 = 0 | FF : 15 * 16 + 15 * 1 = 255
21+
so it reperesnt 170, 0, 255
2022

2123
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:
24+
Answer: AA => 170 Red, 00 => 0 green , FF : 255 is blue

0 commit comments

Comments
 (0)