[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Links]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.4.2 API]
[EIJ]
[CS152 2000F]
[CS153 2004S]
Distributed: Friday, 24 September 2004
Due: 11:00 a.m., Friday, 1 October 2004
No extensions.
This page may be found online at
http://www.cs.grinnell.edu/~rebelsky/Courses/CS152/2004F/Exams/exam.01.html.
Contents
There are four problems on the exam. Some problems have subproblems. Each full problem is worth twenty-five points. The point value associated with a problem does not necessarily correspond to the complexity of the problem or the time required to solve the problem.
This examination is open book, open notes, open mind, open computer, open Web. However, it is closed person. That means you should not talk to other people about the exam. Other than that limitation, you should feel free to use all reasonable resources available to you. As always, you are expected to turn in your own work. If you find ideas in a book or on the Web, be sure to cite them appropriately.
Although you may use the Web for this exam, you may not post your answers
to this examination on the Web (at least not until after I return exams
to you). And, in case it's not clear, you may not ask others (in person,
via email, via IM, by posting a please help
message, or in any
other way) to put answers on the Web.
This is a take-home examination. You may use any time or times you deem appropriate to complete the exam, provided you return it to me by the due date.
This exam is likely to take you about four to six hours, depending on
how well you've learned topics and how fast you work. You should not
work more than eight hours on this exam. Stop at eight hours and
write There's more to life than CS
and you will earn at
least 80 points on this exam. I would appreciate it if
you would write down the amount of time each problem takes. I expect that
someone who has mastered the material and works at a moderate rate should
have little trouble completing the exam in a reasonable amount of time.
Since I worry about the amount of time my exams take, I will give two
points of extra credit to the first two people who honestly report that
they've spent at least five hours on the exam or completed the exam.
(At that point, I may then change the exam.)
You must include both of the following statements on the cover sheet of the
examination. Please sign and date each statement. Note that the
statements must be true; if you are unable to sign either statement,
please talk to me at your earliest convenience. You need not reveal
the particulars of the dishonesty, simply that it happened. Note also that
inappropriate assistance
is assistance from (or to) anyone
other than Professor Rebelsky (that's me).
1. I have neither received nor given inappropriate assistance on this examination.
2. I am not aware of any other students who have given or received inappropriate assistance on this examination.
Because different students may be taking the exam at different times,
you are not permitted to discuss the exam with anyone until after I
have returned it. If you must say something about the exam, you are
allowed to say This is among the hardest exams I have ever
taken. If you don't start it early, you will have no chance of
finishing the exam.
You may also summarize these policies.
You may not tell other students which problems you've finished.
You may not tell other students how long you've spent on the exam.
You must both answer all of your questions electronically and turn in a printed version of your exam. That is, you must write all of your answers on the computer, print them out, number the pages, put your name on every page, and hand me the printed copy. You must also email me a copy of your exam by copying your exam and pasting it into an email message. Put your answers in the same order as the problems. Please write your name at the top of each sheet of the printed copy. Doing so will earn you two points of extra credit.
In many problems, I ask you to write code. Unless I specify otherwise in a problem, you should write working code and include examples that show that you've tested the code.
Just as you should be careful and precise when you write code and documentation, so should you be careful and precise when you write prose. Please check your spelling and grammar. Since I should be equally careful, the whole class will receive one point of extra credit for each error in spelling or grammar you identify on this exam. I will limit that form of extra credit.
I will give partial credit for partially correct answers. You ensure the best possible grade for yourself by emphasizing your answer and including a clear set of work that you used to derive the answer.
I may not be available at the time you take the exam. If you feel that a question is badly worded or impossible to answer, note the problem you have observed and attempt to reword the question in such a way that it is answerable. If it's a reasonable hour (before 10 p.m. and after 8 a.m.), feel free to try to call me in the office (269-4410) or at home (236-7445).
I will also reserve time at the start of classes next week to discuss any general questions you have on the exam.
a. Explain, in your own words, the concept of encapsulation. You are free to look for definitions on the Web, but you should make sure to cite them and to restate them in your own words.
b. Give three ways that Java encourages or supports encapsulation.
a. Create a class, Student, that has five fields to represent information about a student.
Your class should provide appropriate accessors and constructors, but no mutators.
b. Create two classes, CompareStudentByName and CompareStudentByID, that both implement java.util.Comparator. You should make sure to read the documentation for Comparators to determine what methods to implement and what those methods should do.
a. Create a Fraction interface that includes the following methods:
long getNumerator() - get the numerator.
long getDenominator() - get the denominator.
double doubleValue() - convert the fraction to a
floating point number.
long longValue() - convert the fraction to the nearest integer.
String toString() - convert the fraction to a string of
the form num/denom.
Fraction add(Fraction f) - add a fraction to the current
fraction.
This should not modify the value of the current fraction.
Fraction multiply(Fraction f) - multiply the current fraction by
another fraction.
This should not modify the value of the current fraction.
Fraction subtract(Fraction f) - subtract a fraction from the
current fraction.
This should not modify the value of the current fraction.
Fraction divide(Fraction f) - divide the value of the current
fraction by f.
This should not modify the value of the current fraction.
b. Write a class, BigFraction, that implements Fraction with a java.math.BigInteger as both numerator and denominator.
Suppose you were responsible for introducing Java to someone who was just starting 152 and had just finished 151. Explain, in a few paragraphs, how you would describe the key issues in programming Java.
These are some of the questions students have asked about the exam and my answers to those questions.
Here you will find errors of spelling, grammar, and design that students have noted. Remember, each error found corresponds to a point of extra credit for everyone. I limit such extra credit to five points.
first[MLP, 1 point]
classmakes Java grumpy. [LA, 1 point]
Thursday, 23 September 2004 [Samuel A. Rebelsky]
Friday, 24 September 2004 [Samuel A. Rebelsky]
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Links]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.4.2 API]
[EIJ]
[CS152 2000F]
[CS153 2004S]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Wed Dec 8 10:36:31 2004.
The source to the document was last modified on Fri Oct 1 10:00:44 2004.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS152/2004F/Exams/exam.01.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby