CS 124, Spring 2021
Information on the Second Test

The second test for this course takes place in class on Wednesday, March 31. The test will be given in person except for the two people who are taking the class completely remotely and people who are in quarantine or cannot come to class for some other reason. You should, of course, not come to class if you are sick. I will make arrangements with the remote students and with any students in official quarantine before the test. If you can't come to class on the day of the test for some other reason, I will make arrangements with you later to take a make-up test.

The test 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 essay-type questions.

From the textbook, the test covers all of Chapter 4 except for Section 4.5 and subsections 4.6.4 and 4.6.6, plus Sections 5.1 and 5.2. This includes subroutines, objects, and classes. You can expect the test to concentrate more on subroutines than on classes. You will certainly be asked to write some subroutines. You might be asked to write some code that calls a subroutine or to figure out the purpose of a subroutine. You might be asked to write a simple, short class. You should know how to write code that calls subroutines and code that creates and uses objects. There will not be any questions about lambda expressoins or 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 in Java as "methods")
the syntax for subroutine definitions
the access modifiers public and private
return type of a subroutine
void
parameter list of a subroutine
subroutine call statements
formal parameters (also called dummy parameters)
actual parameters (in a subroutine call statement)
how actual parameters are passed into a subroutine
local variables in subroutines
global variables
functions
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
IllegalArgumentException

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

the relationship between classes and objects
creating objects from classes with "new"
instance of a class
instance variables and instance methods 
static versus non-static
how the non-static part of a class is used when objects are created from the class
pointers to objects (also called references)
null
classes are types, so can be used to declare variables, return types, and parameter types
declaring 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
an assignment statement applied to objects will only copy a pointer, not an object
controlling access to instance variables by making them private
getters and setters and why they are used
constructors
the toString() method in a class