CPSC 225 Fall 2007
Information About the Second Test


The second of the two in-class tests in CPSC 225 will take place in class on Friday, November 2. The test will cover everything that we have done since the second test. This includes the following sections from the textbook: 9.3, 9.4, 11.1, 11.2, 11.3, 11.4.1, 8.5.1, and 8.5.2. There might also be some questions based on the labs. You are not required to know every detail of Sections 11.1 through 11.3, but you should be able to work with the concepts from those sections that are in the list below.


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


Abstract Data Type (ADT)
stacks
stack operations: push, pop, isEmpty
array implementation of stacks
linked-list implementation of stacks
using a stack as a replacement for recursion
postfix expressions
using a stack to evaluate postfix expressions
queues
queue operations: enqueue, dequeue, isEmpty
linked-list implementation of a queue
binary trees
nodes in binary trees
tree terminology:  root, sub-tree, parent, child, leaf
recursive processing of binary trees
tree traversal
pre-order, in-order, and post-order traversals
Binary Sort Tree (BST)
the binary sort tree property (how are items arranged)
in-order traversal of BST visits items in sorted order
inserting an item into a binary sort tree
searching a binary sort tree
expression trees
finding the value of the expression represented by an expression tree
in-order traversal of expression tree yields infix expression
post-order traversal of expression tree yields postfix expression
implementing an expression tree with a class hierarchy
   (abstract class ExpNode with subclasses like ConstantNode and BinOpNode)

I/O
the stream abstraction
binary streams versus character streams
binary stream classes InputStream and OutputStream
character stream classes Reader and Writer
flushing an output stream
error-handling for I/O operations
IOException
FileNotFoundException
how to open a file for output and send data to it using a PrintWriter
how to open a file for input and read data from it using a Scanner
techniques for representing data in text form

networking
IP address
port number
domain name
mime types such as text/html and image/png (used for content types in URLConnection)
I/O operations can "block"

threads
why threads are important for network applications
creating a subclass of the Thread class
a thread's run() method
the start() method of a thread
the Thread.sleep(milliseconds) method (throws InterruptedException)


the File class

    constructors:  new File(fileName)
                   new File(containingDirectory, fileName)
    method:  file.exists()


the PrintWriter class

    constructors:  new PrintWriter(file)  -- parameter of type File
                   new PrintWriter(fileName)  -- parameter of type String
                   new PrintWriter(stream)  -- parameter of type OutputStream or Writer
    methods:  writer.print(x)  -- parameter of any type
              writer.println(x)  -- parameter of any type
              writer.flush()
              writer.close()
              writer.checkError()  -- returns a value of type boolean


the Scanner class

    constructors:  new Scanner(file)  -- parameter of type File
                   new Scanner(stream)  -- parameter of type InputStream or Reader
                   new Scanner(str)  -- parameter of type String (reads from the string)
    methods:  next(), nextLine(), nextInt(), nextDouble(),
              hasNext(), nasNextLine(), hasNextInt(), hasNextDouble()


the URL class

    constructors:  new URL(address)  -- can throw MalformedURLException
                   new URL(context, relativeAddress)
    methods:  openConnection()  -- returns an object of type URLConnection


the URLConnection class

    constructors:  (get a URLConnection from a URL instead)
    methods:  getInputStream()
              getContentType();


David Eck