CPSC 225, Spring 2011
Information About the Second Test

The second test will be given in class on Wednesday, April 6. The test will cover everything that we have done since the first test, up to Friday, April 1. This includes material from Chapter 10, Sections 10.1 to 10.4; Chapter 11, Sections 11.1 through Subsection 11.4.2; Chapter 12, Subsections 12.1.1, 12.1.2, 12.1.3, and 12.3.3. We did not cover every topic in these sections. The format will be similar to the first test, with a mixture of definitions, essay-type questions, and coding questions.


Here are some terms and ideas that you should be familiar with:

generic programming
what problem does generic programming try to solve?
parameterized types; for example, ArrayList<T>
wrapper classes; Integer, Double, Character, etc.
using wrapper classes with parameterized types; for example, ArrayList<Integer>
methods in class Object: toString(), equals(x), hashCode()
"for-each" loops; for example:   for ( String str : strList )...
using a for-each loop to traverse a collection
the Comparable interface and the compareTo(x) method
the JCF (Java Collection Framework)
collections, lists, and sets
ArrayLists versus LinkedLists [differences; when to use]
HashSets versus TreeSets [differences; when to use]
maps
keys and values in maps
HashMaps versus TreeMaps  [differences; when to use]
using the keySet() from a map to traverse the map
uses of lists, sets, and maps
implementing a symbol table as a map of type HashMap<String,Double>
hash tables and their implementation as arrays of linked lists
how a hash code is used in a hash table
type erasure:  Parameterized types like ArrayList<String> don't exist at run time

Generic interfaces and classes in the Java Collection Framework:

    Collection<T>; methods:  add(x), remove(x), size(), clear(), isEmpty()
       List<T>; methods:  get(index), set(index,x), remove(index)
          ArrayList<T>
          LinkedList<T>
       Set<T>
          HashSet<T>
          TreeSet<T>
        
    Map<K,V>; methods: put(k,v), get(k), containsKey(k), keySet()
       HashMap<K,V>
       TreeMap<K,V>  
       
streams for input and output
files
how streams and files are abstractions and why that is important
binary streams versus character streams
Character sets and character encoding; for example, ISO-8859-1, UTF-8
InputStream and OutputStream
Reader and Writer
ObjectInputStream and ObjectOutputStream
IOExceptions
PrintWriter:  the methods print(), println(), checkError()
files, directories, and file paths
the File class; the exists() method, the length() method
FileInputStream and FileOutputStream
using a Scanner to read from a file
using a PrintWriter to write to a file
choosing a format for a data file
why use human readable (character) files?

threads and parallel processing
the Thread class
writing subclasses of Thread
the run() method in a thread
starting a thread with the start() method
the difference between calling run() and calling start() in a thread
threads run in parallel with other threads
race conditions; what can happen when two threads both use a shared resource
why access to shared resources needs to be controlled with synchronization
what it means for a thread to block
ArrayBlockingQueue<T> and LinkedBlockingQueue<T>
the put() and take() methods in a BlockingQueue (and why they can block)
using multiple threads in a "thread pool"