Difference between revisions of "CSC231 Final Exam Fall 2017"

From dftwiki3
Jump to: navigation, search
Line 63: Line 63:
 
<br />
 
<br />
  
* Write a bash script called '''finalFact.sh''' that contains a ''recursive'' function called '''fact''' that will compute the '''factorial''' of a number passed on the command line.  Call this script '''funcMoodleChallenge.sh'''.
+
* Write a bash script called '''finalFact.sh''' that contains a ''recursive'' function called '''fact''' that will compute the '''factorial''' of a number passed on the command line.   
* Examples of how it should work:
 
 
<br />
 
<br />
 
   
 
   
Line 85: Line 84:
 
==Question ==
 
==Question ==
 
<br />
 
<br />
In the header of your program, explain the program returns 0 for fact(10).  If you are not sure, suggest the most likely reason.
+
In the header of your program, explain why the program returns 0 for fact(10).  If you are not sure, suggest the most likely reason.
 
<br />
 
<br />
 
==Submission==
 
==Submission==
Line 95: Line 94:
 
Answer the questions in the Problem 4 section of the final exam on Moodle.
 
Answer the questions in the Problem 4 section of the final exam on Moodle.
 
<br />
 
<br />
 
+
=Problem 5=
 +
<br />
 +
Assume that we want to create a 16-bit floating point format similar to the IEEE floating point format we have seen in class.
 +
This format uses all the rules we have studied as being intrinsic to the 32-bit format, including the ''exceptions'', and the ''biased exponent''.
 +
<br />
 +
In this 16-bit format, the sign, exponent, and mantissa are defined as follows:
 +
<br />
 +
* The most significant bit is the sign bit: 0 for positive, 1 for negative
 +
* The next 4 bits are the exponent.  The stored exponent is offset by a ''bias'' relative to the true exponent.
 +
* The lower 11 bits are the mantissa, and we assume that the mantissa contains a hidden 1.  All numbers, as with the 32-bit format, are normalized as 1.bbb...bbb x 2^(true exponent).
 +
<br />
 +
==Questions==
 +
<br />
 +
Section 5 of the Final Exam section on Moodle contains several questions relating to this format.
 +
<br />
 +
<br />
 
=Solutions=
 
=Solutions=
 
==Bash Script==
 
==Bash Script==

Revision as of 15:40, 11 December 2017


...