Difference between revisions of "CSC111 Final Exam 2018"

From dftwiki3
Jump to: navigation, search
 
(32 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 11:39, 26 April 2018 (EDT)
 
[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 11:39, 26 April 2018 (EDT)
 
----
 
----
<onlydft>
+
 
 
<bluebox>
 
<bluebox>
This is the final exam for CSC111, Spring 2018.<br />
+
* This is the final exam for CSC111, Spring 2018.<br />
The deadline to submit your programs is '''May 11, 4 p.m.'''  Please make note of the different submission time of day.
+
* The '''deadline to submit your programs is May 11, 4 p.m.'''  Please make note of the different submission time of day.
This exam has to be done individually, and is given under the rules of the [https://www.smith.edu/sao/handbook/socialconduct/honorcode.php Smith Honor Code].  You are not allowed to work in pairs on any part of this exam.<br />
+
* This exam has to be done individually, and is given under the rules of the [https://www.smith.edu/sao/handbook/socialconduct/honorcode.php Smith Honor Code].  You are not allowed to work in pairs on any part of this exam.<br />
You are not allowed to discuss any of the details of this exam, except with your instructor, D. Thiebaut<br />
+
* You are not allowed to discuss any of the details of this exam, except with your instructor, D. Thiebaut<br />
You can ask questions on '''Piazza''' only.  Do not post code on Piazza.  If you think you may be giving away some of the solution when expressing your question on Piazza, make it private.<br />
+
* You can ask questions on '''Piazza''' only.  Do not post code on Piazza.  If you think you may be giving away part of the solution when expressing your question on Piazza, make it private.
The TAs and lab instructor will not be available to help out on this exam.<br />
+
* Do not answer questions posted by others on Piazza; only your instructor is allowed to answer questions.
You have to do the debugging on your own.<br />
+
* The TAs and lab instructor will not be available to help out on this exam.<br />
Two problems will be auto-graded on Moodle.  The autograder is setup to only run your program on a small subset of cases, without generating a grade.  You must test your program thoroughly to make sure it will pass all the tests that will be used to fully evaluate your program.
+
* You have to do the debugging of your code on your own.<br />
 
+
* Two problems will be auto-graded on Moodle.  The autograder is setup to only run your program on a small subset of cases, without generating a grade.  You must test your program thoroughly to make sure it will pass all the tests that will be used to fully evaluate your program.
 +
* A whole letter-grade will be removed for poorly documented code.
 +
* Make sure you list the resources you used to generate your code in your program header, if these resources are other than our textbook, or the notes and/or programs generated in class.
 +
* Submit your code as soon as you have something running, in case you run into problems with your laptop, with the network, or with other unforeseen technical failures.
 +
* All four problems are worth the same weight: 25% of the final grade.
 
</bluebox>
 
</bluebox>
 +
<br />
 +
__TOC__
 +
<br />
 +
<onlydft>
 
<br />
 
<br />
 
=Problem 1=
 
=Problem 1=
 
* Write a program that prompts the user for the name of a CSV file that contains the email addresses of 5-college students along with their major or double-major, and, possibly, their minor.
 
* Write a program that prompts the user for the name of a CSV file that contains the email addresses of 5-college students along with their major or double-major, and, possibly, their minor.
* Here is a typical file:
+
* Below is a typical file.  Note that the first line will always contain the headers.
 
:::::<source lang="text">
 
:::::<source lang="text">
 
email, major1, major2, minor
 
email, major1, major2, minor
Line 37: Line 45:
 
Flo72@hampshire.edu,RUL,CSC,
 
Flo72@hampshire.edu,RUL,CSC,
 
Anna10@hampshire.edu,CSC,ECO,
 
Anna10@hampshire.edu,CSC,ECO,
Monty77@smith.edu,CSC,RUL,,
+
Monty77@smith.edu,CSC,RUL,
 
</source>
 
</source>
 
<br />   
 
<br />   
Line 67: Line 75:
 
:::::<source lang="text">  
 
:::::<source lang="text">  
 
GEO ITL
 
GEO ITL
CSC ICO PHY
+
CSC EAL PHY
 
CSC-ECO ECO-MTH
 
CSC-ECO ECO-MTH
 
hampshire.edu smith.edu umass.edu
 
hampshire.edu smith.edu umass.edu
Line 76: Line 84:
 
:::::<source lang="text">  
 
:::::<source lang="text">  
 
> hello
 
> hello
> this is an invalid file name
+
> blabla.txt
 
> test2.csv  
 
> test2.csv  
  
Line 87: Line 95:
 
:: Note that the program <font color="red">prints a blank line after getting a valid file name and before outputting the result.</font>
 
:: Note that the program <font color="red">prints a blank line after getting a valid file name and before outputting the result.</font>
 
* Submit your program in the '''Final Exam PB 1''' section on Moodle.
 
* Submit your program in the '''Final Exam PB 1''' section on Moodle.
 +
<br />
 +
==Additional Information==
 +
<br />
 +
* Lines that do not contain a '@' character should be considered invalid.
 
<br />
 
<br />
 
=Problem 2: An Orange Tree =
 
=Problem 2: An Orange Tree =
Line 92: Line 104:
 
[[Image:fractalTreeWithOranges2018.png|center|500px]]
 
[[Image:fractalTreeWithOranges2018.png|center|500px]]
 
<br />
 
<br />
* Modify the fractal tree program shown below so that it will generate an exact replica of the tree shown above.  You should not reproduce the text in the image;  '''just the tree, its colors, and its fruit.'''
+
* Modify the fractal tree program shown below so that it will generate an exact replica of the tree shown above.  You should not reproduce the large grey text in the image;  '''just the tree, its colors, its fruit, and the yellow box with your name in it'''.
* Call your program '''final2.py''' and the image '''final2.jpg''' or '''final2.png'''.  Submit both to the same URL indicated in the Final Examp PB 2 section on Moodle.
+
* Call your program '''final2.py''' and the image '''final2.jpg''' or '''final2.png'''.  Submit both to the Final Examp PB 2 section on Moodle.
 
* Note: To change the color of a '''line''' with the graphics library, you should use the '''setOutline()''' method rather than the '''setFill()''' method.  To change the '''width''' of a line, you can use the '''setWidth()''' method.
 
* Note: To change the color of a '''line''' with the graphics library, you should use the '''setOutline()''' method rather than the '''setFill()''' method.  To change the '''width''' of a line, you can use the '''setWidth()''' method.
 
* I used only 3 colors to generate the tree above: "green", "blue", and "brown".
 
* I used only 3 colors to generate the tree above: "green", "blue", and "brown".
 +
* The oranges have radius 10.
 
<br />
 
<br />
 
::<source lang="python">
 
::<source lang="python">
Line 206: Line 219:
 
Run your program on the following image, and submit a copy of the processed image under the name '''finalb.jpg''' or '''finalb.png'''.  Add a rectangle with your name inside it, so that the image can be easily identified.  Failure to add the name will result in losing some valuable points.
 
Run your program on the following image, and submit a copy of the processed image under the name '''finalb.jpg''' or '''finalb.png'''.  Add a rectangle with your name inside it, so that the image can be easily identified.  Failure to add the name will result in losing some valuable points.
 
<br />
 
<br />
<center>[[File:SmithCollegeStainedGlass.png|300px]]<br />(click on the image twice to get to the real full size image)</center>
+
<center>[[File:SmithCollegeStainedGlass.gif|300px]]<br />(click on the image twice to get to the real full size image)</center>
 
<br />
 
<br />
  
 
==Implementation Details==
 
==Implementation Details==
 
<br />
 
<br />
* The circular part of the mask should be as big as the width or the height of the image, whichever is smaller
+
* The circular part of the mask should be as large as the width or the height of the image, whichever is smaller
 
* The mask color '''must''' be white.
 
* The mask color '''must''' be white.
 
* The resulting image should be fully white outside the circular mask.
 
* The resulting image should be fully white outside the circular mask.
 
* The amount of  softness inside the circle is up to you.  But there should be some softening of the colors!  The  pixel at the very center of the foggy image should retain its original color.   
 
* The amount of  softness inside the circle is up to you.  But there should be some softening of the colors!  The  pixel at the very center of the foggy image should retain its original color.   
* Your JES program should only ask the user for a file name, nothing else.
+
* Your graphic program should only ask the user for a file name, nothing else.
 
* If you need help capturing the final image, please visit [http://www.take-a-screenshot.org/ this page].
 
* If you need help capturing the final image, please visit [http://www.take-a-screenshot.org/ this page].
 
* You may find these functions useful...
 
* You may find these functions useful...
Line 254: Line 267:
 
<br />
 
<br />
 
<br />
 
<br />
Write a program containing a recursive function, that prompts the user for a list of integers, and prints out "True" if there are two numbers in the list that are consecutive and have the same value, and it prints "False" otherwise.
+
Write a program called '''final4.py''' containing a recursive function similar to the functions we created in class, using Dave and Gru as example.  Your program will prompt the user for a list of integers, and will print "True" if there are two numbers in the list that are consecutive and have the same value, and it prints "False" otherwise.
 
<br />
 
<br />
Your program must use a recursive function to determine if the there exist two consecutive numbers that have the same value.  Programs that do not contain a recursive solution will get 0/100.
+
Your program <font color="magenta">'''must use a recursive function'''</font> to determine if the there exist two consecutive numbers that have the same value.  Programs that solve the problem using an iterative loop, and not using recursion will automatically get 0/100.
 
<br />
 
<br />
 
Examples of interactions with the program:
 
Examples of interactions with the program:
Line 262: Line 275:
 
  ==== RESTART: final4.py ====
 
  ==== RESTART: final4.py ====
 
  > [ ]
 
  > [ ]
 
+
 
  False
 
  False
 
  >>>  
 
  >>>  
 +
 
  ==== RESTART: final4.py ====
 
  ==== RESTART: final4.py ====
 
  > [ 100 ]
 
  > [ 100 ]
 
+
 
  False
 
  False
 
  >>>  
 
  >>>  
 +
 
  ==== RESTART: final4.py ====
 
  ==== RESTART: final4.py ====
 
  > [ 100, 2 ]
 
  > [ 100, 2 ]
 
+
 
  False
 
  False
 
  >>>  
 
  >>>  
 +
 
  ==== RESTART: final4.py ====
 
  ==== RESTART: final4.py ====
 
  > [ 34, 34 ]
 
  > [ 34, 34 ]
 
+
 
  True
 
  True
 
  >>>  
 
  >>>  
 +
 
  ==== RESTART: final4.py ====
 
  ==== RESTART: final4.py ====
 
  > [ 1, 2, 3, 4, 1, 2, 3, 4 ]
 
  > [ 1, 2, 3, 4, 1, 2, 3, 4 ]
 
+
 
  False
 
  False
 
  >>>  
 
  >>>  
 +
 
  ==== RESTART: final4.py ====
 
  ==== RESTART: final4.py ====
 
  > [ 1, 2, 3, 4, 5, 5 ]
 
  > [ 1, 2, 3, 4, 5, 5 ]
 
+
 
  True
 
  True
 
  >>>  
 
  >>>  
 +
 
  ==== RESTART: final4.py ====
 
  ==== RESTART: final4.py ====
 
  > [ 1, 2, 3, 4, 4, 5, 6, 7 ]
 
  > [ 1, 2, 3, 4, 4, 5, 6, 7 ]
 
+
 
  True
 
  True
 
  >>>  
 
  >>>  
 +
  
 
==Main program==
 
==Main program==
 
<br />
 
<br />
Below is what your main program should look like.  The '''lookFor2()''' function should be ''recursive''.
+
Below is what your main program should look like.  You simply need to add a recursive '''lookFor2()''' function and document the code. The '''lookFor2()''' function must be ''recursive''.
 
<br />
 
<br />
 
::<source lang="python">
 
::<source lang="python">
  
 
def main():
 
def main():
     bananas = eval(input( "> " ) )
+
     bananas = eval( input( "> " ) )
 
     print()
 
     print()
 
     success = lookFor2( bananas )
 
     success = lookFor2( bananas )
Line 310: Line 330:
 
      
 
      
 
</source>
 
</source>
 +
==Additional Information==
 +
<br />
 +
* You cannot use the "in" operator in your recursive function to test if an item is inside the list.
 +
<br />
 
==Submission==
 
==Submission==
 
<br />
 
<br />
 
* Submit your program to the Final PB 4 section on Moodle.
 
* Submit your program to the Final PB 4 section on Moodle.
  
 +
<br />
 +
<br />
 +
=Information Released After the Deadline=
 +
<br />
 +
===Problem 1===
 +
<br />
 +
The first program was tested with several files:
 +
:test0.csv
 +
email, major1, major2, minor
 +
:test1.csv
 +
email, major1, major2, minor
 +
Flo872@hampshire.edu,RUL,,
 +
Joe999@smith.edu,ECO,,
 +
Anna33@amherst.edu,CSC,,
 +
Mana00@mtholyoke,EAS,,
 +
:test2.csv
 +
email, major1, major2, minor
 +
Flo872@hampshire.edu,RUL,ECO,
 +
Joe999@smith.edu,ECO,RUL,
 +
Anna33@amherst.edu,CSC,RUL,
 +
Mana00@mtholyoke.edu,EAS,,
 +
Annya@umass.edu,RUL,CSC,
 +
:test3.csv
 +
email, major1, major2, minor
 +
Flo872@smith.edu,RUL,,
 +
Joe999@smith.edu,RUL,,
 +
Anna33@smith,RUL,,
 +
Mana00@smith.edu,RUL,,
 +
Annya@smith.edu,RUL,,
 +
 +
* There was also a test where an invalid file name was provided to the program.
 +
* The grade was automatically set to 65/100 if the program crashed on any of the input files.
 +
* Points were removed for lack of documentation, or for not using several functions.
 +
 +
<br />
 +
===Problem 4===
 +
<br />
 +
Problem 4 was tested with several lists:
 +
[ ]
 +
[ 1 ]
 +
[ 1, 2 ]
 +
[ 3, 3 ]
 +
[ 2, 3, 4, 5, 6, 7, 8, 9 ]
 +
[ 2, 3, 2, 3, 2, 3, 2, 3 ]
 +
[ 2, 3, 4, 5, 6, 7, 8, 8 ]
 +
[ 2, 3, 4, 5, 2, 3, 4, 5 ]
 +
<br />
 +
* The grade was automatically set to 65/100 if the program crashed on any of the input files.
 +
* Points were removed for lack of documentation, or for solutions that used iteration (for-loop) in the function.
 +
 +
<br />
 +
<br />
 
</onlydft>
 
</onlydft>
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
 +
 +
 +
[[Category:CSC111]][[Category:Exam]]

Latest revision as of 12:35, 1 June 2018

D. Thiebaut (talk) 11:39, 26 April 2018 (EDT)


  • This is the final exam for CSC111, Spring 2018.
  • The deadline to submit your programs is May 11, 4 p.m. Please make note of the different submission time of day.
  • This exam has to be done individually, and is given under the rules of the Smith Honor Code. You are not allowed to work in pairs on any part of this exam.
  • You are not allowed to discuss any of the details of this exam, except with your instructor, D. Thiebaut
  • You can ask questions on Piazza only. Do not post code on Piazza. If you think you may be giving away part of the solution when expressing your question on Piazza, make it private.
  • Do not answer questions posted by others on Piazza; only your instructor is allowed to answer questions.
  • The TAs and lab instructor will not be available to help out on this exam.
  • You have to do the debugging of your code on your own.
  • Two problems will be auto-graded on Moodle. The autograder is setup to only run your program on a small subset of cases, without generating a grade. You must test your program thoroughly to make sure it will pass all the tests that will be used to fully evaluate your program.
  • A whole letter-grade will be removed for poorly documented code.
  • Make sure you list the resources you used to generate your code in your program header, if these resources are other than our textbook, or the notes and/or programs generated in class.
  • Submit your code as soon as you have something running, in case you run into problems with your laptop, with the network, or with other unforeseen technical failures.
  • All four problems are worth the same weight: 25% of the final grade.




...