Difference between revisions of "CSC111 Final Exam 2011"

From dftwiki3
Jump to: navigation, search
Line 8: Line 8:
 
Questions can only be asked to your instructor, and only via email.  Email questions will be returned with an answer to the whole class.   
 
Questions can only be asked to your instructor, and only via email.  Email questions will be returned with an answer to the whole class.   
  
The '''exam is due on 12/22/11 at 4:00 p.m.'''  Any file received after this date will not be graded.  You will need to submit the exam using the '''rsubmit''' command, or using a [http://cs.smith.edu/~111a/submitFinal.htm submit Web page], similarly to the way you have submitted homework assignments  this past semester.
+
The '''exam is due on 12/22/11 at 4:00 p.m.'''  Any file received after this date will not be graded.  You will need to submit the exam using the '''rsubmit''' command, or using a [http://cs.smith.edu/~111a/submitFinal.htm submit Web page], similarly to the way you have submitted homework assignments  this past semester. If you are having problem with either one of these submission options, email your file(s) to me before the deadline, at dthiebau@smith.edu.
 +
 
 
</bluebox>
 
</bluebox>
  
 +
<br />
 +
<br />
 +
<bluebox>
 +
'''Important Note''': The lab of 12/15/11 will count for 1/3 point of this exam.  You will need to demonstrate that you have code one of the last two challenges of the lab to get the points.  You can work in pair during the lab, '''but not for the programming part which is explained below'''.
 +
</bluebox>
 
<br />
 
<br />
 
<br />
 
<br />
Line 222: Line 228:
 
import sys
 
import sys
  
BASEURL = "http://cs.smith.edu/~111c/climate/uk/stationdata/"
+
BASEURL = "http://cs.smith.edu/~111a/climate/uk/stationdata/"
  
 
def getMainList( url ):
 
def getMainList( url ):
Line 256: Line 262:
 
* Your program should print '''"Answer to Question 1"''', '''"Answer to Question 2"''', etc. for each question.
 
* Your program should print '''"Answer to Question 1"''', '''"Answer to Question 2"''', etc. for each question.
  
* All temperatures should be reported in degrees '''Fahrenheit''' (they are all in Celcius on the Web site).
+
* All temperatures should be reported in degrees '''Fahrenheit''' (they are all in Celcius on the original Web site).
  
 
;Question 1
 
;Question 1
: For which town (or towns) do we have the oldest recorded information?  Although we can get the answer by searching the table above, make your program figure out the answer.  If two or more towns have records for the same month and year, and these are the oldest on record, then output the name of each town.
+
: For which town (or towns) do we have the '''oldest''' recorded information?  Although we can get the answer by searching the table above, make your program figure out the answer.  If two or more towns have records for the same month and year, and these are the oldest on record, then output the name of each town.
  
 
: The output should be of the form: "the oldest observation was recorded in ''townname'' in ''month'' of ''year''"
 
: The output should be of the form: "the oldest observation was recorded in ''townname'' in ''month'' of ''year''"
  
 
;Question 2
 
;Question 2
: For which town or towns do we have the lowest temperature recorded?  Also output the month and year of the measurement.
+
: For which town or towns do we have the '''lowest''' temperature recorded?  Also output the month and year of the measurement.  
  
: The output should be of the form: ''the coldest temperature was recorded in ''townname'' in ''month'' of ''year''" where ''month'' is either Jan, Feb, Mar, Apr... Dec.  Numbers are not acceptable.  If the month is not specified, then simply output the year.
+
: The output should be of the form: ''the coldest temperature was recorded in ''townname'' in ''month'' of ''year''" where ''month'' is either Jan, Feb, Mar, Apr... Dec.  Numbers '''are not acceptable'''.  If the month is not specified in the file, then simply output the year.
  
 
;Question 3
 
;Question 3
: For which town or towns do we have the highest temperature recorded? Also output the month and year of the observation.
+
: For which town or towns do we have the '''highest''' temperature recorded? Also output the month and year of the observation.
  
 
: Same output format as for Question 2
 
: Same output format as for Question 2
  
 
;Question 4
 
;Question 4
: For which town do we have the biggest difference in temperature?  In other words, where did we record during the same year the largest difference between coldest and hottest temperature?
+
: For which town do we have the '''biggest difference''' in temperature?  In other words, where did we record the largest difference between coldest and hottest temperature?
  
 
: Same output format type as for Question 2.
 
: Same output format type as for Question 2.
  
 
;Question 5
 
;Question 5
: If we are interested in retiring in the U.K., and are looking for the place with the most sun exposure per year, which city should be picked?  Make sure you document your program well and explain how you compute the answer.
+
: If we are interested in retiring in the U.K., and are looking for the place with the''' most sun exposure''' per year, which city should be picked?  Make sure you document your program well and explain how you compute the answer.
  
 
;Question 6
 
;Question 6
: Was the average temperature in the U.K. colder during the first half of the 20th century (1900 to 1999), or hotter?
+
: Was the '''average temperature''' in the U.K. colder during the first half of the 20th century (1900 to 1999), or hotter?
  
 
: Make sure your program prints out all the data required to support your answer, all in a readable format.
 
: Make sure your program prints out all the data required to support your answer, all in a readable format.
Line 288: Line 294:
 
==Documentation==
 
==Documentation==
  
 +
* Document your program!
 +
* Document your program!
 
* Document your program!
 
* Document your program!
 
* The solution programs for past homework assignments are good examples of fine documentation.
 
* The solution programs for past homework assignments are good examples of fine documentation.
Line 298: Line 306:
 
:or use this submit page: http://cs.smith.edu/~111a/submitFinal.htm
 
:or use this submit page: http://cs.smith.edu/~111a/submitFinal.htm
  
* Reminder: Programs submitted after 4:00 p.m. on the due date will not be graded.  Also, if you submit a program before the due date, and submit it again after the due date, the date recorded will be the latest one, and hence your program will not be graded in this case.
+
* Reminder: Programs submitted after 4:00 p.m. on the due date will not be graded.  Also, if you submit a program before the due date, and submit it again after the due date, the date recorded will be the later one, and hence your program will not be graded in this case.
  
 
==Extra-Credits==
 
==Extra-Credits==
Line 318: Line 326:
  
 
; Be resourceful.   
 
; Be resourceful.   
:There won't be any extension due to failure of the computer, either beowulf or yours.  Python can run on all the various platforms available to you.  As long as the computer you are using can access the Web, you can write a program for the final.  In case beowulf is down on the last day of exam period, email your program to your instructor (thiebaut@cs.smith.edu) before the 4:00 p.m. deadline.
+
:'''There won't be any extension due to failure of the computer''', either '''beowulf''' or '''yours'''.  Python can run on all the various platforms available to you.  As long as the computer you are using can access the Web, you can write a program for the final.  In case beowulf is down on the last day of exam period, email your program to me (dthiebau@smith.edu) before the 4:00 p.m. deadline.
  
 
=Problem #2=
 
=Problem #2=
Line 327: Line 335:
  
 
===Behavior===
 
===Behavior===
* When the program starts, there are no fish in the aquarium
+
* When the program starts, the aquarium should be fully empty.
* Bubbles may rise from time to time (randomly) from the bottom of the tank, up to the surface.  Bubbles are simply white circles that climb up, with random horizontal movements as they climb.
+
* Bubbles will start rising from time to time (randomly) from the bottom of the tank, up to the surface.  Bubbles are simply white circles that climb up, with random horizontal movements as they climb (see image below).
  
* When the user clicks the mouse on the image of the aquarium (anywhere on the graphics image), the program displays two different fish, randomly picked from a collection of fish maintained by your program.  The fish are immobile and the user clicks on the one she wants to keep in the aquarium.  As soon as she has done so, the selected fish reappears at some other point of the aquarium and starts swimming.
+
* When the user clicks the mouse on the aquarium (anywhere on the graphics image), the program displays two different fish, randomly picked from a collection (at least 3) of fish maintained by your program.  The fish are immobile and the user clicks on the one she wants to keep in the aquarium.  As soon as she has done so, the selected fish reappears at some other point of the aquarium and starts swimming.
 
* Fish swim in a forward direction, i.e. toward the direction where their nose is pointing.
 
* Fish swim in a forward direction, i.e. toward the direction where their nose is pointing.
 
* When fish disappear on one side of the screen, '''they do not wrap around''' but reappear swimming from the exact place where they disappeared, but this time swimming in the opposite direction.  You will need a reverse image of the fish when it swims in the opposite direction.    See http://cs.smith.edu/~111a/index.html or [[Fish_for_an_Aquarium | this page]] for samples of fish images and reverse images.
 
* When fish disappear on one side of the screen, '''they do not wrap around''' but reappear swimming from the exact place where they disappeared, but this time swimming in the opposite direction.  You will need a reverse image of the fish when it swims in the opposite direction.    See http://cs.smith.edu/~111a/index.html or [[Fish_for_an_Aquarium | this page]] for samples of fish images and reverse images.
 
* Every so often fish will emit a bubble from their mouth.  This bubble, like the bubbles coming from the sand at the bottom of the tank, climb up to the surface with slight horizontal movements as they move.
 
* Every so often fish will emit a bubble from their mouth.  This bubble, like the bubbles coming from the sand at the bottom of the tank, climb up to the surface with slight horizontal movements as they move.
* Bubbles should start small, with a radius of, say, 2 or 3 pixels, and grow bigger as they climb up to the surface.
+
* Bubbles should start small, with a radius of, say, 2 or 3 pixels, and grow slightly bigger as they climb up to the surface.
  
 
===Getting fish and images in your 111a-xx Beowulf account===
 
===Getting fish and images in your 111a-xx Beowulf account===
  
* If you want to work in your beowulf account, you'll need to import fish and tank images into your account.  It's very simple to to so.  All you need is the url of the image you want, and then use the command '''wget''' to ''web-get'' the image in your account:
+
* If you want to work in your beowulf account, you'll need to '''getcopy''' the fish and tank images into your account.  It's very simple to to so.  
 +
 
 +
  getcopy Tank2.gif
 +
  getcopy fish16r.gif
 +
  getcopy fish16.gif
 +
  ...
 +
 
 +
;Note 1
 +
: the fishxxr.gif is the reverse image of fishxx.gif, for all xx numbers.
 +
;Note 2
 +
; the fish images start with a lower-case letter in the 111a account.  They start with an upper-case on the wiki.
 +
 
 +
* If you want to get other images from the Web to your beowulf account, all you need is the url of the image you want, and then use the command '''wget''' to ''web-get'' the image in your account:
  
 
* For example, assume the fish you want is at URL http://cs.smith.edu/dftwiki/images/9/9a/Fish16r.gif
 
* For example, assume the fish you want is at URL http://cs.smith.edu/dftwiki/images/9/9a/Fish16r.gif
* Then, at the Linux prompt, type the following command:
+
* Then, at the Linux prompt, in your 111a-xx account, type the following command:
  
 
   wget http://cs.smith.edu/dftwiki/images/9/9a/Fish16r.gif
 
   wget http://cs.smith.edu/dftwiki/images/9/9a/Fish16r.gif
Line 347: Line 367:
 
* and you should have a file called Fish16r.gif in your directory.
 
* and you should have a file called Fish16r.gif in your directory.
  
 +
===Programming===
  
===Programming===
+
* You must divide your program into two files.  The classes should be in one file called '''final2class.py''', and the main program should be called '''final2.py'''.
* You must divide your program into several files.  The classes should be in one file called '''final2class.py''', and the main program should be called '''final2.p'''.
 
 
* You must use classes to represent the fish, the bubbles, and the school of fish.  Bubbles should be represented as two circles, one with a white border, transparent, and the other one, smaller, inside the previous one, and white, as illustrated below:
 
* You must use classes to represent the fish, the bubbles, and the school of fish.  Bubbles should be represented as two circles, one with a white border, transparent, and the other one, smaller, inside the previous one, and white, as illustrated below:
 
<br />
 
<br />
Line 373: Line 393:
  
 
==Advice and Documentation==
 
==Advice and Documentation==
* Ditto as for Problem #1!
+
* Same advice  as for Problem #1!
  
 
<br />
 
<br />

Revision as of 08:40, 15 December 2011

Final Exam

This exam is given under the rules of the honor code at Smith College. It is open-books, open-notes, and open-Web. The work on this exam is to be done individually, and assistance from anybody other than the instructor is forbidden. TAs are not available to answer questions, and will be asked not to do so. Pair-programming is not allowed.

Any program section greater than a function used and taken from a Web site other than our CSC111 Web page should be cited in the header of your program, or the header of the function.

Questions can only be asked to your instructor, and only via email. Email questions will be returned with an answer to the whole class.

The exam is due on 12/22/11 at 4:00 p.m. Any file received after this date will not be graded. You will need to submit the exam using the rsubmit command, or using a submit Web page, similarly to the way you have submitted homework assignments this past semester. If you are having problem with either one of these submission options, email your file(s) to me before the deadline, at dthiebau@smith.edu.



Important Note: The lab of 12/15/11 will count for 1/3 point of this exam. You will need to demonstrate that you have code one of the last two challenges of the lab to get the points. You can work in pair during the lab, but not for the programming part which is explained below.




...