CS 101 - 11/8/11 Labs this week (Friday, 11/11/11) will be held in 2249 SEL right across the hall from normal lab location. --------------------- Exam 2 - Thursday, 11/10/11, during lecture Format is the same as Exam 1 - 20 multiple choice questions - 2 write code questions Topics: - Picture manipulation - each pixel has two sets of data - color information - X,Y position of the pixel - Java Statements (Trace code questions) - for loops - nested loops - If statements - Nested If and loop statement - Boolean Operators && and || or ! not Truth table X Y | X && Y X || Y !X ================================ T T | T T F T F | F T F F T | F T T F F | F F T ((x < 5 && y >= 7) || (x != 3 && z == 0)) ( T && F ) || ( T && T ) F || T T - methods return statement/ return value parameters First line of the method y = 0; z = 0; for ( x = 0 ; x < 5 ; x++) { z = y + z; y = x + y; } =============== y = 0; z = 0; for ( x = 0 ; x < 5 ; x++) { z = y + z; if (y < 4 ) { y = x + y; } } ============== x = -7; z = 0; if ( x < -5 ) z = z + 1; else if (x < 0 ) z = z + 2; else if (x < 5 ) z = z + 3; =============== x = -7; z = 0; if ( x < -5 ) z = z + 1; if (x < 0 ) z = z + 2; if (x < 5 ) z = z + 3; ================ x = -7; z = 0; if ( x < -5 ) z = z + 1; else if (x < 0 ) z = z + 2; else if (x < 5 ) z = z + 3; else z = z + 4;