Difference between revisions of "CSC111 Final Exam 2010"

From dftwiki3
Jump to: navigation, search
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<onlydft>
 
<onlydft>
 
 
=Final Exam=
 
=Final Exam=
  
 
<bluebox>
 
<bluebox>
This exam is given '''under the rules of the honor code.'''  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 answer any questions relating to this exam.  No pair-programming is allowed.   
+
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 answer any questions relating to this exam.  No pair-programming is 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.
 
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.
Line 10: Line 9:
 
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 Friday, May 7th, at '''4:00 p.m.'''  You will need to submit the exam using the '''submit''' command, similarly to the way you have submitted homework assignment this past semester.
+
The '''exam is due on Friday, May 7th, at 4:00 p.m.'''  You will need to submit the exam using the '''submit''' command, similarly to the way you have submitted homework assignment this past semester.
 
</bluebox>
 
</bluebox>
  
==Problem #1: Temperatures in the UK==
+
 
 +
=Problem #1: Temperatures in the UK=
 
:[[Image:HistoricStationDataUKWeather.png | right | 200px]]
 
:[[Image:HistoricStationDataUKWeather.png | right | 200px]]
 
You have to write a program that reads weather data from the Web, process the data, and output the answers to several questions.
 
You have to write a program that reads weather data from the Web, process the data, and output the answers to several questions.
Line 21: Line 21:
 
The Web site http://www.metoffice.gov.uk/climate/uk/stationdata/ keeps records of temperatures for '''37''' towns/cities of the UK for the past few years, going back in some cases to 1853.
 
The Web site http://www.metoffice.gov.uk/climate/uk/stationdata/ keeps records of temperatures for '''37''' towns/cities of the UK for the past few years, going back in some cases to 1853.
  
Your assignment will deal with reading the data from this site, for all the cities, gathering some statistics, and outputting information in a nice, human readable format.
+
Your assignment deals with reading the data from this site, for all the cities, gathering some statistics, and outputting information in a nice, human readable format.
  
 
===Accessing the Data===
 
===Accessing the Data===
Line 27: Line 27:
 
* The main address for the data is that of the Met-Office site:  http://www.metoffice.gov.uk/climate/uk/stationdata/   
 
* The main address for the data is that of the Met-Office site:  http://www.metoffice.gov.uk/climate/uk/stationdata/   
  
* Note: in case the metoffice.gov.uk were to go down during the exam period, the data has been replicated at http://cs.smith.edu/~111c/climate/uk/stationdata/, and you can use this Smith-based Url instead.  The data files are the same at both places.
+
* Note: in case the metoffice.gov.uk were to go down during the exam period, the data has been replicated at http://cs.smith.edu/~dthiebaut/UKTemperatures/, and you can use this Smith-based Url instead.  The data files are the same at both places.
  
 
* A file name is associated with each city or town.  For example, the city of '''Aberporth''' is associated with '''aberporthdata.txt''', and the record of the weather data for '''Aberporth''' is stored at URL http://www.metoffice.gov.uk/climate/uk/stationdata/aberporthdata.txt
 
* A file name is associated with each city or town.  For example, the city of '''Aberporth''' is associated with '''aberporthdata.txt''', and the record of the weather data for '''Aberporth''' is stored at URL http://www.metoffice.gov.uk/climate/uk/stationdata/aberporthdata.txt
Line 249: Line 249:
 
: 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 outputs all the data required to support your answer, all in a humanly readable format.
+
: Make sure your program prints out all the data required to support your answer, all in a readable format.
  
 
==Documentation==
 
==Documentation==
Line 265: Line 265:
 
==Advice==
 
==Advice==
  
* A program that runs is worth more than one that doesn't.  Even if the one that doesn't attempts to run computation aimed at answering all the questions.
+
;A program that runs is worth more than one that doesn't.   
 +
:Even if the one that doesn't attempts to run computation aimed at answering all the questions.
 +
 
 +
;Start small! 
 +
:If it makes life easier for you to make your program read the temperature data from a file or from a string rather than from the Web, then use this approach first while you are developing the code.  You can switch at the end to making your program read information from the Web.
 +
 
 +
; Concentrate on the easy questions first.
 +
: There is nothing sacred about the order in which the questions above are ordered.  The order in which the program outputs the results is important, though.
  
* Start small
+
; Submit regularly. 
 +
:Whenever you have a version of your program that works, just submit it.  Every submission overwrites the previous version submitted.
  
* Concentrate on the easy questions firstThere is nothing sacred about the order in which the questions above are ordered.  The order in which the program outputs the results is important, though.
+
; Be resourceful. 
 +
:There won't be any extension due to failure of the computer, either beowulf or yoursPython 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.
  
* Submit regularly.  Whenever you have a version of your program that works, just submit it.  Every submission overwrites the previous version submitted.
+
=Problem #2=
  
* 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.
+
Write a program called final2.py that contains a '''recursive''' function called '''minmax()''' which returns the smallest and largest elements of a list.
  
* Good luck!
+
Example '''main()''' program:
 +
 
 +
<br />
 +
<source lang="python">
 +
 
 +
def main():
 +
    A = [ 1, 10, 20, 3, 2, -1, -10, 5, 5, 5, 5 ]
 +
    low, high = minmax( A )
 +
    print "smallest item =", low, " largest item = ", high
 +
    # will print
 +
    # smallest item = -10 largest item = 20
 +
 
 +
    A = [ 1 ]
 +
    low, high = minmax( A )
 +
    print "smallest item =", low, " largest item = ", high
 +
    # will print
 +
    # smallest item = 1 largest item = 1
 +
 +
    A = [ ]
 +
    low, high = minmax( A )
 +
    print "smallest item =", low, " largest item = ", high
 +
    # will print
 +
    # smallest item = None largest item = None
 +
 
 +
</source>
 +
 
 +
==Requirements==
 +
 
 +
The function '''minmax()''' must be recursive.
 +
 
 +
==Submission==
 +
 
 +
Submit your program as follows:
 +
 
 +
    submit final final2.py
 +
 
 +
 
 +
 
 +
; Good luck!
 +
 
 +
<br />
 
</onlydft>
 
</onlydft>
 
<br />
 
<br />
Line 285: Line 334:
 
<br />
 
<br />
 
<br />
 
<br />
<br />
+
[[Category:CSC111]][[Category:Exams]]
[[Category:CSC111]]
 

Latest revision as of 11:50, 2 September 2017


...