This is the first homework for CS170 (Section 002). Unlike labs, you are expected to do homeworks on your own. Future homeworks will involve programming, but this first one is mostly written, and you should turn it in on paper.
Note this homework refers to some examples from Section 1 of our lecture notes.
Like all work for this class, the Emory Honor Code applies. You should do your own work on all problems, unless you are explicitly instructed otherwise. If you get stuck or have questions, ask your instructor or a TA for help.
(Recall, for Computer Science `kilo' means a number that is a power of 2 that is close to 1000.)
Use this tool to find the binary number for the following decimal numbers:
What is the resulting decimal number ?
(Compare your answer with the Exploratory stuff example in the following lecture note: click here )
The encoding method used to represent the alphabet is known as the ASCII code (American Standard Code for Information Interchange).
Use the ASCII code table to find out what text is encoded by the following sequence of (decimal) byte codes?
72 101 108 108 111 32 101 118 101 114 121 111 110 101 32 33 |
|
Also for each of these types, how many bits do we need to store such a value?
Trace out each step, like in the example with 28 and 36.
Initially: A = 56 B = 91 After 1 iteration: A = B = After 2 iterations: A = B = After 3 iterations: A = B = After 4 iterations: A = B = After 5 iterations: A = B = After 6 iterations: A = B = After 7 iterations: A = B = After 8 iterations: A = B = After 9 iterations: A = B = After 10 iterations: A = B = (use as many rows as needed) |
R = 47; Q = 0; D = 9; as long as R ≥ D do { R = R − D; Q = Q + 1; } |
Trace out each step, like in the Euclid example: (20 pts)
Initially: R = 47 Q = 0 After 1 iteration: R = Q = After 2 iterations: R = Q = After 3 iterations: R = Q = After 4 iterations: R = Q = After 5 iterations: R = Q = After 6 iterations: R = Q = After 7 iterations: R = Q = (use as many rows as needed) |
What does this algorithm accomplish ? (10 pts)
In other words:
Hint: it has something to do with division.