e02 : Final Exam
num | ready? | description | exam date |
---|---|---|---|
e02 | true | Final Exam | Thu 07/28 09:30AM |
Final Exam
Link to actual exam (this is only a placeholder after after the exam is complete, graded, and returned): Actual Exam.
What is covered
- H00 through H14
- Emphasis on H07 through H14
- Chapters 1 through 16 in HFJ.
- Chapters from HFDP that were assigned on homeworks
- All labs
- All Lecture notes from start of course up to the class before the exam.
Links to past exams
Note that the exact coverage of each of these exams varies quite a bit, since the pace of topics, and placement of exams during the quarter can vary considerably. You are encouraged to look at all of them as examples of the types of questions you might be asked, but match them against the topics we have covered, vs. the ones we have not covered.
NOTE: NOT ALL PREVIOUS EXAMS ARE AVAILABLE. The available ones are linked to below.
- http://www.cs.ucsb.edu/~pconrad/cs56/16W/exams
- http://www.cs.ucsb.edu/~pconrad/cs56/15W/exams
- 14W exams are not available online
- http://www.cs.ucsb.edu/~pconrad/cs56/13S/exams
- http://www.cs.ucsb.edu/~pconrad/cs56/12W/exams
- http://www.cs.ucsb.edu/~pconrad/cs56/12S/exams
Review of one important topic: four ways to (handle sorting, handle ActionListener
’s)
This is not a complete treatment, but a reminder of something you need to know.
The material comes from a combination of HFJ Chapters 12,13 (for ActionListener), and from Chapter 16 (for sorting), plus the notes and examples from Lecture.
ActionListener stuff
If you want to define some behavior for a Swing widget,
i.e. something that happens when you click a button, the usual way to do that is to
use addActionListener
to indicate an object of a class that implements the ActionListener
interface.
We discussed four ways to do that, each of which has pros and cons:
- Make the class that implements the button, or includes the button by composition,
be its own
ActionListener
. In this case, you’ll use the keywordthis
when adding theActionListener
. - Make “one or more inner classes” onside the class that is implementing your GUI.
For example, if the class you are writing extendsJPanel
, it might have, using composition, lots of little buttons and widgets attached to it. In that case, you might need lots of little ActionListener objects, and those might be implemented with named inner classes. - Make an anonyous class that implements ActionListener. A key disadvantage is that it can only be used once, in the place where it is defined. There are other pros/cons as well.
- Use a lambda expression, which is essentially, in this context, a convenient notation for an anonymous inner class.
There are many more details that you should have gotten from both lecture and from the textbook reading about the four items above.
Sorting stuff
The four ways are also there for sorting, but with a bit of variation
- Again, we can implement Comparable or Comparator ourselves
- We can define an inner class
- We can also define a separate class that isn’t an inner class (oh, wow, now we have FIVE ways!)
- There is a reason that this is almost never done for the ActionListener case… but makes more sense perhaps for the sorting case.
- We can make anonymous class
- We can use lambda expressions
Know the difference between Comparable and Comparator.
Know the difference between compareTo and compare (see Comparable vs. Comparator)
Know the difference between java.util.Collection and java.util.Collections (with an s)