The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

32
The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200

Transcript of The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Page 1: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

The upper-left corner of a graphics window has the location of:

A. 0,0B. 200,0C. 0,200D. 200,200

Page 2: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

An object is essentially a more complex variable

A. TrueB. False

Page 3: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Objects are complex data types that contain:

A. Only variablesB. Only functionsC. Both variables and functions

Page 4: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Ask the class

• What's the difference between the following:– from graphics import *– import graphics

Page 5: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

What is the value of student1.id?

student1 = Student()student1.id = 5student2 = student1student2.id = 7---A.UndefinedB.5C.7D.Something Else

Page 6: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

In Python conditions, *not equals* is written as "/="

• True• False

Page 7: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Strings are compared by lexographic ordering

• True• False

Page 8: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

A single try statement can catch multiple kinds of errors

• True• False

Page 9: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

There is usually only one correct solution to a problem involving

decision structure

• True• False

Page 10: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

The condition x <= y <= z is valid

• True• False

Page 11: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Input validation means prompting a user when input is required

• True• False

Page 12: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

A statement that controls the execution of other statements is called

A.Boss structureB.Super structureC.Control structureD.Branch

Page 13: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

In Python, the body of a decision is indicated by

A. IndentationB. ParenthesisC. Curly bracesD. A colon

Page 14: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

a and (b or c) == (a and b) or (a and c)

• True• False

Page 15: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

if a > b:

if b > c:

print("Spam Please!")

else:

print("It's a late parrot!")

elif b > c:

print("Cheese Shoppe")

if a >= c:

print("Cheddar")

elif a < c:

print("Gouda")

elif c == b:

print("Swiss")

else:

print("Trees")

if a == b:

print("Chestnut")

else:

print("Larch")

print("Done")

Consider with the following variables: a = 3, b = 5, c = 2

Page 16: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

not(a or b) == (not a) or not(b)

• True• False

Page 17: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

True or False

• True• False

Page 18: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

(True or x) == True

• True• False

Page 19: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

(False and x) == False

• True• False

Page 20: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

(True or False) == True

• True• False

Page 21: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

What does this probably do?

obj.set_water_level(5)

Page 22: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

What does "self" mean?

Page 23: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

What does "self" mean?

• "Self is a reference to the calling object."

• Example: d1.roll()– d1 will be "self"

Page 24: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

What method gets called automatically every time we create an

instance of a new class?

Page 25: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Where do we declare instance (local) variables in a class?

Page 26: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Why don't we pass a "self" in the following example?

class Foo:

def __init__(self, bar):

self.value = bar

f1 = Foo(5)

f1.bar(5)

Page 27: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Why shouldn't we directly modify class variables?

Page 28: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Why shouldn't we directly modify class variables?

• Because we might have special functionality in our set_var(self, value): function that will not get called otherwise.

Page 29: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Give an example of a properly named "accessor" method

Page 30: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Give an example of a properly named "accessor" method

• get_foo(self):

Page 31: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Give an example of a properly named "mutator" method

Page 32: The upper-left corner of a graphics window has the location of: A.0,0 B.200,0 C.0,200 D.200,200.

Give an example of a properly named "mutator" method

• set_foo(self, value):