CS 17700 Study Guide - Final Guide: Alpha CompositingExam
This preview shows half of the first page. to view the full 3 pages of the document.
Q1. What is the name of the function that will display the names of variables in your program?
Q2. The following function will result in a JES error. Why?
A) In line 1 the “:” is missing
B) The commands are not properly indented
C) Parentheses must be removed from line 1
D) A function name can not begin with a capital letter
Q3. Which of the following commands will play the sound of the file "music.wav" ?
B) makeSound (play("music.wav"))
C) makeSound ("music.wav")
D) play ("music.wav")
Q4.The following function is written to change the color of the pixels that have
a white colored bottom neighbor to black. There is something wrong with this function.
What should be the correction?
1 def changeColor(picture):
2 for x in range(0, getWidth(picture)):
3 for y in range(0, getHeight(picture)):
4 pixel = getPixel(picture, x, y)
5 testPixel = getPixel(picture, x, y+1)
6 if(testPixel == white):
7 setColor(pixel, black)
A) change line 3 to: for y in range(0, getHeight(picture)-1):
B) change line 2 to: for x in range(0, getWidth(picture)-1):
C) change line 5 to: testPixel = getPixel(picture, x+1, y)
D) swap white with black in the function
You're Reading a Preview
Unlock to view full version