CSci 161 Midterm Exam
Topics for the Fall 2009 midterm exam:
Arrays
- ordered or unordered arrays
- insert, delete, search operations ... be able to code some of these
- Binary search of an ordered array ... where does the search begin? how does it proceed?
Objects: - constructors ... what do they do?
- fields ... what are they used for?
- methods ... what are they?
- modifiers: public, private, protected
Java I/O: - console output and keyboard input
- command line parameters ... be able to write code that fetches them
- InputStream and OutputStream: read and write bytes (only)
- file I/O: text files, binary files, files of objects
- higher lever tools: InputStreamReader, BufferedReader ... read a character, read a line
- higher lever tools: DataInputStream, DataOutputStream ... readInt(), readDouble(), writeInt(), writeDouble(), etc.
- higher lever tools: ObjectInputStream, ObjectOutputStream ... readObject(), writeObject()
- remote files and URLs
Exceptions:
- what is an exception? - one answer is this: a signal that some event important to your program has occurred
- examples of exceptions: array index out of bounds, division by zero, end of file, file not found, ...
- exceptions can be handled or thrown ... what do these words mean?
- when is it necessary to handle an exception?
- what Java code is required in order to handle an exception?
- what is the alternative to handling an exception?
- what java code is necessary in a method that does not intend to handle an exception?
Stack: - push(), pop(), peek() methods and their descriptions
- efficiency of the push() and pop() methods for a stack containing N items ... answer O(1) if well implemented using an array
- the Stack interface ... be able to code it in Java
- be able to code one or more of these methods
Queue: - enqueue(), dequeue(), front() methods and their descriptions
- efficiency of the enqueue() and dequeue() methods for a queue containing N items ... answer O(1) if well implemented using an array
- the Queue interface ... be able to code it in Java
- be able to code one or more of these methods
Priority Queue:
- insert(), delete(), peek() methods
- efficiency of insert() and delete() for a queue containing N items when implemented as an unordered array ... O(1), O(N)
- efficiency of insert() and delete() for a queue containing N items when implemented as an ordered (by priority) array ... O(N), O(1)
Simple sorting algorithms:
- insertion sort ... what does a array look like after 1 pass? after 2 passes? ...
- bubble sort ... what does a array look like after 1 pass? after 2 passes? ...
- selection sort ... what does a array look like after 1 pass? after 2 passes? ...
- efficiency of these algorithms is O(N2)
Recursion -
- what is recursion?
- how and why does recursion work?
- 3 things to check for are ...
-
Old Exams:
Fall 2005 (with solutions),
Spring 2006 (without solutions),
Fall 2007 (without solutions),
Spring 2008 (with solutions)
Fall 2009 (with solutions)