CS 111 - 2/20/14 Exam 1 on Tuesday, 2/25/14 during lecture 2 Parts Part 1 - 20 Multiple choice questions These will be graded using the "scan-tron" forms, so bring a #2 pencil Each question is worth 3 points each. Part 2 - 2 Write code questions Each question is worth 20 points. int x, y, z; x = 12; y = 4; z = 7; while ( x < 9 ) { z = z + x + y; x++; y++; } x: 12 y: 4 z: 7 int x = 0; int y = 1; int z = 2; while ( x < 3 ) { y = y + z; z = z + y; x++; } x: 0 1 2 3 y: 1 3 8 21 z: 2 5 13 34 int x; int y; int z; x = 0; y = 0; z = 0; while ( x < 8 ) { y++; z = z + x + y; x ++; } x: 0 1 2 3 y: 0 1 2 3 z: 0 1 4 9 ----------- int index = 0; int y = 1; int z = 1; while ( index < 4 ) { y = z + 3; z = y + z; index++; } index: 0 1 2 3 4 y: 1 4 8 16 32 z: 1 5 13 29 61 --- int index = 0; int y = 1; int z = 1; while ( index < z ) { y = z + 3; z = y + z; index++; } ------------- the turn for a 12 sided polygon could be t.turn (360/12); Beware of the following: > System.out.println ("The value is: " + 5 + 3); The value is: 53 > System.out.println ("The value is: " + (5 + 3)); The value is: 8 > System.out.println ("The value is: " + 5 * 3); The value is: 15 > System.out.println (5 + 3 + " will be the answer"); 8 will be the answer