Difference between revisions of "CSC231 Final Exam 2014"

From dftwiki3
Jump to: navigation, search
Line 2: Line 2:
 
----
 
----
 
<onlydft>
 
<onlydft>
 +
__TOC__
 +
<br />
 +
<bluebox>
 +
This Final Exam is to be done individually. It is given under the rules of Smith's Honor Code. You have access to all your class notes, solution programs made available for various labs and/or homework assignments, to the textbook, and to the Web. The exam must be submitted to Moodle before the last day of exam period, 19 Dec. 2014, at 4:00 p.m. No extensions will be granted. TAs cannot help with the final exam, in any way. Questions about this exam can be asked in class only, or on Piazza, at any time. You cannot post significant sections of code on Piazza or you will lose 15 points on your exam for every offense.
 +
</bluebox>
 +
<br />
 
=Problem 1=
 
=Problem 1=
 +
<br />
 
* What is the decimal value represented by 1001011 in U(5,2)?
 
* What is the decimal value represented by 1001011 in U(5,2)?
 
(answer = 18.75)
 
(answer = 18.75)
 +
<br />
 
=Problem 2=
 
=Problem 2=
 +
<br />
 
* What is 10000001 in A(4,3) format?
 
* What is 10000001 in A(4,3) format?
 
(answer -0.125)
 
(answer -0.125)
 +
<br />
 
=Problem 3=
 
=Problem 3=
 +
<br />
 
* Assume a floating point format of 9 bits: 1 sign bit, 1 4-bit exponent with a bias of 7, and a 4-bit mantissa (in this order).
 
* Assume a floating point format of 9 bits: 1 sign bit, 1 4-bit exponent with a bias of 7, and a 4-bit mantissa (in this order).
 
* What is the real number (in decimal) with this binary representation: 1 1000 0000  
 
* What is the real number (in decimal) with this binary representation: 1 1000 0000  
 
(answer -2)
 
(answer -2)
 +
<br />
 
=Problem 4=
 
=Problem 4=
 
<br />
 
<br />
Write an assembly language program that solves the Tours of Hanoi problem.  If you have forgotten what this problem is about, read the [http://en.wikipedia.org/wiki/Tower_of_Hanoi Wikipedia page on the subject].  A Python version of the program is available [[CSC231_hanoi.py|here]].
+
* How many different values of NaNs do we have in the 32-bit IEEE floating-point format?
 +
<br />
 +
=Problem 5=
 +
<br />
 +
* Write an assembly language program that solves the Tours of Hanoi problem.  If you have forgotten what this problem is about, read the [http://en.wikipedia.org/wiki/Tower_of_Hanoi Wikipedia page on the subject].  A Python version of the program is available [[CSC231_hanoi.py|here]].
  
Your program should use the 231Lib library to read an integer from the keyboard.  This number will represent the number of disks to move.  The three pegs are called A, B, and C, and the goal is to move ''N'' disk from A to B, using C as the temporary peg.
+
* Your program should use the 231Lib library to read an integer from the keyboard.  This number will represent the number of disks to move.  The three pegs are called A, B, and C, and the goal is to move ''N'' disk from A to B, using C as the temporary peg.
  
The output of the program should just be two uppercase letters per line, identifying the source and destination pegs for a move.
+
* The output of the program should just be two uppercase letters per line, identifying the source and destination pegs for a move.
  
Here is an example of how your program should work:
+
* Here is an example of how your program should work:
  
<source lang="text">
+
:::<source lang="text">
 
./hanoi
 
./hanoi
 
2
 
2
Line 31: Line 47:
 
C B
 
C B
 
</source>
 
</source>
The first 2 is the one entered by the user.  The program then prints a line-feed, then prints the number again, then another line feed.  In assembly this looks like this:
+
*The first 2 is the one entered by the user.  The program then prints a line-feed, then prints the number again, then another line feed.  In assembly this looks like this:
 
<br />
 
<br />
 
<source lang="asm">
 
<source lang="asm">
Line 41: Line 57:
 
</source>
 
</source>
 
<br />
 
<br />
You are free to implement your recursive moveDisk() function any way you wish.  In particular the passing of parameters is left up to you.  All that is important is the output of the moves, two letters per line, one space in between.
+
* You are free to implement your recursive moveDisk() function any way you wish.  In particular the passing of parameters is left up to you.  All that is important is the output of the moves, two letters per line, one space in between.
 
<br />
 
<br />
Submit your program to Moodle, in the Final Exam, Problem 4 section.
+
* Submit your program to Moodle, in the Final Exam, Problem 5 section.
  
 
</onlydft>
 
</onlydft>

Revision as of 21:13, 9 December 2014

--D. Thiebaut (talk) 15:02, 9 December 2014 (EST)



...