CIT 591 Sixth Quiz
Fall 2001, Dave Matuszek
Name __________________________________

All answers must be kept brief. Points may be taken off for unnecessarily long or detailed answers.

  1. In order to write objects to a file, what interface must those objects implement?

  2. What kind of memory (or "knowledge") does a pure state machine use to keep track of the current state of the computation?
              Only the current state

  3. If a pure state machine does not produce any output, how can you get any result from running it?
              By observing which state it ends in

  4. What control structures would you use in order to implement a state machine in Java?
              A switch statement embedded in some kind of loop

  5. What does the String method trim() do?
              Removes whitespace from both ends of a String

  6. What is the value of the expression "ABCDEFGHIJ".substring(2, 5) ?

  7. When should you use a StringBuffer instead of a String?
              When you need to make a lot of changes to the string

  8. What happens when the capacity of a StringBuffer is exceeded?
              It is automatically copied to a new, larger capacity area

  9. What are the two ways of creating Threads?
              extend the Thread class
              implement the Runnable interface

  10. What are the four states of a Thread? (Just name them, don't describe them.)
              ready, running, waiting, dead

  11. When you create and start a new Thread, which method does the new Thread execute?

  12. What keyword is used to prevent more than one Thread from accessing an object at the same time?

  13. Name four of the five Stack methods.
              Any four of: push, pop, peek (not peep!), empty, and search