CS 124, Spring 2017
Information on the Second Test

The second test for this course takes place in class on Wednesday, April 5. 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, arrays, and so on. The format will be similar to the first test, including programming problems, definitions, and short essay questions.

From the textbook, the test covers all of Chapter 4; Chapter 5, Sections 1 through 4; plus Subsections 5.5.1 and 5.5.2. This includes subroutines, objects, classes, and the most basic ideas about subclasses. You will certainly be asked to write subroutines. You might be asked to write a complete, short class or to complete the definition of a class that is already partially written. You should know how to use classes and objects. There will not be any questions about GUI programming on this test.

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
parameter list of a subroutine
subroutine call statements
dummy parameters (also called formal parameters)
actual parameters in a subroutine call
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
returning a value from a function
using function calls in expressions
the return statement in a function:  return <value>;
using a return statement in a void subroutine
throwing exceptions in subroutines

software toolboxes and APIs
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 the reasons for using them
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
classes are types, so can be used to declare variables, return types, and parameter types
creating a variable (of object type) does not create an object
a variable (of object type) 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

extending a class
subclasses and superclasses
a subclass inherits variables and methods defined in its superclass
how subclasses enable code reuse
class hierarchies
the class Object; every class is a subclass (direct or indirect) of Object