@@ -5,7 +5,11 @@ Do not convert any binary numbers to decimal when solving a question unless the
55The goal of these exercises is for you to gain an intuition for binary numbers. Using tools to solve the problems defeats the point.
66
77Convert the decimal number 14 to binary.
8- Answer: 1000 + 0100 + 0010 = 1110 = 8 + 4 + 2 = 14
8+ Answer: 2^4 = 16,
9+ so I should start with 2^3 = 8 (1000),
10+ 14 - 8 = 6,
11+ 6 - 2^2 (0100)= 2 (0010)
12+ 14 = 1000 + 0100 + 0010 = 1110
913
1014Convert the binary number 101101 to decimal:
1115Answer: 2^5 + 2^3 + 2^2 + 2^0 = 32 + 8 + 4 + 1 = 45
@@ -14,7 +18,7 @@ Which is larger: 1000 or 0111?
1418Answer: 1000 is larger because 1000 has more places
1519
1620Which is larger: 00100 or 01011?
17- Answer: 01011 is larger because it has more places
21+ Answer: 01011 is larger because the leading number is 01 instead of 00, and they both have 5 bits.
1822
1923What is 10101 + 01010?
2024Answer: 11111
@@ -23,10 +27,10 @@ What is 10001 + 10001?
2327Answer: 100010
2428
2529What's the largest number you can store with 4 bits, if you want to be able to represent the number 0?
26- Answer: 1111
30+ Answer: 1111 = 15
2731
2832How many bits would you need in order to store the numbers between 0 and 255 inclusive?
29- Answer: 2^8 = 256. So, we need 7 bits. b0000000 = 0, and b1111111 = 255
33+ Answer: 2^8 = 256. So, we need 8 bits. b00000000 = 0, and b11111111 = 255
3034
3135How many bits would you need in order to store the numbers between 0 and 3 inclusive?
3236Answer: 2 bits as 00 = 0, and 11 = 3
0 commit comments