Skip to content

Commit 1ec33d2

Browse files
author
l
committed
split numbers qs
1 parent 65f1c24 commit 1ec33d2

4 files changed

Lines changed: 46 additions & 35 deletions

File tree

expect/number-systems/Part-1.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"answers": [0, 1110, 45, 1000, "01011", 11111, 100010, 15, 8, 2, "(10$|10[^0-9])", "E", 182, 902, 11, 33]}

expect/number-systems/README.json

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,62 +4,51 @@ Do not convert any binary numbers to decimal when solving a question unless the
44

55
The goal of these exercises is for you to gain an intuition for binary numbers. Using tools to solve the problems defeats the point.
66

7+
The answers to these questions should be a number, either in binary, hex, or decimal.
8+
79
Q1: Convert the decimal number 14 to binary.
8-
Answer:
10+
Answer:
911

1012
Q2: Convert the binary number 101101 to decimal:
11-
Answer:
13+
Answer:
1214

1315
Q3: Which is larger: 1000 or 0111?
14-
Answer:
16+
Answer:
1517

1618
Q4: Which is larger: 00100 or 01011?
17-
Answer:
19+
Answer:
1820

1921
Q5: What is 10101 + 01010?
20-
Answer:
22+
Answer:
2123

2224
Q6: What is 10001 + 10001?
23-
Answer:
25+
Answer:
2426

2527
Q7: What's the largest number you can store with 4 bits, if you want to be able to represent the number 0?
26-
Answer:
28+
Answer:
2729

2830
Q8: How many bits would you need in order to store the numbers between 0 and 255 inclusive?
29-
Answer:
31+
Answer:
3032

3133
Q9: How many bits would you need in order to store the numbers between 0 and 3 inclusive?
32-
Answer:
34+
Answer:
3335

3436
Q10: How many bits would you need in order to store the numbers between 0 and 1000 inclusive?
35-
Answer:
36-
37-
Q11: How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
38-
Answer:
37+
Answer:
3938

40-
Q12: Convert the decimal number 14 to hex.
41-
Answer:
39+
Q11: Convert the decimal number 14 to hex.
40+
Answer:
4241

43-
Q13: Convert the decimal number 386 to hex.
44-
Answer:
45-
46-
Q14: Convert the hex number 386 to decimal.
47-
Answer:
48-
49-
Q15: Convert the hex number B to decimal.
50-
Answer:
51-
52-
Q16: If reading the byte 0x21 as a number, what decimal number would it mean?
53-
Answer:
42+
Q12: Convert the decimal number 386 to hex.
43+
Answer:
5444

55-
Q17: If reading the byte 0x21 as an ASCII character, what character would it mean?
56-
Answer:
45+
Q13: Convert the hex number 386 to decimal.
46+
Answer:
5747

58-
Q18: 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:
48+
Q14: Convert the hex number B to decimal.
49+
Answer:
6050

61-
Q19: 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:
51+
Q15: If reading the byte 0x21 as a number, what decimal number would it mean?
52+
Answer:
6353

64-
Q20: If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be?
65-
Answer:
54+
Q16: Continues in Part-2

number-systems/Part-2.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Do not use any tools or programming to solve these problems. Work it out yourself by hand, and fill in the answers.
2+
3+
Do not convert any binary numbers to decimal when solving a question unless the question explicitly tells you to.
4+
5+
The goal of these exercises is for you to gain an intuition for binary numbers. Using tools to solve the problems defeats the point.
6+
7+
The answers to these questions will require a bit of explanation, not just a simple answer.
8+
9+
Q16: How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
10+
Answer:
11+
12+
Q17: If reading the byte 0x21 as an ASCII character, what character would it mean?
13+
Answer:
14+
15+
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:
17+
18+
Q19: If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
19+
Answer:
20+
21+
Q20: If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be?
22+
Answer:

0 commit comments

Comments
 (0)