Presentation is loading. Please wait.

Presentation is loading. Please wait.

Test 2 Review. General Info. All tests are comprehensive. You are still responsible for the material covered prior to the first exam. You will be tested.

Similar presentations


Presentation on theme: "Test 2 Review. General Info. All tests are comprehensive. You are still responsible for the material covered prior to the first exam. You will be tested."— Presentation transcript:

1 Test 2 Review

2 General Info. All tests are comprehensive. You are still responsible for the material covered prior to the first exam. You will be tested more on your ability to understanding code than on your ability to write code. There will be multiple choice and true/false questions. Studying this review is not enough; you are responsible for all material covered in the lecture notes.

3 Topics covered since last exam Writing and calling functions Manipulating images and text on the canvas Creating Interactive programs –Mouse and keyboard event handler functions –Mouse and keyboard built-in variables Using the functions:loop(), noLoop(), and reDraw() Using arrays Creating object orientated programs using classes and objects

4 Writing and calling functions Questions 7-9 from exam 1. Study the program targets.pde and answer the questions below.targets.pde What will be drawn by this program? How many parameters does the function drawTarget() have? Is there anything wrong with calling the function drawTarget() as shown below. drawTarget(100, 100, 100); What does the word void mean in the function definition : void drawTarget(int xloc, int yloc, int outerDia, int numCircles)

5 Manipulating images and text If the color depth of an image format is 8 bits, how many distinct colors can be represented? Name one image format that provides lossless compression and one that provides lossy compression. Does this command cause an image (that is stored in the sketch data folder) to appear on the canvas? PImage img=loadImage(“cartoonFace.gif"); Describe the difference between the data type String and the data type char. Is this a legal statement in Processing: ‘5’ + 5 ; What is printed by this statement: println(boolean(5)) ; Does this command cause text to appear on the canvas: PFont f = loadFont("Albany-48.vlw“, 40);

6 Creating Interactive programs Compare and contrast the programs mousey.pde and mousePressed.pde, and answer the questions below. mousey.pdemousePressed.pde –Which program contains an event handler? –Do the programs respond to user inputs differently? Explain the differences; be specific. –How is the function mousePressed() called? –What values are stored in the variables mouseX, mouseY ?

7 Functions: loop(), noLoop(), and reDraw() Study the program loopNoLoop.pde and answer the questions below.loopNoLoop.pde –Does the program contain any event handlers, and if so how many? –Explain exactly what the program does when it’s running and the user interacts with the program by: (1) pressing a key on the keyboard, or (2) pressing a mouse button.

8 Arrays Declare an array large enough to hold 100 float variables. Declare an array of 10 integers and store the value 1 in each element in the array. Explain what happens when the following segment of code is run. float[] coswave = new float[100]; for (int i = 0; i < 100; i++) { coswave[i] = i; }

9 Classes and Objects Explain the relationship between an object and a class. Study the Spot class and the program ExplodingSpots that uses that class. Answer the questions below.Spot ExplodingSpots –Identify the Spot class constructor. –Identify a line of code in which that constructor is called. –Identify a line of code in which a Spot object is created. –How many data members does the Spot class have?


Download ppt "Test 2 Review. General Info. All tests are comprehensive. You are still responsible for the material covered prior to the first exam. You will be tested."

Similar presentations


Ads by Google