CS201 Final Exam Topics
The CS201 final exam is open book and open notes. You can use a computer
to access notes or look at programs you (or I) may have written, but you are not allowed
to compile programs or search for answers on the Internet. You have
two hours and 45 minutes. The emphasis is on material covered since the midterm
exam, but you will still need to know the basics from the prior
material. The topics that will be covered are listed below, with a major
emphasis on arrays, classes, inheritance/polymorphism, exceptions, file I/O, methods, and recursion.
Methods and Classes
- How to define a method
- Parameter passing
- Pass by value for primitive data types -- contents of original
variable in the caller unchanged
- Pass by reference for objects -- contents of an object variable in
the caller may be changed
- Concept of a class object and creating instances
of the object
- Class instance/member variables
- Class methods
- Creating a constructor
- When a constructor is invoked
- Public vs. Private (vs. Protected)
- Writing methods to access instance variables
- Concept of encapsulation or information hiding
- Static
- What happens when applied to methods, instance variables
- Scoping Rules
- Be prepared to trace through a program with different parameter
calls, scoping, and display the output!
- Method overloading (methods with the same name but
different input parameters)
Arrays
- How to define a 1 to N dimensional array of some data type
- Accessing, initializing arrays
- Limitations on arrays
- What if we use = on arrays?
- What if we use == on arrays?
- What if we exceed bounds of array?
- Can we make an array bigger?
- Array as an object
- How to pass an array to a function, pass by reference behavior
- Array length
ArrayList and
Generics
- Not on the final but you are welcome to use one in an
answer if you wish
Pointers / Reference
Variables
-
What is stored in a reference variable when we create
an object via "new" (i.e. address of object)
Inheritance
-
Using "extends" to create a derived class from a base class, or "implements" to create a class derived from an interface
-
What happens in derived class with base
class variables, methods (public or private or protected)
-
Using "super"
-
Method overriding
-
What we inherit from class Object
-
Multiple types for multi-level inheritance
-
Assigning types going "up" is no problem
-
Must typecast if assigning "down"
-
Dynamic binding - Java invokes the method based on the type of the object when it is created using "new" not the current reference
regardless of type
-
Concept of interfaces
Exceptions
- What an exception is
- try, catch
- Exception object, using different exception classes
(IOException, NumberFormatException, etc.)
File I/O
- Be able to read data (strings, ints, doubles, etc.) from a text file
- Be able to write data to a text file
Recursion
- Write a short recursive program
- Idea of a base case / termination condition,
recursive call