Difference between revisions of "CSC111 Final Exam 2018"

From dftwiki3
Jump to: navigation, search
Line 22: Line 22:
 
* Write a python program that reads this type of CSV file, and outputs this information:
 
* Write a python program that reads this type of CSV file, and outputs this information:
 
::* The most popular major.  In this case both the first major and second major count.  For example, if the 3 lines shown below, CSC is the most frequent major.
 
::* The most popular major.  In this case both the first major and second major count.  For example, if the 3 lines shown below, CSC is the most frequent major.
+
<br />
  Flo72@hampshire.edu,RUL,CSC,
+
:::::<source lang="text">
  Anna10@hampshire.edu,CSC,ECO,
+
Flo72@hampshire.edu,RUL,CSC,
  Monty77@smith.edu,CSC,RUL,,
+
Anna10@hampshire.edu,CSC,ECO,
 
+
Monty77@smith.edu,CSC,RUL,,
 +
</source>
 +
<br /> 
 
::* The most popular minor
 
::* The most popular minor
 
::* The most popular double major or double majors.  In the 3 lines above, CSC-RUL is the most common double-major, and should be listed as CSC-RUL, and not RUL-CSC, since CSC is before RUL, alphabetically.  
 
::* The most popular double major or double majors.  In the 3 lines above, CSC-RUL is the most common double-major, and should be listed as CSC-RUL, and not RUL-CSC, since CSC is before RUL, alphabetically.  
 
::* Which email domain is most frequent in the file.
 
::* Which email domain is most frequent in the file.
 
* Example of output:
 
* Example of output:
 
+
<br />
GEO
+
:::::<source lang="text">
ITL
+
GEO
CSC-ECO
+
ITL
smith.edu
+
CSC-ECO
+
smith.edu
 +
</source>
 +
<br />
 
* Your program should be able to handle a file where nobody has a second major or minor.  In this case the output for the double-major and minor should be "---".   
 
* Your program should be able to handle a file where nobody has a second major or minor.  In this case the output for the double-major and minor should be "---".   
 
: Example:
 
: Example:
+
<br />
GEO
+
:::::<source lang="text">
---
+
GEO
---
+
---
smith.edu
+
---
+
smith.edu
 +
</source>
 +
<br />
 
* In case two or more majors (or minors, or double-majors, or emails) have the same largest count, then your program should output all of them on the same line, separated by spaces, and listed alphabetically:
 
* In case two or more majors (or minors, or double-majors, or emails) have the same largest count, then your program should output all of them on the same line, separated by spaces, and listed alphabetically:
 
: Example
 
: Example
+
<br />
GEO ITL
+
:::::<source lang="text">
CSC ICO PHY
+
GEO ITL
CSC-ECO ECO-MTH
+
CSC ICO PHY
hampshire.edu smith.edu umass.edu
+
CSC-ECO ECO-MTH
+
hampshire.edu smith.edu umass.edu
 +
</source>
 +
<br />
 
* Here is an example of the interaction with a user who mistypes the name of the file:
 
* Here is an example of the interaction with a user who mistypes the name of the file:
+
<br />
> hello
+
:::::<source lang="text">
> this is an invalid file name
+
> hello
> test2.csv  
+
> this is an invalid file name
+
> test2.csv  
RUL
+
 
---
+
RUL
CSC-RUL ECO-RUL
+
---
amherst.edu hampshire.edu mtholyoke.edu smith.edu umass.edu
+
CSC-RUL ECO-RUL
+
amherst.edu hampshire.edu mtholyoke.edu smith.edu umass.edu
 +
</source>
 +
<br />
 
:: 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.

Revision as of 15:50, 28 April 2018

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



...