The first test for this course takes place in class on Monday, October 5. It will cover material from classes and labs as well as from assigned readings. The test will be four pages long. It can include definitions and short answer questions similar to those given on the quizzes; longer essay-type questions; questions that ask you to write code segments or a complete program; and questions that ask you to determine the purpose or the output of a given code segment.
The test covers material from Chapters 1, 2, and 3 of the textbook. From Chapter 1, we covered only some basic concepts from Sections 1.1 to 1.4. We covered all of Chapter 2 except for enum types (Subsection 2.3.3) and programming environments (Section 2.6). We covered pretty much all of Chapter 3 except for the material related to enums (3.4.4 and 3.6.3). Note that the material on GUI programming in Section 3.8 has been covered in lab. You are not responsible for every detail of this reading. In particular, you are not responsible for memorizing every subroutine defined in Math, TextIO, and String; see the lists, below, of subroutines for which you are responsible. You will not be asked about the switch statement or the try..catch statement or about specific examples, such as the 3N+1 problem, that are covered in the text. There will be no questions on Linux or the command-line environment, except possibly for the javac and java commands and the general process of editing, compiling, and running a program.
Here is a list of some of the things that you should know about:
CPU computer programs machine language high-level programming language compiler Java bytecode Java Virtual Machine syntax semantics how to compile and run a Java program the basic structure of a Java program (memorize it!): public class <program-name> { public static void main(String[] args) { <statements> } } identifiers reserved words compound names (with ".") such as System.out.print or str.equals variables types Java's primitive types: int, double, char, boolean the String type literals Java literals of various types (numeric, char, String, boolean) special characters in char and String literals, such as '\n' binary numbers int values are 32-bit binary numbers assignment statements different meaning of variables on the left or right of = type compatibility rules for assignment statements declaring variables subroutines parameters in subroutines subroutine call statements functions important functions in the Math class: Math.random(), Math.sqrt(x), Math.pow(x,y) important functions in any String: str.length(), str.charAt(i), str.equals(str2), comparing Strings with str.equals(str2) instead of str == str2 System.out.print(x) and System.out.println(x) formatted output with System.out.printf(formatString, v1 v2, ...) important format specifiers for use in the formatString of printf: for example: %s %4d %1.2f %12.8g TextIO important TextIO input functions: TextIO.getln(), TextIO.getlnInt(), TextIO.getlnDouble() Using TextIO to read from a file, using TextIO.readFile(fileName) TextIO.eof() expressions operators precedence of operators and using parentheses to control order of evaluation important operators: + - * / % == < > != <= >= && || ! ++ -- type-casting, especially using (int) and (double) for type-casting numbers the / and % operators for integers using the + operator with a String the assignment operators += and -= statements control statements the empty statement: ; block statements: { ... } while statement: while ( condition ) statement for statement: for ( initialize ; condition ; update ) statement do..while statement: do statement while condition simple if statement: if ( condition ) statement if..else statement: if ( condition ) statement else statement using if..else if... using while(true) loops using break in a loop infinite loops priming a loop flag variable algorithm pseudocode algorithm development using pseudocode and step-wise refinement bugs and debugging exceptions how exceptions affect the flow of control the paintComponent() method in GUI programs using the Graphics class for drawing pixels and coordinate systems for drawing important subroutines in a Graphics object: g.setColor(c), g.drawRect(x,y,w,h), g.fillRect(x,y,w,h), g.fillOval(x,y,w,h), g.drawOval(x,y,w,h), g.drawLine(x1,y1,x2,y2), g.drawString(str,x,y) computer animation frames in an animation style rules and why they are important comments using // or /* ... */ formatting and indentation of programs