CS 124, Fall 2009
Information on the Final Exam

The final exam for this course is scheduled for Tuesday, December 15, from 1:30 to 3:30 PM. It will be held in our regular classroom. The exam will be six pages long (compared to four pages for the two in-class tests). It is a cumulative exam, with some emphasis on material that was covered since the second test. You can expect questions that are generally similar in kind to those on the in-class tests.

Since the second test, we have worked on material from Chapter 5, Sections 5 through 7; Chapter 6, except for Section 2; and Chapter 7, Sections 2 through 4. We did not, however cover every topic in these sections. You should pay attention to what was covered in class and in lab, and to the list of topics below.

The last question on the test will be a 20-point, full-page (or longer) essay question on the topic of program development and how it is supported by the Java programming language. Topics related to program development include pseudocode, step-wise refinement, modularity, top-down and bottom-up design, object-oriented programming, design of classes and class hierarchies, state-machines, and the design of event-driven GUI programs. You should be prepared to write a coherent and thoughtful essay on this topic.

You should review the information sheets for the first test and the second test, but here is a list of some of the most important things from that material:

machine language, high-level programming languages, and compilers
the Java Virtual Machine
syntax and semantics
the basic syntax of the Java langauge
literals, variables, expressions, and operators
Java's primitive types
System.out.print(x), System.out.println(), and System.out.println(x)
TextIO methods:  TextIO.getln(), TextIO.getlnInt(), TextIO.getlnDouble()
methods in the Math class:  Math.random() Math.sqrt(x), Math.abs(x), Math.pow(x,y)
String methods:  str.length(), str.charAt(), str.equals()
control statements: if, while, for, switch, do..while
exceptions and the try catch statement
some common exceptions: NullPointerException, ArrayIndexOutOfBoundsException,
   IllegalArguementException, IllegalStateException
how to throw an exception, and why you might want to do so
programming style rules and why they are important
subroutines and parameters; formal parameters vs. actual parameters
modularity (black boxes; separation of interface from implementation)
the access modifiers "public" and "private"
return types and the return statement
the dual nature of classes: the static part and the non-static part
scope of a variable; local variables vs. member variables
named constants and the "final" modifier; why named constants are used
packages
classes and objects
instance methods and instance variables
instance variables represent "state" of objects; methods represent "behavior"
getter and setter methods and why they are used
pointers, references; null; assignment and equality-testing for objects
constructors; calling a constructor with "new"; classes as object factories
the default constructor for a class that does not define a constructor
garbage collection
arrays; elements of an array; index of an element in an array
two-dimensional arrays
using "new" to create arrays
using for loops to process arrays
basic array processing such as summing, counting, finding a max
random access to array elements

Here is a list of some of the things covered since the second test:

extending a class
subclasses and superclasses
inheritance
class hierarchies
object-oriented programming
designing classes to represent concepts
the access modifier "protected"
class Object
abstract classes and abstract methods
interfaces (i.e. the Java reserved word "interface")
writing a class that implements an interface
types in Java:  primitive types, classes, interfaces, and array types
the special variable "this"
using "this" to access member variables hidden by local variables
the special variable "super"
using "super" to call a method from the superclass
nested classes; static nested classes vs. non-static nested classes

GUI programming
the basic packages for GUI classes:  java.awt, java.awt.event, javax.swing
using the Graphics class for drawing;  g.drawRect(x,y,w,h), g.fillRect(x,y,w,h),
   g.drawOval(x,y,w,h), g.fillOval(x,y,w,h), g.drawLine(x1,y1,x2,y2),
   g.drawString(str,x,y), g.setColor(c)
basic building blocks of GUIs:  JFrame and JPanel
JFrame methods:  frame.pack(), frame.setLocation(x,y), frame.setVisible(true),
    frame.setContentPane(panel), frame.setJMenuBar(menubar)
using a JPanel as a drawing surface; repaint() and paintComponent()
using a JPanel as a container for building complex GUI layouts;
    panel.setLayoutManager(layoutManager), 
    panel.add(component)  [ for FlowLayout, GridLayout, or null layout ]
    panel.add(component, position) [ for BorderLayout ]
layout and layout managers
BorderLayout, FlowLayout, and GridLayout
events, listeners, and event-handlers
the asynchronous nature of event-driven programming; comparison to sequential programs
state machines
listener interfaces; ActionListener, MouseListener, MouseMotionListener
the ActionListener interface:  public void actionPerformed(ActionEvent evt)
ActionEvent methods: evt.getSource(), evt.getActionCommand()
the basic MouseListener and MouseMotionListener methods:
   public void mousePressed(MouseEvent evt)
   public void mouseReleased(MouseEvent evt)
   public void mouseDragged(MouseEvent evt)
MouseEvent methods:  evt.getX(), evt.getY()
how mouse events are used to implement dragging
the basic idea of input focus and keyboard event processing
using a nested class to define an event handler
registering event listeners; methods such as addActionListener, addMouseListener

the ArrayList class
parameterized classes; ArrayList<T>
ArrayList methods; list.size(), list.get(i), list.add(x), list.set(i,x)
arrays of objects
partially full arrays; using a counter to keep track of how many elements are used
searching and sorting arrays
sorting algorithms: selectionSort and insertionSort
linear search vs. binary search  [ but not the details of the binary search algorithm ]
more examples of two-dimensional array processing

timers and animation