
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: Introduction to Computing Using Java; Subject: Computer Science; University: Cornell University; Term: Unknown 1989;
Typology: Study notes
1 / 1
This page cannot be seen from the preview
Don't miss anything!

For this prelim, you need to know everything that you needed to know for the first two prelims (see review below). The handout for Prelim II (which you can get from the course webpage) contains a list of topics as well as a collection of concepts and definitions. These deal with classes, subclasses, the class hierarchy, in- heritance, overriding, casting, operator instanceof, ab- stract classes, kinds of variables, methods and calls on them, executing method calls, function equals, wrapper classes, etc. In any course such as this one, the material is cumula- tive, and you need the old material to understand and use the new material. Therefore, all material in the course is fair game for the prelim. Besides your normal studying, spend time, frequently, practicing writing and testing Java code; that is the only way to gain real fluency. Many of you restrict your use of DrJava to what is required on the assign- ments and labs. That is a mistake; you are not required to limit yourself to labs and assignments! For example, if your answers to a sample prelim don’t match our solutions, try typing in your (or our) solutions to DrJava and seeing what happens. Below, we give some more details on what can be on prelim 3: For loops. We may give you a problem that requires you to write a loop (with initialization) that processes a range of integers. You should be able to write a post- condition, then write the loop header " for ( int k ...)", then write a loop invariant, and finally develop the various parts of the loops and initialization. While loops. We may give you a precondition, post- condition, and a loop invariant, and you will have to develop the loop, with initialization, from it. The grade will depend on how well you deal with the four loopy questions and the given invariant. The only variables that should be used (outside of variables declared in the repetend) are variables that are mentioned in the loop invariant. Arrays. Everything on Sects 8.1 and 8.2 of the class text —these pages discuss the technical details for us- ing arrays in Java and for reasoning about arrays, in- cluding the range notation h..k (where h..h-1 is al- lowed, and indicates the empty range). Two dimen- sional arrays: You should know how to declare and use rectangular arrays but not ragged arrays ; see Sects. 9.1, 9.2. Algorithms. You should know the following algo- rithms. For example, if we ask "what is algorithm parti- tion?"; you should be able to write the precondition and postcondition (we won't give them to you), write down the invariant, and then develop the loop with initializa- tion. These algorithms are discussed in the text, on the ProgramLive CD, and in lectures notes: Algorithm Binary search (Sec. 8.5.3) Algorithm Dutch national flag (done in lecture) Algorithm Partition (PLive activity 8-5. class notes may be better) Selection sort (Sec. 8.5.4) Insertion sort For selection sort and insertion sort, the repetend should be written in English, stating what the repetend does and not how it does it. Since you know that at least one of these algorithms will be on the test, prac- tice developing all of them. Answering this question should take 5 minutes, because you know how to de- velop them. Classes String and Vector. We use these all the time. You are expected to know the basic methods of these classes: For class String: charAt(i), substring(i), sub- string(i,j), length(). For Vector: add(ob), set(i, ob), get(i), size(). If a question calls for other methods of the classes, we will define them for you. You should know that new Vector