CSC 111 Quiz 4, Fall 2006

Submit by Tues November 7 by midnight


Name: First name :
Last name  :
Account name for copy (e.g., 111a-xx):
  
Quiz Code (password):

(Please take this quiz just once, unless you are told that the username or code is incorrect. Write your quiz answers on paper before you hit the Submit Button, in case you enter the wrong quiz password.)

1. What kind of method makes an instance of a class? an instance method
a constructor method
a make method
none of the above.
2. Consider these python statement:
from graphics import *
p = Point(50,100)
pic = Image(p,"darth.gif")
a = pic.getAnchor()
print a.getX()
solow = string.capwords(raw_input("Enter your first name"))what value will printed?
50
75
100
'darth.gif'
None of the above.
3. Consider the python statements:
from graphics import *
p = Point(30,25)
c = Circle(p, 15)
c.move(10,10)
What are the new coordinates of the circle's centerpoint?
30,25
10,10
20,15
none of the above
4. What is the data type of the parameter needed by the Circle class's setFill() method? int
float
boolean
string
none of the above
5. What does this python statement do?:
ell = Line(Point(3,3), Point(56,56))
creates an instance of Line and stores it in ell
draws a Line and stores its position in ell
creates an instance of Point and stores it in ell
none of the above
6. Consider the python code:
from graphics import *
win = GraphWin()
win.setCoords(-20,-20,100,100)
p = Point(-5,-5)
p.draw(win)
Where will the point be drawn in the window?
upper left corner
upper right corner
lower right corner
lower left corner
7. What does the GraphWin method getMouse() return? the location of a Circle object
location of a GraphWin object
location of a Mouse object
location of a Point object
8. Consider the python statements:
def makeGreen(c):
    c.setOutline('green')

def main():
    p = Point(20,20)
    circ = Circle(p, 40)
    makeGreen(circ)
What does the function makeGreen() do?
turns the point p green
changes the radius of circ
sets the outline of circ to green
9. True or False? An object can have more than one defined method. True
False
10. Consider these python statements
from graphics import *
colors = ["blue", "cyan", "yellow"]
c = input("choose a number from 0 to 2: ")
p = Point(20,40)
circ = Circle(p, 10)
circ.setFill(c)
If the user enters 1, what will be the circle's color?
blue
cyan
yellow
none of the above

To submit:

Press to submit your fully-completed quiz, or to reset all fields. Thanks!