- designing an optimal strategy for playing Nim - get a strategy and show why it's optimal - write down in comments the exact steps for performing that strategy - put that strategy into code - emphasize the use of logical structures: AND, OR, and NOT - go over topics for the midterm
You will have an entire normal class period to complete the exam. There will be 3 types of questions. Some will be of a form similar to true/false questions. Some will be of the form "what does this program output". For some you will have to write out code for small programs.
For the exam you will be able to bring in one normal-sized (8 1/2" x 11") page of notes. The notes can be on both sides of that page, but everything must be written by hand. No photo-copying. No typing.
<html> <head> </head> <body> </body> </html>
byte, short, int, long, float, double, char, boolean
) uses up a specific amount of memory. For example, a byte
always uses up 8 bits of memory.
if, while, do-while
, and for
program statements as well as how to use each.
String name = "boozer";
. The type of name
is reference to a String
object.
String
class. You will still need to know how to declare and initialize variables that reference String
objects. Remembering that strings are immutable and understanding what that means would also be a good idea.
int x = 3;
I could set x
equal to some other variable with the type int
or equal to some method that has a return type int
.int
's or String
's, but not both).
public static void main(String[] args){ String word1 = "hip-hop"; String word2 = "hip"; word2 = word2 + "-hop"; if(word1 == word2) System.out.println("The two strings are equal."); else System.out.println("The two strings are not equal."); }
public static void main(String[] args){ int num1 = 0; int num2 = 1; int num3 = 2; if(num1 > num2 > num 3) System.out.println("The numbers are in order."); else System.out.println("The numbers are out of order."); }
public static void main(String[] args){ int num1 = 0; for(int i=0; i < 128; i++){ num1++; } System.out.println("After incrementing " + i + " times, the value of num1 is: "+num1); }
public static int findLowest(int num1, int num2, int num3){ }