Programming in Java I - Mendelsohn

Midterm Study Guide

Exam details

The exam is currently scheduled to be in our usual room – but this may change. I will e-mail you if it does. The exam must be done individually. No collaboration of any sort is allowed.

The exam will consist of two parts:

1.  A pencil/pen and paper written part, to be done first, and

2.  A coding part to be completed after the written part

At the start of the exam period you will get the written portion of the exam. When you have completed that part you will hand it in, get instructions for the second part of the exam, and log into your lab computer. The code you produce for the second part of the exam will be submitted via COL.

The exam will consist of a mix of:

·  Short-answer questions; you should be able to clearly articulate concepts and definitions using sound terminology

·  Java programs to trace

·  Fragments of Java programs to trace

·  Java code to debug

·  Java programs to produce according to specifications in English

·  Fragments of Java code to produce according to specifications in English

·  JEnglish code to produce; for example, you might be given a description of a problem and asked to come up with a plan for the solution

The exam is closed book. You may use one double-sided sheet (8 ½ x 11 inches) or two single-sided sheets (8 ½ x 11 inches) of notes. The sheet(s) of notes (with your name at the top) must be handed in at the end of the exam period. You may not use any other written materials. During the first part of the exam, no electronic devices are allowed. During the second part of the exam, the only electronic device allowed is the lab computer – cell phones, PDAs, etc. must be kept off and put away.

Note: Any concept that has appeared in the programming assignments, on the OWL exercises, in the lab exercises, or during lecture is a possible topic for the midterm. I would recommend reviewing your previous assignments and reading your notes. You may also want to review the relevant sections in the textbook.

Do not assume that you are prepared for the exam just because you turned in all the assignments and got a decent grade. Keep in mind that when you are doing your homework you are using a lot of support materials such as notes, the book, the compiler, interaction with colleagues, interaction with me, etc. You also have a lot of time to do the assignment and ask questions. Most of this support system is not available when you take the exam. There are also added stress factors, including the time constraint, grade anxieties, no possibilities of discussing the work with anyone, etc. As a result, you need to master the material thoroughly before the test, in order to build the confidence that will help you perform to the best of your abilities. This week is the time to clarify all the little details that are fuzzy in your head. Figure out why everything that you did worked for the homework.

Important topics

The following are the high level concepts covered by the exam. This is just a summary and should be used as a check list to make sure you have not missed any topic.

1.  Introduction. Basic concepts (algorithm, programming language, syntax). Running Java programs (compilation, interpretation). The basic structure of Java applications (rules for naming files, comments). Creating, compiling, and running a Java program from the command line and using BlueJ.

2.  Classes and objects. Using Java packages and import statements. Using the Java API. The String class (especially length, charAt, indexOf, substring, the concatenation operator, toUpperCase, toLowerCase, and compareTo or equals or equalsIgnoreCase). The Scanner class (see the next section for details). The Math class (especially the random method). The Shapes example in BlueJ, including instantiating objects and using methods. Invoking methods, including methods with parameters. Using values returned by methods.

3.  Input and output. Input (nextInt, nextDouble, and next). Output (System.out.print and System.out.println). I/O using the JOptionPane class (showMessageDialog, showInputDialog). Parsing Strings as numeric values to obtain numeric input from dialog boxes.

4.  Programming basics. Variables and identifier rules. Primitive data types (int, double, char, boolean). Assignment statements. Arithmetic operators and expressions. Incrementing and decrementing. Data type conversion and casting for primitive types.

5.  Branching. Boolean expressions, relational operators, logical operators, and if and if-else statements, including nested if-else statements.

6.  Looping. While loops