CS 124, Spring 2014
Information on the Second Test

The Second test for this course takes place in class on Wednesday, April 9. It will cover material that we have seen since the first test, but you will still need to know earlier material about variables, control structures, and so on. The format will be similar to the first test, but might have a higher proportion of programming problems

From the textbook, the test covers all of Chapter 4; Chapter 5, Sections 1 through 4; and Sections 7.1, 7.5.1, and 7.5.2 from Chapter 7. This includes subroutines, objects, and the basics of one-dimensional and two-dimensional arrays. You will certainly be asked to write subroutines. You will not be asked to write a complete class from scratch on this test, but you should know how to use classes and objects. You are also responsible for material from Labs 5 through 8, except that there will be no questions about Eclipse.

Here is a list of some of the things that you should know about:


black box
implementation of a black box
interface of a black box
how black boxes help to manage complexity
subroutines as black boxes

subroutines (also known as "methods")
the syntax for subroutine definitions
access modifiers, public and private
return type of a subroutine
void
parameter list of a subroutine
subroutine call statements
dummy parameters (also called formal parameters)
actual parameters (also called arguments)
how actual parameters are passed into a subroutine
type rules for passing parameters and returning values (same as for assignment)
local variables in subroutines
global variables
functions
returning a value from a function
using function calls in an expression
the return statement in a function:  return <value>;
using a return statement in a void subroutine
throwing exceptions in subroutines
IllegalArgumentException
top-down design
bottom-up design
how subroutines are used in top-down and in bottom-up design

software toolboxes and APIs
Javadoc
Javadoc comments and why they are used
packages; what it means for a class to be in a package
importing classes from a package

combining declaration with initialization; for example:   int x = 17;
final variables; named constants and why they are used
scope of a variable
default initial values for global variables

the relationship between classes and objects
creating objects from classes with "new"
static versus non-static
how the non-static part of a class is used when objects are created from the class
instance variables (representing the "state" of an object)
instance methods (representing the "behavior" of an object)
how to refer to instance variables and methods in an object
pointers to objects (also called references)
the heap
null
classes are types, so can be used to declare variables, return types, and parameter types
creating a variable (whose type is a class) does not create an object
a variable (whose type is a class) can never hold an object, only a pointer to an object
implications of pointers for assignment and comparison
an assignment statement applied to objects will only copy a pointer, not an object
the == and != operators applied to objects only compare pointers, not object contents
controlling access to instance variables by making them private
getters and setters and why they are used
constructors -- how to recognize them, how to write them, how to use them
the toString() method in a class
garbage collection
object-oriented programming; how to design a class

arrays
elements of an array
base type of an array
index of an element in an array
length of an array
two-dimensional arrays
arrays in Java are objects
ArrayIndexOutOfBoundsException
array types, such as int[], String[], Color[][]
declaring array variables, such as:   String[] questions;
creating arrays with "new"; for example:   questions = new String[10];
using array elements as variables in expressions and assignments
using for loops to process arrays
basic array processing, such as adding up the items in an array

basic ideas of GUI programs
using instance variables to store the "state" of the program
events and how they can change the state
paintComponent displays the current state to the user
repaint()