Difference between revisions of "CSC103 Homework 1 solutions 2012f"
Line 7: | Line 7: | ||
</tanbox> | </tanbox> | ||
− | + | ||
=Question #1= | =Question #1= | ||
Line 138: | Line 138: | ||
Ehnv = E5 and ( not E3 ) | Ehnv = E5 and ( not E3 ) | ||
− | + | ||
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> | <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> | ||
Latest revision as of 06:33, 2 October 2012
--D. Thiebaut 07:53, 11 September 2012 (EDT)
This homework assignment was due on Tusday Sept. 25th, at 9:00 a.m (pushed back because of Mountain Day). Each problem was worth 1 point. The Smith grade scale is used to convert points into a letter grade. 4 points corresponds to A, 3.7 to A-, 3.3 to B+, 3.0 to B, etc.
Question #1
Count in binary and write down first 33 numbers of the series. In other words, complete the second column in the list below.
Decimal Binary 1 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000 9 1001 10 1010 11 1011 12 1100 13 1101 14 1110 15 1111 16 10000 17 10001 18 10010 19 10011 20 10100 21 10101 22 10110 23 10111 24 11000 25 11001 26 11010 27 11011 28 11100 29 11101 30 11110 31 11111 32 100000
Perform the following additions in binary:
10011 + 10011 = 100110
10111 + 00110 = 11101
Question #2
Assume that we live in a universe where everybody only has 4 fingers. Just as we did in class with a system of 2 digits (binary code), we invente a system for counting with only 4 digits: 0, 1, 2, and 3.
- Write the first 20 numbers of a system with 4 digits. To help you out, I will start with the first 7 numbers of the series:
0 1 2 3 10 11 12 13 20 21 22 23 30 31 32 33 100 101 102 103
Continue on until you have 20 consecutive numbers of a system in base 4.
Question #3
Perform the addition of the following numbers in base 4.
1002 + 2301 = 3303
2222 + 3301 = 12123
Question #4
Assume that we have several boolean expressions, labeled E1 to E6:
- E1: is a Smith student
- E2: is a senior
- E3: likes vanilla
- E4: has class on Monday
- E5: is a Hampshire student
- E6: is on the crew team
What is the boolean expression that is a combination of E1, E2, E3, E4, and/or E5, and the logic operators AND, OR, and NOT, that will be True whenever I find somebody on campus who is a Hamshire College student and who does not like vanilla?
We only need to worry about E1, E5, and E3. Some of you may have only used E5 and E3. I counted both correct.
Let's call our solution expression as Ehnv (Hampshire-Not-Vanilla)
E1 E5 E3 Ehnv F F F F F F T F F T F T (Not Smith, Hampshire, doesn't like vanilla) F T T F T F F F T F T F T T F T (Smith & Hampshire, doesn't like vanilla) T T T F
Ehnv = ( ( not E1 ) and E5 and ( not E3 ) ) or ( E1 and E5 and ( not E3 ) )
If you use only E3 and E5, you get
E5 E3 Ehnv F F F F T F T F T (Hampshire, doesn't like vanilla) T T F
Ehnv = E5 and ( not E3 )