CS 124, Fall 2014
Information on the Final Exam

The final exam for this course is scheduled for Sunday May 11, at 7:00 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 previous tests. The final exam counts for 20% of your grade for the course.

The last question on the test will be a full-page 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, subroutines, object-oriented programming, design of classes and class hierarchies, state variables, and the design of event-driven GUI programs. You should be prepared to write a coherent and thoughtful essay on this topic.

Don't forget that solutions to quizzes and tests can be found on the course web page. And answers to the end-of-chapter quizzes and exercises in the textbook are also available on-line.


Here is a list of some of the most important things from earlier in the course:

algorithm
machine language, high-level programming languages, and compilers
the javac command for compiling a Java file on the command line
the java command for running a Java program on the command line
syntax and semantics of programming languages
public static void main(String[] args)
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()
Math.random(); using Math.random() to make random integers
Math.sqrt(x)
String methods:  str.length(), str.charAt(), str.equals()
control statements: if, while, for
exceptions and the try..catch statement
some common exceptions: NullPointerException, ArrayIndexOutOfBoundsException,
   IllegalArguementException, NumberFormatException
how to throw an exception, and why you might want to do so
programming style rules and why they are important
subroutines and parameters; dummy (formal) parameters vs. actual parameters
black boxes; and separation of interface from implementation
the access modifiers "public" and "private" 
return types and the return statement; void
the dual nature of classes: the static part and the non-static part
scope of a variable; local variables vs. global variables
named constants and the "final" modifier; why named constants are used
packages; importing classes from packages
top-down and bottom-up design
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"
arrays; referring to array elements as for example A[i]
base type of an array
elements of an array
length of an array, A.length
index of an element in an array
using "new" to create arrays, for example:  new int[10]
using for loops to process arrays
basic array processing such as summing, counting, finding a max
two-dimensional arrays; using nested for loops with two-dimensional arrays

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

extending a class
subclasses and superclasses
inheritance
class hierarchies
polymorphism
object-oriented programming
class Object; every class is a direct or indirect subclass of Object
the access modifier "protected"
assignment rules for objects: 
     a variable of type Foo can refer to an object belonging to a subclass of Foo

abstract classes and abstract methods
interfaces (i.e. the Java reserved word "interface")
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

random access to array elements
initializing an array
searching and sorting arrays
sorting algorithms: selectionSort
linear search
binary search  [ but not the details of the binary search algorithm ]
how to think about the efficiency of an algorithm
why binary search is so much faster than linear search

GUI stuff (see below)

And here are some aspects of GUI programming that you should know:

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)
colors; color constants such as Color.RED and Color.BLACK; new Color(r,g,b)
elements of GUI programming:   components, layout, events, graphics
the JPanel class
layout and layout managers
BorderLayout, GridLayout, FlowLayout
using a JPanel as a container for building complex GUI layouts:
    panel.setLayout(layoutManager), 
    panel.add(component)  [ for GridLayout or FlowLayout ]
    panel.add(component, BorderLayout.position) [ for BorderLayout ]
events, listeners, and event-handlers
representing the "state" of a program in instance variables
using a JPanel as a drawing surface
the paintComponent(Graphics g) method; calling super.paintComponent(g)
repaint()
the paintComponent method should look at state variables to decide what to draw
event-handling methods can base their action on current state and can change the state
repaint() should be called when the state is changed
listener interfaces; ActionListener and MouseListener
the ActionListener interface:  public void actionPerformed(ActionEvent evt)
ActionEvent methods: evt.getSource(), evt.getActionCommand()
the basic MouseListener method:  public void mousePressed(MouseEvent evt)
MouseEvent methods:  evt.getX(), evt.getY()
adding event listeners to components; addActionListener, addMouseListener
basic components:  JButton, JTextField, JLabel
using getText() and setText() with buttons, textfields, and labels
adding an ActionListener to a JButton:  button.addActionListener(listener)
adding a MouseListener to a panel:  panel.addMouseListener(listener)