Announcements

Advanced Programming/Practicum
15-200: Sections A,B,C
Fall 2006


#26: 12/6/06
In-Class Progrmaming Exam #2: Linked List/Binary Search Tree
I have graded (and recorded the grades for) In-Class Programming Exam #2, on using Linked List and binary Search Trees. This semester, about 75% of the students scored 100% (last semester it was 78%). Recall that this exam is designed so that most students will score 100% on it, and once again (as seems to be the case every semester) the scores on Exam #1 exceeded the scores on Exam #2. (68% scored 100% on both exams; last semester it was 75%). Students used combinations of iterative and recursive solutions. The average time for submission was 37 minutes, with students spread out all over the curve (from 15 to 55 minutes). Of those students who didn't score 100%, 9 scored 50% and 6 scored 0%. Once again, a few students handed in incorrect solutions early (meaning that they didn't see the error in their output), one student cast a Comparable to a String (not a general solution: although the test comparables were string there was no guarantee of this), and a few students spent all their time on one problem and did not get to the second one.

If you believe that I have made a grading mistake, please come by during my office hours and we can examine the program you submitted.


#25: 12/4/06
Program #10
I have graded (and recorded the grades for) Program #10. The class average was about 28 (or about 93%; last semester the average was 96%). If you did not fill in the program or drop it off correctly, make sure you understand what to do before the next program is to be submitted; that might include a visit to my office hours.

After I return your graded work in class on Monday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., a program score of 28.5 is recorded as 29).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student programs: it makes my office messier, and you don't get the benefit of the feedback I wrote on the program.

Most students did well on the HashMap part. Some many students had errors in their load or add methods (more than in the JUnit tests). These weren't tested via JUnit, but were easily testable in the driver with the supplied input files; I apologize if I somehow miscommunicated that the JUnit test was the "only" testing instrument for this class.

Again, most students did well on the Kevin Bacon part. Some students did not implement the search completely correctly, failing on one or more of the three searches. Here "failed" means failed to find a minimum path through the graph.


#24: 11/28/06
In-Class Progrmaming Exam #1: Collection Classes
I have graded (and recorded the grades for) In-Class Programming Exam #1, on using Collection Classes. This semester, about 88% of the students scored 100% (last semester it was 90%). Recall that this exam is designed so that most students will score 100% on it. In past semesters it was combined with midterm written exams to compute "reasonable" midterm grades. About 70% of the students used Java 1.5 generics in their solutions. The average time for submission was 32 minutes, with most students finishing between 20-35 minutes. Of those students who didn't score 100%, 3 had coding mistakes, 1 failed to sort the states (the program's output didn't match the requirement; I'm sure the student could have corrected the problem if he/she had looked at the output closely), and 3 wrote solutions that had some element specific to the Parity machine (and thus wouldn't work generally).

I cannot return your solutions to you, but if you believe that I have made a grading mistake, please come by during my office hours and we can examine the program you submitted.


#23: 11/27/06
Program #9
I have graded (and recorded the grades for) Program #9. The class average was about 27 (or about 89%; last semester the average was 90%). If you did not fill in the program or drop it off correctly, make sure you understand what to do before the next program is to be submitted; that might include a visit to my office hours.

After I return your graded work in class on Monday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., a program score of 28.5 is recorded as 29).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student programs: it makes my office messier, and you don't get the benefit of the feedback I wrote on the program.

Heap: Too many students had problems writing either add or remove: it is fairly straightforward to transform these algorithms into methods. Many students did not write an iterator that returned values from highest to lowest priority (in fact, some used a Min-Heap instead of Max-Heap and got the priorities reversed). To do so is best accomplished by copying the heap and using remove on the copy for each call of next. An alternative approach is to copy all the heap values into an array/list, sort it (from lowest to highest priority, using the Comparator), and then traverse the sorted array/list backward (from highest to lowest priority).

Tree Statistics: Most students seemed to do well on this part. Many students did not estimate a formula for average height or search depth Both seem proportional to the logarithm of the number of nodes in the tree: the minimum height times some constant. A few programs ran very slowly.

Students split on the binary search tree problems from the upcoming in-class exam, either solving all/most of them or solving none/few of them. You may now share these solutions among yourselves: understanding them is better than trying to memorize them.


#22: 11/16/06
Quiz #9
I have graded (and recorded the grades for) Quiz #9. The class average was about 22 (or 87%; last semester's average was 88%). Look at your returned work carefully; if your score was below 18, you might want to review this quiz with me or a CA. Material similar to this will be on the first written exam.

After I return your graded work in class on Friday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., an exam score of 22.5 is recorded as 23).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student exams: it makes my office messier, and you don't get the benefit of the feedback I wrote on the quiz.

Here were some common mistakes:

  • Problem 1: Many students did not write the base case correctly. All you need is the null (and without it empty heaps won't work). Then you need to check the root value against its left and right children (doing this conditionally, as the children might not exist; if they don't exist, they pass this check by default). Finally, if the children are OK you must recursive check that the children subtrees also represent heaps. I took off .5 points for adding unneeded state and/or not comparing .value (which is where the ints are). Some students wrote overly complicated methods that were not symmetric in their use of left/right children.

  • Problem 2: Most students got all parts of this problem correct (more than any other problem on the quiz). Most parts were straight-forward. The delete question caused a few problems: some students rewrote the tree as a BST without that value, but not according to the remove method discussed in the notes (some students looked like they were re-heapifying, but this isn't a heap). Note the height is 4, not 5 (the height of a tree that just has a root is 0; height is the number of steps on the path from root to deepest descendant). Finally some students confused inorder and preorder, probably because I asked for these traversals in a different order than they appear in the notes: you need to connect the names with the kinds.

  • Problem 3: For the students who missed this problem, it was a combination of the order and structure properties: some students boxed 85 and then 50 instead of 85 and then 90. Other students did not reheapify correctly: they wrote a new heap, but the not one that results from applying the code to the data.. A few students wrote the array starting at index 0: the 2i and 2i+1 formulas don't work if i is 0 (there are other formulas that can account for this, but they are a bit more awkward).

  • Problem 4: Many students wrote the tree, either as an a non-equivalent expression (it did the operations in a different order: a+b+c does the first addition before the second, because of Java associativity laws) or one that actually computed a wrong value by performing operators in the wrong order. If you wrote an incorrect tree, but wrote its postfix traversal correctly for that tree, you got full traversal points. A number of students failed to answer the last question.

#21: 11/13/06
Program #8
I have graded (and recorded the grades for) Program #8. The class average was about 27 (or about 90%; last semester the average was 92%). If you did not fill in the program or drop it off correctly, make sure you understand what to do before the next program is to be submitted; that might include a visit to my office hours.

After I return your graded work in class on Monday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., a program score of 28.5 is recorded as 29).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student programs: it makes my office messier, and you don't get the benefit of the feedback I wrote on the program.

There were minor problems in all three parts (circular linked queue, linked priority queue, and linked map). There was no pattern to these errors, but often they related to iterators, but sometimes simpler operators failed to work correctly. A few students did not really use circular queues (with only a rear reference so all operators were O(1)), or put the values is the priority queue backwards, or didn't use header lists (in linked maps): I deducted points for these "mistakes", even if all the operations worked correctly otherwise. Also, in a few cases students returned references to entire list nodes (for operations like peek and remove) instead of the references stored in the .vaule fields inside these nodes.

For the JUnit test of the LinkedMap I took off approximately 1/2 point per failed test.


#20: 11/8/06
Quiz #8
Sorry for the delay. I have graded (and recorded the grades for) Quiz #8. The class average was about 21 (or about 85%: last semester the average was also 85%). Look at your returned work carefully; if your score was below 18, you might want to review this quiz with me or a CA. Material similar to this will be on the first written exam.

After I return your graded work in class on Friday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., an exam score of 22.5 is recorded as 23).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student exams: it makes my office messier, and you don't get the benefit of the feedback I wrote on the quiz.

Here were some common mistakes:

  • Problem 1: I graded this problem closely, awarding full credit to only the simplest and most elegant of of solutions. Most students did very well on this: I took off 1/2 point for not using a conditional expression for computing the value in the new LN (e.g., writing two recursive calls instead of one). You must have written as a recursive, not iterative method. I took off a point for a wrong complexity class.

  • Problem 2: I was looking here for a restatement, in terms of the code you wrote, of the 3 rules used to prove any recursive method correct. Some students missed this main point and wrote a paragraph justifying their code: I wanted the 3 rules (I took off 3 points in this case). Some students, especially for the base case, just described what the code did, without explaning why it was the right thing to do: that an empty list is a copy with substitution of an empty list, because there are no values to copy/replace. In the second part, you should explicitly state that something.next is the list argument in the recursive call. In the third part, you should explicitly state "assuming that the recursive call works for the smaller list (more detail on what "works" mean is even better)", and then show How that leads to the correct answer for the entire list using copyWithSubstitution.

  • Problems 3: I graded this simliar to Problem #1. I took a point for for having three ifs for bases cases or complicated nested ifs for base cases (see my solution: only two are needed). I also took off .5-1 points for an overly complicated recursive case (you need just to store the result of a recursive call in one of the .nexts and then return a reference to the node containing that .next (with no other local variables, assignments, etc.) I'd prefer that you write these solutions in the standard form, with the base case(s) explicitly tested and processed first. I took off a point for a wrong complexity class.

  • Problem 4: I graded this simliar to Problems #1 and #3. I took a half point for for having two ifs for bases cases (see my solution: only one is needed). I also took off .5-1 points for an overly complicated recursive case (you need just to store the result of split2 in a local array and write just one statement returning the merge of the recursive calls on sort for the two positions in this array (with no other local variables, assignments, etc.) I took off 1-2 points for not writing an "obvious" recursive pattern, and for missing base cases (or always splitting and then testing the splits for null) and other things that made the code not work. I'd prefer that you write these solutions in the standard form, with the base case(s) explicitly tested and processed first. There were still a few student who wrote code that would not work on empty lists here (and didn't think to test it, or just look to see what happens in this simple case).

#19: 11/3/06
Program #7
I have graded (and recorded the grades for) Program #7. The class average was about 28 (or about 92%; last semester the average was 91%). If you did not fill in the program or drop it off correctly, make sure you understand what to do before the next program is to be submitted; that might include a visit to my office hours.

After I return your graded work in class on Monday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., a program score of 28.5 is recorded as 29).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student programs: it makes my office messier, and you don't get the benefit of the feedback I wrote on the program.

The grading was straightforward: 6 points each for parts #1, #2, the practice exam, and #3 and 3 points each for parts #4 and #5. Each problem had about half credit for creating/printing the map and about half credit for using the map to solve some problem. For the first three programs, not submitting either a generic or nongeneric solution (bot were required) was worht one point.

For some reason there seemed to be a lot of "missing" projects (mostly for the pre-practice exam part of this assignment).


#18: 11/3/06
Quiz #7
I have graded (and recorded the grades for) Quiz #7. The class average was about 20 (or about 72%; last semester the average was also 80%); there are still a few students who did not submit their programs online, which resulted in some very low grades. Look at your returned work carefully; if your score was below 18, you might want to review this quiz with me or a CA. Material similar to this will be on the final exam.

After I return your graded work in class on Friday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., an exam score of 22.5 is recorded as 23).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student exams: it makes my office messier, and you don't get the benefit of the feedback I wrote on the quiz.

Here were some common mistakes:

  • Problem 1: Many students missed just one part; a few seemed not to understand what I was looking for, so they missed many parts. There were a lot of "off by one" errors: either the next field changed or the node that it pointed to was off by one. Note that in the last problem, you cannot point to x's box because it is a variable, not an object! Assigning x to a field means that it refers to the same node as x refers to (the one at the front of the list). For grading purpose, 1/2 a point for changing the right instance variable and 1/2 a point for storing the right value in it. In the first part, you needed to draw a new object.

  • Problem 2: Many students lost some credit because their answers needed to be more general in parts a and b: some students said the code did not work on an empty list; this is true, but more generally it doesn't work if the value to be located is bigger than the biggest one in the list (which is true for the empty list and many others). Likewise, it works so long as the value to be be located is less than or equal to the biggest one in the list. Most students got the final part correct (whose error occurs even on an empty list: the simplest one to hand simulate).

  • Problem 3: The solution requires two nested loops (whether both are written in one method or each written in separate methods). Some students terminated their for loops when r.next == null, which misses processing the last value. For the AA part, I was a bit picky about students that didn't specify in detail how to solve the problem using arrays/collections (for example using the term collection instead of Map). Many students said something about storing information in an array, but weren't specific enough; note using the an array to store the frequencies (at index i it stores the frequency of number i) while technically yielding a linear solution, must declare an array with billions of elements and do billions of operations to initialize and find the maximum; so it will always take quite a long time to execute, even for lists with just a few values.

  • Problem 4: I ran about 6 tests, each worth about 1 point; if you failed a test I wrote the two arguments and the results. Sometimes a solution worked generally, but failed on empty lists (especially if the first was empty), or those with one or two nodes. Thre were some overly complicated solutions (see mine) but I didn't take points off for them.

  • Note: While running code is great for testing whether a method is correct, hand simulation is better for determining why it is incorrect (and how to fix it).

#17: 10/21/06
Midterm Written Exam
I have graded (and recorded the grades for) the Midterm in-class written exam. I expect you to go over my solutions and understand them (and if you don't, to seek help understanding them). We will review the grade distibutions, including midterm grades, in class on Monday. Remember that the Final written exam will be 1/2 on this material and 1/2 on the material that we cover during the second half of the semester (linked lists, trees, recursion).

The class average was about 75% (last semester it was 73%) and the median grade was 76% (last semester it was 74%). More information about this writen exam appears below.

After I return your graded work in class on Monday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., an exam score of 73.5 is recorded as 74).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student exams: it makes my office messier, and you don't get the benefit of the feedback I wrote on the quiz.

Recall that the exam was 105 points out of 100, so you could have skipped any small question (or lost partial credit on any large one) and still scored 100% on the exam. The highest score was 96%. A bit over 8% of the students scored 90% or above; almost 34% score 80% or above. See the Exams tab in the spreadsheet for a histogram of the scores.

  • Problem 1: Students attempting this problem scored an average of 92% the highest on the exam; this problem was designed to allow you to get off to a good start on the material that we reviewed. There were a lot of details to take off point for, so although many students lost just .5 or 1 point, only three students scored perfectly: Jeffrey Carlson, Taiyang Chen, and Max Friedman. This was the "easy" problem: defining a relatively straightforward class that stores just simple instance variables; if there was a tricky part, it was ensuring that the two array instance variables were correctly initialized (some students forgot to allocate the votes array; the candidates array is already allocated and passed as a parameter to the constructor: copying it or not was fine.) The point breakdown was 5 points for public class Election and correctly declaring the instance variables (three is optimal), 4 points for the constructor: including allocating the correct sized array; 7 points for the private helper method getNameIndex2 (if you didn't write this method I deducted 2 points and possibly took off 7 points for the "finding" code in the other methods; 5 points for the recordVote method; 7 points for the getVotesFormethod; and 2 points for the getBadVotes method. I deducted points for a variety of problems inside these methods (some relating to code simplicity, not using .length for the array size, failing to throw the required exception correctsly, etc.)

  • Problem 2: Students attempting this problem scored an average of 56% (the worst performance on the exam; Owen Durni was the only student who scored perfectly; Chanin Laohaphan had just a 1/2 point deduction). Actually, almost everyone scored 5 points on part a, so the disaster was in part b. I was surprised at how poorly students did on this question We have repeated seen drawings of complicated objects (collection classes) in the notes, and a previous quiz tested you on the form of a call frame. I was asked directly in class on Monday whether call frames and pictures of objects would be on the test and I said yes. I'll say here, a question or two like this will appear on the final exam: please learn how to draw these pictures quickly and accurately. For part b, the this and local Object[] variables were worth 1 point; the SimpleQueue and Object[] objects were worth 3 points each (object + two instance variables in each); drawing a reference from sq and drawing a String object for "a" were each worth 1 point.

  • Problem 3: Students attempting this problem scored an average of 81% (the second highest average on the exam; Chandrasekhar Bhagavatula, Karen Liu, Michael Kross, Jason Lee, David Klionsky, Brian Krausz, Mun Thye Mak, and Andrew Yeager score perfectly). Part (a1) of this problem is fairly straightforward; students lost points for not writing implements Behavior, not correctly writing a constructor/instance variable, not having a Model m parameter on doIt, not correct accessing each individual behavior, or not passing m to each indvidual behavior. Part (a1) many students missed new Behavior[] right before {b1,b2,b3}; some mixed up the [] and {}. Part (b) of this problem is likewise fairly straightforward -even more so; students lost points for not writing implements Selector, not correctly writing a constructor/instance variables, or not having a correct best method (which involves ==); reversing the arguments to the call of the delegated best was incorrect (and many students tried this solution): you must identify which object was returned by best and return the other one.

  • Problem 4: Students attempting this problem scored an average of 77%. (Chandrasekhar Bhagavatula, Max, Friedman, and Adam, Royal scored perfectly). In part (a), the mistakes were assessed a .5 point deduction, but 1 point was assess for the call r.m() Students missed a variety of answers, mostly relating to casting (it doesn't change what methods are called, just which are allowed to be called), and the fundamental rule (here used in a complicated context) that the class of the object (not the type of a reference to it) determines which method is called. In part (b) I was looking for just one word in the first two parts, and the distinction between types and classes in the second two. Many students wrote close but not completely correct answers for the last two problems.

  • Problem 5: Students attempting this problem scored an average of 76% (Chaya Hiruncharoenvate, Karen Liu, Jeffrey Carlson, Paul Chung, Adam Royal, Tianyuan Wang, Jerry Feng, and Chanin Laohaphan scored perfectly). Complexity classes must be written in big-O notation. Part (a) required a correct complexity class and description. Part (b) required just correct complexity classes; some students incorrectly wrote O(N Log2 N) for the HashSet. Part (c) require correctly complexity classes and showing work; there were many small mistakes here. Part (d) required something about timing the method multiple times, then looking at the pattern, or curve fitting a graph, etc. Part (e) required computing the right coefficient (I gave + .5 points for actually simplifying it to a number) and writing that coefficient in an equation for the time correctly.

  • Problem 6: Students attempting this problem scored an average of 69% (no one scored perfectly, but Robert Saris, Jerry Feng, and Chanin Laohaphan lost only .5 points). In part (a) the class had to extend HashSet, declare and initialize (in the constructor) a bound, check the bound in the add method, and return the correct boolean by sometimes calling super.add with add's parameter. In part (b) I gave everyone 1 point; another point was for saying (or describing a decorator) and .5 points each for giving an advantage and disadvantage of decorators over inheritance. My hint in part (b) seemed to confuse many people, who tried to use an unmodifiable set in their solution: I just meant for you to use the same technique -decorators- used to implement unmodifiable sets.

  • Problem 7: Students attempting this problem scored an average of 61% (Michael Kross, Jason Lee, and Tarsis Martins score perfectly). I was looking for you to spot that a class implementing Iterator is different than a class implementing Iterable, although a simple change turs the former also into the latter.

  • Problem 8: Students attempting this problem scored an average of 57% (the second lowest of all questions: only Nikhil Thiruvengadam scored perfectly on this problem). For full credit, the answer needed to talk about the controller calling a mutator model method, which calls update in the view, which calls an accessor method in the model.

  • Problem 9: Students attempting this problem scored an average of 75% (25% of the students scored perfectly). Almost everyone got full credit (1 point) for part (a). For part (b) you needed to say something about the inherited foo method: like "by removing the overloaded method which just called the inherited one, now the inherited one is called directly).

  • Problem Xtra Credit: Students attempting this problem scored an average of 66% (Cai Linda, Andrew Ballard, Daniel Bruce, Jeffrey Carlson, Owen Durni, Michael Kross, David Klionsky, and Andrew Yeager scored perfectly on this problem). For full credit, part (a) had to discuss always inheriting these methods (so specifying them in the interfaces adds no further requirements). For full credit, part (b) had to discuss not needing an object to use methods and fields (just discussion calling a methods with the name of the class, while correct, did not get to the heart of the answer).

#16: 10/17/06
Program #6
I have graded (and recorded the grades for) Program #6. The class average was about 28 (or about 95%; last semester the average was 96%). If you did not fill in the program or drop it off correctly, make sure you understand what to do before the next program is to be submitted; that might include a visit to my office hours.

After I return your graded work in class on Monday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., a program score of 28.5 is recorded as 29).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student programs: it makes my office messier, and you don't get the benefit of the feedback I wrote on the program.

The grade sheet lists many things that I had the CAs check. Broadly, most items were worth a point; removing prey was worth 2 points and "getting it" about inheritance, use of Behaviors an delegation was worth 1.5 points. Generally the Model items were worth 2 points.

The purpose of this assignment was to let you explore a complicated application involving interfaces, classes in a hierarchy, and delegation. If you wrote larger-than-needed classes that duplicated state (held either in superclass or in an instance variable), or did not use delegation where appropriate, I deducted 1 point. Also, if you wrote and used special methods for recognizing and selecting Prey, not the ones specified in the assignment, you lost credit. Please read my solution and compare it to yours.


#15: 10/12/06
Written In-Class Midterm Exam
The following is generally useful information about the upcoming in-class written exam. Please read through it at least once.

The written exam is long compared to the time allowed. Expect to arrive in class on time and start working immediately. The written exam will look like a long quiz. On the written exam, you are given a point value for every problem: an N point problem should be finished in about N/2 minutes (e.g., a 6 point problem should take about 3 minutes). Pay attention to these numbers and stick to the times to pace yourself through the exam. Assume that you will NOT have enough time to finish every question on the exam; skip anything that you don't know immediately, and come back to such problems only AFTER you have answered all the questions that you do know.

Here is my top 10 list of important topics in Java you should know about, in order from most important to least important (but they are all important). Of course, there are dozens of interesting aspects that I can ask about each of these topics, so this outline presents only very general information. A typical exam will have 1-20 questions, for an average of 5-10 points each (some might be as low as 2 points -a 1 minute answer- some up to 30 points -a 15 minute answer). My goal is NOT to ask you about obscure topics, but about topics that you should have a solid understanding of, have addressed before, and be able to produce an answer (whether code or English) straightforwardly and quickly.

It is important to read each problem and understand it: ask yourself what the problem is really about; then answer it. Typically, about 1/2 of the exam points will focus on analysis (answering questions about Java in general or Java code, writing diagrams, etc.) and about 1/2 of the exam points will focus on synthesis (writing Java code).

  1. Classes (reading with Javadoc and writing code): constructors, fields, methods, access modifiers, anonymous/inner, arrays
  2. Type/Class and Compile-Time/Run-Time Distinctions
  3. Interfaces
  4. Inheritance: abstract and concrete classes; IS-A vs HAS-A class reuse
  5. Collection Classes and Iterators (mostly using them, not writing them)
  6. Analysis of Algorithms
  7. Construction/Debugging of Programs (also the MVC pattern and debugger)
  8. Exception Handling in Java (including try/catch and exception hierarchy)
  9. Control structures and Expressions (including new for object/array construction)
  10. Tokens and EBNF.
Be able to read/understand questions and write answers using Java terminology. Write terse, to the point answers (DON'T REPEAT THE QUESTION IN THE ANSWER, you don't have time); try to state the most important point. Often the right technical term will nail the answer; if you cannot think of it, you'll have to spend more time and use more words to describe what you are talking about. Be able to draw pictures of variables, objects (and instance variables in objects). Be able to analyze expressions (with oval diagrams), control structures (with boxing and compact trace tables), and method calls (with call frames; know about local variables as well as explicit and implicit paramters: e.g., this).

The primary way to study for the exam is to read, work, and understand the problems on the quizzes and their answers. Look deeper than the question itself, as there are often many ways to ask for the same information: try thinking up interesting questions on your own. Some quiz questions assumed that you had the ability to look up details; such details won't be required on the written exam (or I will provide them with the question or on a seperate piece of paper). To a lesser extent, examine the lecture problems as well (there are too many of them to study in depth; hopefully you've been working them throughout the semester). Finally, you should be familiar with all the materials from programs 4-6, as sometimes I will use your knowledge of these programs to frame questions quickly.

Expect the exam to be difficult. When taking it, don't get discouraged, just plough through it. I'm hoping for an average similar to our take-home quizzes: in the mid 70s to mid 80s. If the average is below 75% (and it often is), it probably means that I constructed an exam that was too hard (too time consuming); in this case I will normalize everyone's grade so that the class average is raised to 75%. So, try to get as many points as you can by quickly answering the questions that you know (and initially skipping the others, coming back to them if you have sufficient time). Keep your answers short and focused.

Help Sessions

I will talk about the exam in class on Monday, October 16. The main idea here is to answer your questions, not try to summarize everything that we have studied so far during this course. Come prepared with questions from quizzes, homework, whatever.

In In-Class Programming Exams

There will be two in-class programming exams, but both will be given at the end of the semester, and both will be worth 100 points. Last fall, 90% of the students scored 100 points on the first problem, and 78% scored 100 points on the second problem (75% score 100% on both): so most student will see their grades rise after taking these exams, which admittedly are scored on a very weird scale. The first exam will cover using collection classes (you'll be very comfortable using these by the end of Programming Assignment #7), and the second exam will cover methods operating on linked-lists and trees. We will work on practice exams for both of these before the end of the semester.

#14: 10/10/06
Quiz #5
I have graded (and recorded the grades for) Quiz #5. The class average was a bit over 18 (or about 75%; last semester the average was 83%). Look at your returned work carefully; if your score was below 18, you might want to review this quiz with me or a CA. Material similar to this will be on the first written exam.

After I return your graded work in class on Wednesday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., an exam score of 22.5 is recorded as 23).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student exams: it makes my office messier, and you don't get the benefit of the feedback I wrote on the quiz.

Here were some common mistakes:

  • Problem 1: Most students got the idea. You needed to say something about "class name" on the first part; although I didn't take off points, you should have mentioned that A must be descended from Throwable. Likewise, you should have said the variable (like a parameter) a "refers to the object thrown". To get full credit on the second part, the answer should include a method call on a: getMessage or printStackTrace, or a rethrow (I didn't allow "degenerate" method calls, like toString, implicit or explicitly, which have nothing to do with Throwable).

  • Problem 2 (the first one): Again, students mostly did a good job here. To get full credit on part (a), students should mention that every exception is a subclass of Exception; although I didn't take points off, you should have mentioned RuntimeException explicitly, saying it too was a subclass of Exception To get full credit on part (b), students must mention putting the catch (RuntimeException re){...} before the one written.

  • Problem 3 (the second one): Many students got full credit here. Some seemed to guess on the 2nd and 3rd parts (which were missed most). The 2nd is just a straightforward loop that mimics the behavior of binary search, cutting the number in half each time. Note here, T(2N) is T(N)+1, the signature of (Log2N). Likewise, the 3rd just does the standard loop from the 1st part, but does it 10 times: 10N is still O(N). I took off 1/2 point for not showing your work, not using big-O notation, or for writing something like O(10N); write just O(N) since all constants are removed.

  • Problem 4: Most students got at least half credit. I required you not only say "it MIGHT be faster for small N" but also explain the reasoning: the constants; e.g., 100N vs. 2N2. Note that there is no guarantee that O(N2) method are faster for small N than O(N) methods; one cannot talk about an algorithm being faster for all N between 0 and 1, because N is an integer.

  • Problem 5: Most students got most parts of this correct. Some students thought O(N) was a higher complexity class than O(N Log2N). For the second part, we must assume the worst case (that the test is true). In the third part, many studens simplified this to O(N2) but you cannt drop multiplicative terms if they are functions of N; you can only drop multiplicative terms if they are constant as well as additive terms if they are of a lower complexity class.

  • Problem 6: Most students got a good start on this: some did not explain how they solved for c (-.5 points); others plugged and chugged incorrectly (many answers were way out of the ballpark, given a complexity class of O(NLog2N). Remember, you should know that Log21000 is about 10 and Log2Na is aLog2N, so Log21,000,000 = Log210002 = 2Log21000 = 20.

    Problem 7: Most students made some small mistakes here. I wanted you solve the equation 100 N = 10 N Log2N: that is where the two time curves cross (at N = 1,024). In the method, many students specified an int N parameter when it should be Object[] o with o.length computing "N" to check against 1,024; this parameter should have been passed as an argument to m1 and m2. Finally, many students call the linear algorithm for lengths less than 1,024 when that algorithm is faster for bigger values.

  • You can find my JUnit test on the SolutionsLink and run it for your Sequential class (each passed test is worth one point: there are eight tests). I had to grade these under artificial conditions; so, if you think I did not accurately capture the correctness of your class, stop by during my office hours and we can rerun the JUnit test.

#13: 10/9/06
Program #5
I have graded (and recorded the grades for) Program #5. The class average was about 27 (or about 89; last semester the average was a bit higher, 93%). About 6 students had programs that did not render the pictures correctly (at least we couldn't render them); if you were one of these, and your program does render correctly, please talk to your CA about it, and then come see me (Rich) with your grade sheet, and show me. If you did not fill in the program or drop it off correctly, make sure you understand what to do before the next program is to be submitted; that might include a visit to my office hours.

After I return your graded work in class on Monday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., a program score of 28.5 is recorded as 29).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student programs: it makes my office messier, and you don't get the benefit of the feedback I wrote on the program.

The grade sheet lists many things that I had the CAs check. If you could not read in the database flawlessly, up to 5 points were deducted. If you could not display the database flawlessly, up to 5 points were deducted. If you could not load/display the picture to render, 5 points were deducted. If you could not render a photomosaic in any form, a total of 8 points were deducted (plus you probably lost some point for the RGB Metric). If you could render a photomosaic, but only at the same size as the original picture, 4 points were deducted. If you could render a photomosaic in any form, but did keep track of how often each small picture was used (not implementing the usage criteria), 1 point was deducted. Most of the other methods were worth 1/2 point, but you needed to get them completely correct according to the criteria. Correctly implementing the RGBMetric (and adding it and QuadRGBMetric to the MertricFactor) were each worth 2 and .5 points respectively. At the bottom, are the two extra credit parts (distance and spiraling): each should be worth 1 extra point of credit.


#12: 10/5/06
Quiz #4
I have graded (and recorded the grades for) Quiz #4. The class average was about 21 (or about 84%; last semester the average was aso 84%) Look at your returned work carefully; if your score was below 18, you might want to review this quiz with me or a CA. Material similar to this will be on the first written exam.

After I return your graded work in class on Friday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., an exam score of 22.5 is recorded as 23).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student exams: it makes my office messier, and you don't get the benefit of the feedback I wrote on the quiz.

Here were some common mistakes:

  • Problem 1: Most students did well on this question. To get full credit on part (a), you had to say something about the call to super appearing first in the constructor, and about it initializing private instance variables (something beyond just constructing the superclass) Some students said it "simplified construction": the use of "this" simplifies construction, but "super" is necessary. To get full credit on part (b), the answer must include something about overridden (spelled correctly, not overwritten) methods; just saying that it is used to call superclass methods while true, is not enough: you don't need it to call inherited superclass methods, unless they are overridden, and normally it us used only INSIDE the overridden method.

  • Problem 2: Again, students mostly did a good job here, but there were a few trouble spots.
    • Some students wrote that the three System.out.println statements were illegal (they are all legal and all call toString on their argument inside the method).
    • Some students wrote "throws exception" for certain calls, but none do.
    • Some students allowed c.doBoth() when c was declared to be of type SuperClass, which the compiler won't allow, regardless of what class of object c refers to.
    • Lots of students had wrong answers to the last two (or just last one) for System.out.println (forgetting that even when a SuperClass method is called (e.g., super.toString) if it calls a method (it calls getID), and the object is from SubClass, the overriding method is called (getID in Subclass). This concept is very important and you should understand it. It is illustrated only in the last call.
    Note that in terms of compilation, parts 1 and 3 are IDENTICAL (because they both declare SuperClass c. In terms of execution, parts 2 and 3 are IDENTICAL (because they both construct SubClass objects). This concept is very important and you should understand it.

  • Problem 3: Many students got full credit here, an even more were very close. Mistakes included not writing extends Ball, or not declaring private instance variables, or calling super second in the constructor. Note that in many implementations, there was no need to reinitialize one of the instance variables in the constructor. Some students defined update with no parameter, so it didn't override the inherited update method. You had to call super.update(...); passing along the parameter; this must be done AFTER doing the color update: it is the inherited method that calls the view to update the object (which may have moved or changed color). Some student just called super, which is not how it is done in methods. Some students forgot to reinitialize an instance variable when the color was changed, so the code never changed the color again. Some students called super.setColor but that is not necessary; the setColor method is inherited. Some students tried to set the color instance variable declared in Ball, but that method is private. Finally, some students kept incrementing a counter instead of resetting it; if a simulation is run long enough, this might cause an overflow.

  • Problem 4: I was strict on most of these problems.
    • (a): Many students got this correct. You had to say something about b's type being Ball, which allows the update method to be called; but the object b refers to is from the ColorChangeBall class, so ITS update method is called, which can change the color.
    • (b): Most students got this correct. You needed to say that t names a reference variable, not an object, although t's value refers to the object.
    • (c): I wante two private instance variables: one to store an array of Ball or ColorChangeBall objects (the array's type whould be Ball) and one to score a count of how many elements were stored in the array. I accepted certain collection classes with full credit, but not queues and stack: it is hard to remove random balls from them.
    • (d): Most students got some but not all points here. (1) I didn't want you to say that "by Java rules, we cannot construct objects from interfaces and abstract classes". I wanted you to explain why: the compiler would allow us to call methods that aren't implemented, because both types can define methods with no bodies. (2) For full credit, you must say something about using them in "constructors for subclasses, using super".

#11: 10/3/06
Program #4
I have graded (and recorded the grades for) Program #4. The class average was about 28 (or about 95%; last year the average was 94%). If you did not fill in the program or drop it off correctly, make sure you understand what to do before the next program is to be submitted; that might include a visit to my office hours.

After I return your graded work in class on Tuesday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., a program score of 28.5 is recorded as 29).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student programs: it makes my office messier, and you don't get the benefit of the feedback I wrote on the program. There were some common "errors":

  • On the BigInteger program, most students got most parts correct. This was really a bridge between using classes and writing classes; I'll now assume that you know quite a bit about BigInteger. Few student tried and received the extra credit point. Some students did not faithfully translate the constructor and ended up with negative numbers in the calculation of e. Others had exceptions thrown immediately; it was often a subtle bug that I helped a few students find (I assume others had the problem and failed to seek help, so they lost points that they should have been awarded). Often problems were caused by using == instead of .equals in the the equals method. Generally when we compare Rationals for equality, we don't care if the references refer to the "same object", we just care if the states of the objects (the values that they represent) are the same (just like for Strings).

  • On the Vending Machine program, there were many possible mistakes (and it was on this part of the assignment that most students lost most of their points. Interestingly enough, this program was probably the simplest in terms of people performing the tasks, but because it was very "real-world" there were all sorts of conditions that must be checked before/during the "simple" algorithms (e.g., change making) could be run correctly in all cases (e.g., not enough coins). We will continue to see many model classes throughout the semester. Please note the overloaded Prompt.forInt method that specifies a default value: the constructor is trivial to write if you know this method.

  • On the SimplePriorityQueue program, most students got most parts correct (although there were a few student who didn't seem to even get to this program). A few students tried to use inheritance (if it wasn't covered in class before the assignment, you're not supposed to use it) and got themselves in all sorts of trouble. Also, a few students got the Comparators backwards; I do this sometimes too: typically fixing it requires just negating the returned result. Some students got the comparators correctly, but wrote code that removed things in "smallest priority first" instead of "highest priority first". The problems should be easy to spot (when run against my executables) and easy to fix too. When we start studying self-referential data structures (linked list and trees) we will come back and implement more collection classes.

#10: 9/27/06
Quiz #3
I have graded (and recorded the grades for) Quiz #3. The class average was a bit over 20 (or about 80%; last semester the average was about 83%). Look at your returned work carefully; if your score was below 18, you might want to review this quiz with me or a CA. Material similar to this will be on the first written exam.

After I return your graded work in class on Wednesday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., an exam score of 22.5 is recorded as 23).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student exams: it makes my office messier, and you don't get the benefit of the feedback I wrote on the quiz.

Here were some common mistakes:

  • Problem 1: There was a split here: many students performed very well, but the ones who didn't often performed very poorly. It was close to a "most or half" pattern. Many students assumed that there were possible "holes" (null values in the arrays); this assumption (which was often inconsistent over the different methods) made for more complicated code. When using arrays (unless told explicitly otherwise) assume and preserve the invariant that all its useful values are stored at the front, and there is an count of how many values are present.

    Points were almost divided among declaring the whole class and instance variables (1), initializing them in the constructor (2), and the remaining methods (with getBestValue scoring 3 points, and all the others scoring 2). Note that the variables declarations should be private and didn't need explicit initialization: all should be initialized in the constructors. getValues was pretty straightforward. In getBestValue some students left out a test for no elements in the array (or used .length instead of some count; or didn't properly construct and then throw an object). Some calculations of best were overly complex and some wrong: this is an accumulated value: some students looked at [i] and [i+1] pairs, which didn't accumulate a value. In remove some methods were quite compilcated, with multiple loops (see my solution): other students forgot to update the count instance variable for the shrunken array.

  • Problem 2: Mostly a good job here. One problem was declaring the isOK method to have a String parameters (by the definition of Decision, it MUST have use Object). The Object parameter must be cast before calling length; calling toString was overly generous: the cast should throw and exception for non-string objects. Some students failed to declare or properly initialize an instance variable to remember the minimum length. They seemed to think that by declaring a parameter for the constructor, there was automatically an instance variable with the same name. There isn't): you must declare the instance variable and then store into it in the constructor. IMPORTANT: some students used an if statement, which was overly complex. They could just return the boolean value computed by the if's test: I took off .5 for that extra complexity.

  • Problem 3: Similar to Problem 2. Again, there were problems with the parameter and returns types (must be Object) and casting. Some students got the returned values backwards (returning the first alphabetically). Note that casting precedence is lower than "." precedence, requiring parentheses: ((String)o1).compareTo...

  • Problem 4: Many small problems here, but the most frequent was not casting eachj dequeued value to Integer and/or not calling the intValue method before comparing the values to 0. Some students declared but didn't construct a SimpleQueue object; others forgot to return it at the end of the method. Some students compared an increasing counter to a decreasing q.getSize() and missed half the values (we discussed this mistake in class): use !q.isEmpty which simply states the continuation condition. Some students forgot to answer part b (a .5 deduction). You needed to say throw and ClassCastException for full credit. IMPORTANT: Always reread the question after you answer it to ensure you covered all the requirments.

  • Problem 5: We discussed this answer in class on Friday. For full credit on party a, you needed to discuss two facts: the constructor uses the name of the class and there is no class name; many students really just half answered this question. On part b (which more students got full credit) you needed to show a correct call on a.remove using an anonymous class. Some students just wrote new Decision() or new Decision(5) without specifying the isOK method.

#9: 9/24/06
Program #3
I have graded (and recorded the grades for) Program #3. The class average was a bit over 29 (or about 98%; last semester the average was 102%). If you did not fill in the program or drop it off correctly, make sure you understand what to do before the next program is to be submitted; that might include a visit to my office hours.

After I return your graded work in class on Monday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., a program score of 28.5 is recorded as 29).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student programs: it makes my office messier, and you don't get the benefit of the feedback I wrote on the program. There were some common "errors":

  • On the dice-war program, most students got most parts ccorrect. Some answers (things like length of shortest/longest game) were unreasonable (some double-counted roles and were off by a factor of 2: if you ran my executable you were likely to spot such an error). I wanted to make sure students constructed multiple dice (specified in the assignment; I wanted you to construct multiple objects from the same class). Likewise, I wanted you to use a call to the rollCount method for at least one of the statistics, rather than defining another counter. Finally, some traces omitted information that my trace had; whenever possible, make your output match mine, by running my executable.

    About 10% of the students got the extra credit point here for approximating the number of throws for a game starting with 1,000,000 chips (for last year's freshman, 33% got that extra credit point). The analysis is in my solution, and it is the same kind of analysis that we will use when studying the complexity of algorithms.

  • On the cardiac program, again most students got most parts correct. Some students ran some tests incorrectly, but it was sporadic.

  • Some students lost points for style. You need to indent your control structures correctly. I really really really want you to use the standard Java style of putting the open brace at the end of the line line with the control structure.
      if (something) {
        ....
      }
    Students need to add more preface comments (side-bar comments don't need to be used often) and group statements together better (with blank lines between groups): the two are related. This problem actually becomes simpler once we start to write methods in classes, because methods form natural groupings which should be commented.

  • Finally, there was no need to use anything other than a main method and its local variables. Using helper static methods was OK (but didn't really simplify things). A few students wrote methods that looked like
      ... boolean test (int x) {
      if (test-of-x)
        return true;
      else
        return false;
      }
    Instead, write such a method's body as just return test-of-x Creating an object of some class and using a main method to construct an object and then call one of its methods, like run, made the program more complicated than necessary.

#8: 9/19/06
Quiz #2
I have graded (and recorded the grades for) Quiz #2. The class average was a bit under 21 (or about 83%; last semester the average was 82%). Look at your returned work carefully; if your score was below 18, you might want to review this quiz with me or a CA. Material similar to this will be on the first written exam.

After I return your graded work in class on Wednesday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., an exam score of 22.5 is recorded as 23).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student exams: it makes my office messier, and you don't get the benefit of the feedback I wrote on the quiz.

Here were some common mistakes:

  • Problem 1: A few random problems here: some involving printing of the numbers as well as the special symbols (and a few studetns printed "x" instead of x's value), forgetting to print D (or printing too many Ds, thinking it was in th eloop). You need a good understanding of exception handling (and how it interacts with expression statements) to solve this problem correctly.

  • Problem 2: Generally a solide job, although some solutions didn't work in all cases and some were much more complex than others (these were correlated). Interesting cases involve an empty words string (in many cases student code for this condition threw a NoSuchValueException), a word somewhere inside words, and word not appearing in words You should always verify that if your code can throw an exception (as nextToken can) that you have tested hasMoreTokens first (or embed the call inside a try/catch). Adding extra boolean state or int counters made the code more complicated than necessary: use the right control structures to simplify code. Prefer equals to compare when testing for equality. Some students didn't return a result, they printed a result; this is almost always the wrong thing to do. Methods that primarily perform a computation should return their result, so it can be used by another part of the program (even if that other part decides just to print it).

  • Problem 4: Many small problems.

    Part a) 1/2 pt for each of the two answers. Again, prefer equals to compare when testing for equality. Some students used toLowerCase instead of toUpperCase in parst 1; in part 2 you needed an assignment operators, because toUpperCase is not a mutator.

    Part b) I got picky on the second part here and deducted 1/2 point if you said "the name of an object", because objects don't have names, they are constructed from classes that have names. These objects may have some number (zero, one, or more) named variables that contain references to them. So, reference, or reference to an object, even variable (which stores a reference to an object), or just plain object is a better answer than "name of an object".

    Part c) Most students did well here; 1/2 point for "throw"; 1/2 pt for "exception": "throwing an error" or "forcing an exception" scored just 1/2 a point.

    Part d) Most students got the key answer: void vs. non-void. Also, get and set are other indicators, but these conventions are not universally used. Discussions of parameters for the most part didn't make sense here: in DiceEnsemble no methods have parameters; in Rational many accessors have parameters (e.g., add, equals, etc.)

    Part e) Many students said they were already initialized, but without any indication of where: in their declaration.

  • Problem 4: Definitely the worst scores on the quiz (it is every year). Very many students had no idea (or at least didn't communicate it) about how to draw variables, objects, instance variables, and parameters (especially this). PLEASE REVIEW THESE: most are part of every object diagram I draw, although parameters show up only in call frame diagrams. If you are fuzzy on these concepts, you'll be fuzzy about how to do Object Oriented Programming. Some students forget to answer the question about invariants or didn't understand the question.

  • Problem 5: Generally good, but a few students seemed lost when writing methods; if you were below about 7 (especially if you were very much below) you should come and talk to me so we can get you up to speed before we hit inheritance. Most class-related issues showed up in this one small class. Some students didn't declare private instance variables or public class Stock Some confused local variables in the constructor (a few students wrote constructors with prototypes that did not match the one used in my sample code, which has two arguments) with instance variables in the class. The best way to initialize the changeCount instance variable is to initalize it explicitly in its declaration (although implicit initialization works, it isn't sending the right message). The symbol and price instance variables should be implicitly inialized in their declarations: both are always explicitly initialized in the constructor. If an instance variable WON'T be reinitialized in the constructor, set it to its initial value explicitly (even if it could be defaulted; write = 0 explicitly). Some students didn't use the right logic to determine whether to update the price or the count of (non-zero) updates. If you wrote an if containing an if containing a statement block, you should have simplified it to one if with && between the simple boolean expressions.

#7: 9/17/06
Program #2
I have graded (and recorded the grades for) Program #2. The class average was about 31 (or about 102%; last semester the average was about 30, or also 101%). If you did not fill in the program or drop it off correctly, make sure you understand what to do before the next program is to be submitted; that might include a visit to my office hours.

After I return your graded work in class on Monday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., a program score of 28.5 is recorded as 29).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student programs: it makes my office messier, and you don't get the benefit of the feedback I wrote on the program.

There were some common "errors":

  • Students are still not uniformly filling in the comments at the top of the page. Some students did not name the dropoff file as directed. Likewise, just a few students are still not submitting runnable projects correctly. This makes it harder for the CA marking up your program. If you lost points on this part, see your CA, to make sure you won't lose more points.

  • On the π program, most students got the correct answer but some wrote excessive code for entering a positive number. Some of the more advanced methods in Prompt make this easier, but fundamentally you should have a loop with one prompt statement. Some students left debugging print statements printing information (your programs should run like my executables). Some students generated random numbers between 0 and 1 (instead of -1 and 1)and then used them to compute the area of an arc in the first quadrant, and used that to approximate π; this was fine only if they included a comment discussing the difference between the program they were told to write and the one they actually wrote. There is a simple linear transformation to generate uniform random values in any interval. Note that you can avoid computing a square root because sqrt(...) <= 1. means ... <= 1.

  • On the rocket program, some (5%?, 10%?) of the students did not get exactly the right answer (don't worry about the xxx.xx99999999 issues) for time, velocity or height. Most of the problems related to not computing the increased height from the AVERAGE velocity over the interval: many students just computed the velocity at the end of the interval (v += a*dT;) and then the height directly from it (h += v*dT); but the height should be computed as h += (vStart+v)/2. * dT; where vStart was the velocity at the start of the interval (end of the previous interval). The average velocity is described in the problem description. Some students did not use Prompt.forBoolean method, but instead prompted for a Strings and had to have loops to ensure they got "good" ones: use library code whenever possible.

  • The style information was not graded THIS TIME. Please pay attention to style in all subsequent programs, now that we have discussed it in class.
A couple of students mentioned that they do pair programming on a two program assignment by doing one and having their partner do the other. This totally corrupts the pair-programming principles (read the web page). By doing so, you might be saving time, but you are not learning what you need to learn (talking about programs, interacting with partner, cooperative debugging, etc.) This approach could come back to bite you later (if I ask question on quizzes or exams about programs that you didn't do, but your partner did).

#6: 9/13/06
Quiz #1
I have graded (and recorded the grades for) Quiz #1. The class average was a bit below 20 (or about 78%; last semester the average was 78% too). Look at your returned work carefully; if your score was below 18, you might want to review this quiz with me or a CA. Material similar to this will be on the first written quiz.

After I return your graded work in class on Wednesday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., an quiz score of 22.5 is recorded as 23).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student exams: it makes my office messier, and you don't get the benefit of the feedback I wrote on the quiz.

Here were some common mistakes:

  • Problem 1: Lots of small mistakes here; most are in the "Common Errors" section in the Tokens lecture. Quite a few students specified Prompt or forInt as keywords (or as one long identifier) A few others didn't tokenize int or n correctly, tokenized periods (which are separators) incorrectly, tokenized -1 as one literal (it is an operator followed by a literal), tokenized += as two tokens (it is one big operator token), tokenized the white space appearing between tokens (white space can occur in Strings and comment tokens), tokenized multiple separators as just one separator token, tokenized the quotes in the literal "Enter", and finally, tokenized things "inside" comments (they are all part of one big comment token).

  • Problem 2: There were many mistakes, for all parts (especially b). For b, I wanted something general about the semantics of all state change operators: what state is changed and what value is returned; if you wrote about the semantics of = or ++ or how some other specific state change operator worked, I gave you 1/2 point; if you discussed syntactic aspects (types, prototypes, prefix/infix/postifx), I gave 0 points. For c, I wanted one declaration statement that prompted the user one time.

  • Problem 3: Many students didn't fully circle or label literals; some didn't fully circle or label variables either. Many students didn't correctly circle the negate unary operator, and its variable and literal subexpressions. Some students applied the + operator before the * operator (ignoring operator precedence). Some students didn't circle the 2 + y expression or the expressions that were method calls (which are just like operators in oval diagrams). In a few cases, types/values were missing or mislabeled.

  • Problem 4: Lots of small problems here (especially related to implicit conversion and casting, and writing values of the right type). Probably the most missed parts were d and f (which was legal: chars are promoted to ints), and h (which was not legal: we compare Strings relationally with the compareTo method). Many students wrote 2111 when a better answer is "2111" since the result is of type String not int (I did NOT deduct points for this mistake).

  • Problem 5: Most students got some parts of this problem correct. The second (++ is applied to an expression) and fourth (the right = has 1+x as its left operand: + has higher precendence than =) parts were illegal.

  • Problem 6: On part a, few students got full credit: there were lots of different errors so compare your solution to mine if you did not get this one perfect: many statements were either not boxed or boxed incorrectly (especially the forms of the if statement). Programmers should easily perceive how statements are composed, and certainly should be able to identify (by boxing) every statement in a code fragment. On part b, more students got close to full credit: some did not write compact trace tables; others forgot the input/output for prompts in the Console column (or the final output there after the loop terminated); others just performed the hand simulation incorrectly.

#5: 9/13/06
Executing Application.jar files on Macs
Assignments will typically come with Application.jar files in executable folders, so you can experiment with my solution program to better understand the assignment. On PCs there is a double click me.bat file; double clicking it runs the application. I don't know how to do the equivalent on Macs (anyone out there want to help me), so I'm putting the Mac instructions here.

To run one of my Application.jar files, bring up a terminal window and connect into the folder containing it. Then type java   -cp   Application.jar   Application (where spaces and case are important). In fact, the double click me.bat file contains this same command (so you can display it as a reminder), except it starts with java.exe instead of java.

For those that haven't use Java from the command line, we will discuss the javac and java commands at the end of the semester. You can also run the Application.jar file from within Eclipse. The writeup for Program #2 explains how.


#4: 9/11/06
Program #1
I have graded (and recorded the grades for) Program #1. The class average was about 31 (or about 104%; last semester the average was also 104%). If you did not drop off the programs correctly, make sure you understand what to do before the next program is to be submitted; that might include a visit to my office hours.

After I return your graded work in class on Monday, please download the Grades(zipped .xls file) from the course web and ensure that I have computed and entered your grade correctly (I'll be entering about 2,500 grades for students in my course this semester, so even if I'm 99% accurate, I'll incorrectly compute/record 25 grades). Note that all grades are recorded as integral values: I always round up (e.g., a program score of 28.5 is recorded as 29).

If you feel that you are were not assigned the correct grade, Contact your CA first to discuss the issue (he/she is in class Monday, Wednesday, and Friday). Often he/she can resolve it (and then will forward the correction to me). If after speaking with your CA you still have a discrepancy, then come and see me (office hours is typically better than class).

If you do not pick up your returned work in class, you should pick it up during my office hours ASAP; I don't like keeping student programs: it makes my office messier, and you don't get the benefit of the feedback I wrote on the program.

For the most part, this assignment checked whether you could read carefully and follow directions (this is going to be critical in a discipline that is new to many of you). There were some common "errors":

  • Students left out answers to various problems or got various problems wrong on the Questionnaire. Some students did not bother visiting my office to see my cartoons.

  • In subsequent programs, fill in the big comment at the top of the program (this was not correctly specified in this assignment, so I took off no points for "mistakes"). Generally you must write some information about you (name, section, etc.) and some information (a description) about the program. Every time that do a major edit of the file, you should add a line in the Program History section with the date you change it, your name, and a brief summary of what you did/changed in the file during that editing of it.

  • Some students did not drop off a zipped folder containing separate project folders correctly. Make sure that you drop off the correct information, so that we can just unzip it, and use it to create a new project in our Eclipse workbench, and then compile/run the project.

  • I know this is Mr. Lil kind of behavior, but if I say the program should say "scceeded" then either write exactly that in your code, or better yet e-mail me for clarification, pointing out the "mistake" (and ensuring that there is one, and that you didn't misunderstand). That way I'll know, as soon as possible, if I make a mistake; and I'll e-mail everyone in class about it.

  • To get the full one point of extra credit, all the inputs (including the very large ones), must have worked correctly. You must also produce the required outputs: the number with the longest cycle length, its cycle length, and the number of tests that overflowed.

#3: 9/4/06
Change in On-Line Programming Exams
There will be a change in our On-Line programming exams. The content will stay the same, but now I will give both exams towards the end of the semester. Although I am still scrambling to determine the final schedule, expect the Collection Class exam to be moved to 11/28 (so you must be back from Thanksgiving break by then!) and the Lists/Trees exam to still be given the following week, on 12/5. I will still give practice exams for these instruments: expect the first right after midterms (10/24) and the second towards the end of the semester (11/21), right before these two exams. I expect to finalize this information and update the Lecture/Weekly Schedule links within the next week.

#2: 8/28/06
Install Course Software
All students with computers should download and install Java (version 1.5.0.07) and Eclipse (version 3.1); it is also a good idea to install VNC (Virtual Network Computing). All these products are available for free. Students can download and install this software (and other useful material) from the web by exploring the Online Resources link (see Course Software, near the top of that page).

Specifically, read the handout on Java and Eclipse (Download/Installation Instructions) for details. Please contact me if you are having trouble, as I will assume every has successfully downloaded and installed this software by the end of the first week of class.

IMPORTANT: Students should also download and install the Barr-Courier Font on their computers. Again, explore the Online Resources link (see Miscellaneous, near the bottom of the page).


#1: 8/28/06
First Message
Welcome to 15-200. I am going to post and archive important messages about the class in this announcements web page: each entry will be numbered, dated, and labeled. The entries will appear in reverse chronological order. Whenever you follow the link to this page (and you should do so daily), scan its top for new announcements; scan downward for older announcements. This message will always appear at the bottom of this file.

I will never remove a message from this page, although a subsequent message may "cancel" a previous one; in such a case, I'll refer to the number of a canceled message in the message that cancels it.

Expect a few new messages to be posted here each week.

Read this page, along with the the course bboard and your e-mail, daily.