Difference between revisions of "CSC231 Final Exam 2010"
Line 10: | Line 10: | ||
<onlydft> | <onlydft> | ||
− | =Problem #1: Debugging Utility Functions= | + | =Problem #1: Recursive GCD= |
+ | |||
+ | The following algorithm can be used to find the greatest common denominator, or ''GCD''. The GCD of two integers ''m'' and ''n'' is the largest integer that divides both of them with a remainder of 0. The GCD of 5 and 6 is 1. The GCD of 10 and 12 is 2. The GCD of 12 and 20 is 4. | ||
+ | |||
+ | int gcd(int m, int n) { | ||
+ | if ((m % n) == 0) | ||
+ | return n; | ||
+ | else | ||
+ | return gcd(n, m % n); | ||
+ | } | ||
+ | |||
+ | The % sign is the modulo operator. | ||
+ | |||
+ | Implement this algorithm in assembly using a recursive function called '''gcd'''. Make it compute and output the gcd of (5, 6), (10, 12), and (20, 30). | ||
+ | |||
+ | Call your program final1.asm and submit it as follows: | ||
+ | |||
+ | submit final final1.asm | ||
+ | |||
+ | |||
+ | |||
+ | =Problem #2: Debugging Utility Functions= | ||
==Part 1== | ==Part 1== | ||
Line 125: | Line 146: | ||
=Submission= | =Submission= | ||
− | Submit only one program for all parts. Call it | + | Submit only one program for all parts. Call it final2.asm, and submit it as follows: |
− | submit final | + | submit final final2.asm |
</onlydft> | </onlydft> |
Revision as of 13:30, 12 December 2010
This final exam is take-home. It is open-books, open-notes, and open-Web. It is due a week after it is made available, at 12:00 p.m. on Monday December 20, 2010.
You cannot discuss the details of this exam with anyone except your instructor. The TAs are not allowed to help you out in any way. No question will be answered in person after 12:00 a.m. on 12/13/10. Instead, if you have questions regarding the exam, send them via email to thiebaut@cs.smith.edu, and the question and its answer will be broadcast back to the hole class via email. The exam is given under the rules of the Smith College Honor Code.
Make sure you reference all work/resources you use in your documentation.