1 / 9

Test 2 Review

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 more on your ability to understanding code than on your ability to write code. There will be multiple choice and true/false questions.

leo-shannon
Download Presentation

Test 2 Review

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 notenough; 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. • 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? PImageimg=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. • 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. • 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 Spotclass and the program ExplodingSpots that uses that class. Answer the questions below. • 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?

More Related