CS 101 - 9/27/11 Thursday: Exam 1 during lecture 22 questions 20 multiple choice (3 pts each, total 60 points) Scan tron answer sheets => #2 pencil!!!! Answers: a,b,c,d,e trace code variables types assignments and operators: + - * / 7/2 7.0/2.0 % while loops (relational operator) methods (parameters) general knowledge setup of Java programs programming style use of turtles 2 write code - both doing turtle drawings #21 - write code make sure variables are declared and initialized #22 - write method: draw shape using a loop first line: public static void q22 ( Turtle tparam, int width, int height ) { // write the needed code } While loop: int counter; counter = 0; int counter2 = 0; while ( counter < 10 ) { .... counter = counter + 1; } Tuesday 11:59 pm Extra credit for writing a multiple choice question in Blackboard. 1% added to end of semester grade What is the value of z when the following code finishes its execution? int x = 0; int z = 0; while ( x <= 4 ) { z = z + x; x = x + 1; } a. 4 b. 5 c. 6 d. 7 e. None of the above Create a variable table: x: 0 1 2 3 4 5 z: 0 0 1 3 6 10 int x = 5; int y = 0; int z = 0; while ( x > 0 ) { y = y + z z = z + y; x = x - 1; } a. 4 b. 5 c. 6 d. 7 e. None of the above System.out.println ("The answer is: " + 5 + 7 );