Terms

13
Chapter 1 Terms: Program: sequence of instructions that tell the computer what to do, written to solve a particular program Software: a collection of programs CPU (central processing unit): “brain” of computer that makes decisions, does arithmetic and manipulates computers memory RAM (random access memory): where computers can store and retrieve data Input devices: let us put data into a computer (eg. Mice, keyboards) Output devices: extract data from computer (eg. Monitors, speakers) Assembly language: directly control CPU and RAM Systems programming: writing programs related to a computer’s operating system Applications programming: writing programs intended to be used as applications by non- technical users Scripting: programming used to automate repetitive tasks Chapter 1 Questions: About how many low-level operations can a 2- gigahertz CPU do per second? – 2.5 billion Give examples that are input devices only: mice, keyboards, touchscreens, disk drives Output only: monitors, speakers, printers, disk drives BOTH: DISK DRIVES

description

CMPT 166

Transcript of Terms

Chapter 1 Terms:

Program: sequence of instructions that tell the computer what to do, written to solve a particular program Software: a collection of programs CPU (central processing unit): brain of computer that makes decisions, does arithmetic and manipulates computers memory RAM (random access memory): where computers can store and retrieve data Input devices: let us put data into a computer (eg. Mice, keyboards) Output devices: extract data from computer (eg. Monitors, speakers) Assembly language: directly control CPU and RAM Systems programming: writing programs related to a computers operating system Applications programming: writing programs intended to be used as applications by non-technical users Scripting: programming used to automate repetitive tasks

Chapter 1 Questions:

About how many low-level operations can a 2-gigahertz CPU do per second? 2.5 billion Give examples that are input devices only: mice, keyboards, touchscreens, disk drives Output only: monitors, speakers, printers, disk drives BOTH: DISK DRIVES What is assembly language? Programs which directly control CPU and RAM Good thing about assembly language? -- Problem with assembly language? programs become long and complex for simple tasks How is processing related to Java? Both are a high-level language designed for applications programming Two programming languages often used for writing low-level programs? C and C++ Program used for scripting? Python

Chapter 2 Terms:

Source code: text of a program, has two functions named setup() and draw() Variables: a named value Frame rate: number of times per second that draw() is called by a processing program, usually calls draw() 60 times per second Source code comment: a note for the person reading the program Parameters: an input to a function Statement: single line of code such as a function call or assignment

Chapter 2 Questions:

Size(500, 250); what does this do? sets width to 500 and height to 250 Processing statement that draws an ellipse of width 50 and height 75 at current mouse location Two variables that processing provides: mouseX and mouseY Purpose of semi-colon in processing program? marks end of a statement What does // indicate? A source code comment, note for reader of program

Chapter 3 Terms:

Pixel: smallest changeable region color on a computer monitor or image JPEG: typically used for storing photographs PNG: used for non-photographic images; website logos or icons, different levels of transparency GIF: older file format designed for same images as PNG, PNG preferred because PDF files are smaller and support more colors and levels of transparency

Chapter 3 Questions:

loadImage can load images directly from websites, why is this a bad idea? website links can usually change and images which were uploaded to the site may be taken down, causing the program to not function properly image(ball, mouseX, mouseY); what does this do? statement which draws an image named ball whose coordinates follow where the mouse pointer goes

Chapter 4 Terms:

File: a named collection of data on a disk Folders: a named collection of files and other folders File system: the files, folders and software used to store and retrieve data on a computer disk Absolute path name: a way to name files in a file system by listing the folders that contain the file before the name of the file On windows: C:\Desktop\courses\fall2011\cmpt166\ball.gif On MAC: /Desktop/courses/fall2011/cmpt166/ball.gif Relative path name: way to name files by having one folder designated to current working folder, all files assumed to be in that folder Current working folder: in relative path name this folder is the name of the top-most folder to be searched

Chapter 4 Questions:

Two problems with absolute path names? too long and often we dont know all the names of the containing folders

Chapter 5 Terms:

Bounding box: smallest rectangle that can be drawn around a graphical object

Chapter 5 Questions:

Why slanted lines look jagged when displayed on computer monitor? due to aliasing What are all the modes for ellipseMode? radius, center, corner and corners

Chapter 6 Terms:

RGB: combinations of different amounts of red, green and blue Triplet for orange is (255, 165, 0) Grey is (128, 128, 128)

Chapter 6 Questions:

Smallest possible value of RGB? 0 Largest possible value of RGB? 256 About how many colours can RGB specify? -- 16,777,216 Difference between nofill and (0, 0, 0)? nofill sets a completely transparent interior instead of a white interior Why are color variables useful? make program more readable, easier to change colours later What does alpha represent? transparency; 0 is transparent and 255 is opaque

Chapter 7 Questions:

5 different properties of fonts? location, style, size, weight and colour textFont size change problems? results in visual blemishes such as jagged edges or blurriness

Chapter 8 Questions:

What are three different things an image processing might do to an image? change transparency, tint and filter tint statement that would set transparency level to 10 without changing colour: tint(0, 0, 0, 10) explain filter(THRESHOLD, 0.5); converts image to black and white by converting brighter ones to white and darker ones to black, values range from 0.0 to 1.0

Chapter 9 Questions:

What does map function do? used to stretch and shrink ranges of numbers Map(x, low1, high1, low2, high2) For an exam score 36 out of 43, map function? map(36, / 0, 75, / 0, 100)

Chapter 11 Terms:

If-statements: statement that makes a decision about whether or not to execute a block of code Comparison operators (>=, 499) {y = 499 diam / 2;dy = -dy;}

if (x + diam / 2 > 499) {y = 499 diam / 2;dy = -dy;}

if (x diam / 2 < 0) {x = diam / 2;dx = -dx; }}

Chapter 13 Terms:

Int literals: integers (eg. Println(1 / 2); // 0 Mod operator: remainder operator (eg. Println(5 % 2); // 1) Float: number with a decimal on it (eg. Println(1.2 + 3.2); // 4.4) Dividing by 0.0 gets you infinity Println(5.6 / 0.0 5.6 / 0.0); // NaN (not a number) Int min: -2147483648 Float min: -3.4028235E38

Chapter 14 Terms:

Boolean expression: expression that evaluates to either true or false X >= y, greater than or equal to y X y, greater than y X < y, less than y X == y, x equal to y X != y, x not equal to y Logical operators: !a, not a a && b, a and b a || b, a or b

Chapter 16 Questions:

Advantages of Sprite class? variable names tend to be more descriptive and you dont have to define as many variables

Chapter 17 Questions:

Explain what dist function does? dist(x, y, a, b) returns the distance between (x,y) and (a,b) Difference between = and ==? = is an assignment operator (eg. ball.x = 100 to set balls initial position) == is the equality operator, returns true is left side is equal to right side (eg. (ball_color == color(255, 0, 0) what does mousePressed function do? checks if the mouse pointer is inside the object and if it is it sets out a command

Chapter 18 Questions:

float add5(float 3){return 8} what are void functions? print messages to the screen, do not return anything at all difference between return and print? Print: shows the human user a string representing what is going on inside the computer Return: main way that a function returns a value

Chapter 20 Terms:

String: a sequence of 0 or more characters, begin and end with s is an empty string, prints 1 \ is a newline character .length() gets the number of characters in a string

Chapter 20 Questions:

how to determine length of string s? println(s.length()); how to test if s and t are equal? if (s.equals(t)) {

Chapter 24 Terms:

WAV (uncompressed audio): default audio file format on Windows computers, uses about 10 megabytes per minute of sound Lossless compression: create compressed audio files due to a trick called run length encoding, 2:1 compression ratio Lossy audio formats: store audio in even more compressed than lossless compression (eg. MP3), some parts of audio are deleted Threads: special object that is allowed to run at same time as other threads

Chapter 24 Questions:

What is Minim? Audio library that uses JavaSound API, Tritonus and Javazoo MP3SPI to provide an easy to use audio library in Processing Processing statement to use Minim import ddf.minim.*; Why is MP3 popular? MP3 can compress audio into a file about 10 times smaller than the uncompressed audio Functions of Minim play many different sound files Record sounds and store them in files Apply sound effects in real time to sound files What does stop() function do? close the song, stop Minim and then call the stop() function of the parent object

Chapter 26 Questions:

Origin of screen in Processing coordinate system (0, 0) What does translate(5, 10) do moves the origin 5 pixels to right and 10 pixels down What does rotate(radians(45)) do rotates the entire coordinate system 45 degrees clockwise Describe what pushMatrix() and popMatrix() do used to save and restore systems coordinate system using a special region of memory called the transformation stack

Chapter 27 Questions:

What does inheritance mean? instead of adding four variables again by hand to a class, you can just write class ____ extends Sprite { and the class will inherit all variables and functions from Sprite class Write out Sprite class: Class Sprite { Float x; Float y; Float dx; Float dy; Void update() { X += dx; Y += d; } }

Chapter 33 Questions:

What is a particle system? a technique used in games and physics stimulations that uses a large number of small animated objects to stimulate a larger system, examples are rain, snow, sparks, hair, explosion