CS 1401, Exam #4, MW 12-1:20 version

Date: Wednesday, November 27, 2013
Name (please type legibly, ideally in block letters): ______________________________________________________________________

On November 27, 1895, Alfred Nobel signed his last will and testament in which he used is fortune to set up Nobel Prizes for the best scientific discoveries. In 1895, there was no computer science, so Nobel Prizes are not given to computer scientists:-(

1. Imagine that the Nobel Prize committee decides to award prizes for computing, and you are a member of the Nobel Prize committee deciding on a prize for computing. Describe three people who you would give this prize to, and explain why they are the most deserving.

2a. The more people cite the scientist's work, the bigger the impact of this scientist on the development of science. In precise terms, the impact of a scientist can be measured by the average number of citations of his/her papers. Write a method named citation that, given the total number of citations c and the total number of papers p, returns the average number of citations per paper. In your method, throw an exception to take into account situations when the number of papers is zero.

2b. Throw an additional exception when the number of papers is unrealistically large -- e.g., larger than 10,000.

2c. Call (invoke) your method citation in the main method to compute the impact of a scientist. Use try-catch in your main method to catch the two exceptions and print the corresponding error messages. On an example when a scientist wrote 10 papers that were cites 120 times, race, step by step, how the computer will perform the needed computations, and check that the result is indeed correct.

3a. Define a class Scientist whose objects are different programmers. The description of each scientist should contain his/her name, the number of publications, and the number of citations. Your class should contain a constructor method, get- and set-methods, and a method for computing the scientist's impact.

3b. Use your class in the main method to define a new object vonNeumann of type Scientist; assume that he write 100 papers and got 2,000 citations. Compute and print his productivity. As the old documents were declassified, it turned out that he had 100 more papers and 1,000 more citations. Use the set-methods to update the values in the corresponding object, and compute and print his updated impact.

3c. Trace your program step-by-step.

4a. Write a method that, given an array of scientists, returns the name of the scientists who has the largest impact.

4b. Test your method in the main program, by applying it to two scientists: vonNeumann and Newton; assume that Newton wrote 50 papers and was cited 10,000 times. Trace the resulting code.

4c. Describe general rules for black-box and white-box program testing.

5a. Write a method that, given the array publications of number of papers written by different faculty from the department, returns the total number of papers published by the department.

5b. In the main method, apply your code to the array consisting of two values 3,000 and 10,000; trace your code, step-by-step, and check that your method returns the correct number 3,000 + 10,000 = 13,000.

6. Give at least two reasons why plagiarism (i.e., copying someone else's work without a proper attribution) is not ethical. For example, is it fair to the author of the original work? Is it fair to the department who hires a person with many publications thinking that he/she has come up with these ideas him/herself? Is it fair to the students who will ask this cheater to supervise their research -- thinking that he/she has a lot of research experience? Give detailed explanations.