1



Test 1 – CSCI-140Student Name: ____________________________________________Score __________ PART 1. Short Answers. Enumerate and write your answers on the lines below. (4 points each) Briefly explain the difference between a parameter and an argument. Angles in arcs can be specified in three ways in Processing. Briefly describe two of them.The line() function has 4 parameters. What is the meaning of EACH one?What is the main difference between setup() and draw() in terms of how the code blocks are run? NUM 1) A parameter is a place holder or a special variable where information is passed into a function. An argument is the actual value used in functions. NUM 2) Angles can be specified:-in radians; -in degrees (by converting into radians) -or by special names of common anglesNUM 3)line(x1,y1, x2,y2) refers to the beginning coordinates of the line and the ending coordinates. NUM 4) Codes in setup are run once. Codes in draw are run repeatedly, at the default rate of 60 frames per second. Use the flip side of this page if you run out of space PART 2. Multiple Choice. Circle the letter of the correct answer (3 pts. each) Which of the following programming languages is Processing based on?ActionScriptJavaPythonC++Which of the following is NOT a primitive shape?point()line() circle() rect()Which of the following statements best describes the graph system in Processing?Positive x runs from left to right, positive y runs from top to bottom.Positive x runs from top to bottom, positive y runs from left to right.Positive x runs from right to left, positive y runs from bottom to top.None of the abovemousePressed() in is an example of a(n):functionclassparameterobjectWhich of the following functions is like a windshield wiper in that when placed within the draw() structure can be used to clear the Display Window before the next frame is drawn? draw()clear()background()fill()Grayscale color is defined with a range of numbers from:0-2550-320-10100-200The default for frameRate() in Processing is 510030 60One of the common types of variables in Processing is noted as: ingintegerinintThe fourth color component representing transparency is called: HexAlpha DeltaRadiusHow do you remove a stroke from a shape?stroke(0); NOSTROKE();noStroke() Stroke(NONE); Where do error messages appear in processing?As a separate webpage.In the Sketch window. In the Console.The program does not generate error messages. The meaning of concatenate is: To joinTo separate To parse To provide proof Part 3. Writing code and writing about code. Be sure to write clearly and exactly the way they would look in your Processing program. (6 points each) Write the one-line code to change the color of a stroke to red? stroke(255, 0, 0)Modify the code below to create a multiline comment. Do not use the single line comment ///*Assignment #1, by James JonesThe program illustrates how variables work.The first declaration is a global variable. */Consider the game Pong. Name 3 of the variables you would need to program the game. For each briefly cite its purpose. paddle1: to control paddle for player 1paddle2. To control paddle for player 2ballX: keeps track of horizontal position of ballscore: to keep track of score for player 1What do the 5th and 6th parameters represent in the arc() function? Hint: arc(x, y, w, h, ___, ___ )Beginning of arc and end of arc. Fix the two errors in the following block of code by striking through the errant parts and writing them the correct way.void draw() { stroke(0); fill(blue); example is 0, 0, 255 rectMode(center); CENTER rect(mouseX, mouseY, 26, 26, 5); }PART 4. Discussion. Write and enumerate your answers on the lines below. (10 points each) Briefly describe the philosophy of incremental development and why it is important in programming.Talk about the rules and best practices for creating variables. To satisfy this question, simply list 3 rules and 2 best practices. Num 1:See page xviii where it discusses the modularity of developing software (& step by step) Num 2: RULES One word, no spacesCannot start with numberNo punctuation or special character except “_”Must be unique BEST PRACTICESNames should be meaningful. Avoid words that appear elsewhere in processing, such as width, height, key, mouseX, etc. camelCase is a good idea ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download