Difference between revisions of "CSC231 Final Exam 2012"

From dftwiki3
Jump to: navigation, search
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
<onlydft>
+
 
<tanbox>
 
<tanbox>
 
 
Line 10: Line 10:
 
Make sure you reference all work/resources you use in your documentation.
 
Make sure you reference all work/resources you use in your documentation.
  
Files submitted past the deadline will not be graded.  <font color="red">No exceptions!</font>
+
Files submitted past the deadline will not be graded.  <font color="red">No exceptions!</font>.  If for some reason the server is down and you can't submit your files using the '''rsubmit''' command, email your file(s) to dthiebaut@smith.edu.
 
</tanbox>
 
</tanbox>
 
<br />
 
<br />
Line 30: Line 30:
 
** have 2 arrays A and B filled with floating point numbers, find the index where the index where A[i] + B[i] is max.
 
** have 2 arrays A and B filled with floating point numbers, find the index where the index where A[i] + B[i] is max.
 
-->
 
-->
 +
<onlydft>
 
=Problem #1 (2 points)=
 
=Problem #1 (2 points)=
  
Line 272: Line 273:
 
<br />
 
<br />
 
Let's take the first few lines of this collection of bytes and decode it:
 
Let's take the first few lines of this collection of bytes and decode it:
 
+
db 33, 3, 'd'
+
db 33, 3, 'd'
db 1, 1, 10
+
db 1, 1, 10
db 7, 3, 'd'
+
db 7, 3, 'd'
db 1, 6, 'beer'
+
db 1, 6, 'beer'
 
+
 
The first line indicates that there are 33 emoticons of length 3, containing the letter 'd' inside.    In other words, 33 ''(d)'' emoticons.  Notice that we do not keep track of the parentheses since all emoticons have parentheses around them (except for one; stay tuned!).  Then we have 1 sequence of 1 character that is 10; that's a \n.  That one is the exception to the rule, and does not have parentheses around it.  Then we have 7 more '(d)', followed by one '(beer)' emoticon.  You should be able to understand the remainder of the series.  The series of emoticons is terminated by a 0-byte.
 
The first line indicates that there are 33 emoticons of length 3, containing the letter 'd' inside.    In other words, 33 ''(d)'' emoticons.  Notice that we do not keep track of the parentheses since all emoticons have parentheses around them (except for one; stay tuned!).  Then we have 1 sequence of 1 character that is 10; that's a \n.  That one is the exception to the rule, and does not have parentheses around it.  Then we have 7 more '(d)', followed by one '(beer)' emoticon.  You should be able to understand the remainder of the series.  The series of emoticons is terminated by a 0-byte.
  
Line 286: Line 287:
 
Write a program that contains the array ''Art'' in its data section, and that reconstruct the original multiline collection of emoticons that can be directly pasted into Skype.
 
Write a program that contains the array ''Art'' in its data section, and that reconstruct the original multiline collection of emoticons that can be directly pasted into Skype.
  
In the header of your program indicate your computation for the compression factor for our example string.  For example, if the number of bytes defined by '''db''' is 5 times smaller than the length of the full string, then the compression ratio will be 20%.  Explain how you compute your answer.  What is the lower bound for the compression ratio?  In other words, what is the lowest possible value for the compression ratio?
+
In the header of your program indicate your computation for the compression factor for our example string.  For example, if the number of bytes defined by '''db''' is 5 times smaller than the length of the full string, then the compression ratio will be 20%.  Explain how you compute your answer.   
 +
 
 +
What is the''' lower bound''' for the compression ratio?  In other words, what is the lowest possible value for the compression ratio?
  
 
==Requirements==
 
==Requirements==
Line 302: Line 305:
  
 
     rsubmit final final1.asm
 
     rsubmit final final1.asm
 
  
 
=Problem #2 (1 point)=
 
=Problem #2 (1 point)=
Line 327: Line 329:
 
DNA sequences are ordered sequences of 4 different ''bases'' typically denoted A, C, G, and T.  A stands for ''adenosine'', C ''cytosine'', G ''guanine'', and T ''thymine''.
 
DNA sequences are ordered sequences of 4 different ''bases'' typically denoted A, C, G, and T.  A stands for ''adenosine'', C ''cytosine'', G ''guanine'', and T ''thymine''.
  
Since we only have 4 bases, we can represent each one by just 2 bits: 00 for ''A'', 01 for ''C'', 10 for ''G'' and ''11'' for T.  Your assignment is to write a program that takes an ASCII string representing a DNA sequence and to ''pack'' it into a collection of bytes.
+
Since we only have 4 bases, we can represent each one by just 2 bits: 00 for ''A'', 01 for ''C'', 10 for ''G'' and ''11'' for T.  Your assignment is to write a program that takes an ASCII string representing a DNA sequence and that ''packs'' it into a collection of bytes.
  
 
Here is an example:
 
Here is an example:
Line 373: Line 375:
  
 
   rsubmit final final3.asm
 
   rsubmit final final3.asm
 
  
 
</onlydft>
 
</onlydft>

Latest revision as of 19:24, 2 May 2017

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 11:59 p.m. on Wednesday December 19, 2012.

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/12/12. 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. Please start your message subject with "Final Exam Question"; this will help me find the messages more easily.

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.

Files submitted past the deadline will not be graded. No exceptions!. If for some reason the server is down and you can't submit your files using the rsubmit command, email your file(s) to dthiebaut@smith.edu.









...