Midterm Topics

CIS 211 - Computer Science II - Winter, 2003 - A. Hornof

 

You will need to write Java code and Unix and/or DOS commands. Completing Project 4 and testing all your code on Unix is a very good way to prepare for the exam. You should complete Project 4 before the exam.

The midterm will include but is not limited to the following topics.

  • How to open and read from a file as shown in L&L, using a FileReader, BufferedReader, and StringTokenizer, and catching and/or throwing exceptions.
  • How to open and write to a file as discussed in L&L, using a FileWriter, BufferedWriter, and PrintWriter, and catching and/or throwing exceptions.
  • All class and variable modifiers, including "abstract" and "interface", visibility modifiers, and class methods versus instance methods.
  • L&L Chapters 7 & 8, though you'll also need to know all previous chapters in order to write working Java code.
  • Exceptions: Throwing, catching, writing your own.
  • Inheritance: How to use abstract classes and interfaces. What kinds of restrictions they impose.
  • ArrayList: How to create one, add items, remove items, and traverse it.
  • How to create and use packages. How to set up a CLASSPATH in Windows, DOS, and/or Unix.
  • Static classes and variables. What are they? How do they work?
  • What is a singleton? How do you create one? This is discussed in Project 3, and is shown in the solution to Project 3.
  • All of the reading assignments on the course "Topics and Reading" web page, including compiling from the command line, basic Unix, and everything else listed. Be sure to log onto a Unix system and read the "man" page for "chmod". Do this early so you can email us in case you have difficulty with this.
  • Know how to read the entire contents of an "ls -la" command when issued at the Unix command prompt, and how to change permissions on folders and files. If you missed this lecture, you will need to get the notes from someone else in class.

The best way to prepare is to give yourself problems that incorporate the above concepts, such as the following:

Write a Java program that takes two filename arguments from the command line, quits with an error if two arguments are not provided, and then proceeds to copy each word in the first file to the second file, quitting with an error if the first file can't be read or the second file exists or can't be written.

You should then close all your books and notes, write the code as best as you can using paper and pencil, and then open your books and type it into the computer, fixing it until it is perfect. Then, close all your books and notes and again write it using paper and pencil. Continue until you can write it perfectly from your knowledge of Java.