Strings
Misc
Numbers
Syntax
Random!!
100

What would be the output of the following?

>>> name = 'Mark'
>>> print 'Hello, ' + name

Hello, Mark

100

(True or false) A picture is represented in the computer as a matrix of color values for each pixel in the picture.

True

100

2+2

4

100

What is wrong with the following function?

def addOne(number): print number + 1

Everything is one line / there is no block indentation.

100

What would be the output of the following?

>>> a = 5
>>> b = 8
>>> a == b

False

200

The difference between these three: 

"""

The first and second are interchangeable, the third includes paragraphs

200

What is the numerical representation of the following binary value?


00000100

4

200

What is the outcome of the following?

>>> 7/3

2

200

Which is correct?

if (x==2):
  print "yes"

if (x=2):
  print "yes"

The first, 

if (x==2):
  print "yes"

200

What is wrong with the following?

The context of the variable 'a' is only valid inside the function.

300

The output of:

>>> 'CPS121' * 3

'CPS121CPS121CPS121'

300

A

300

What is the outcome of the following?

>>> (50-5*6)/4

5

300

What would need to change to produce the desired outcome of 2.5?

>>>5 / 2

>>>5.0 / 2.0

or

>>>5.0 / 2 

or 5 / 2.0

300

What would be printed after executing the following line of code?

>>> # print 5 + 5

Nothing!

400

What is the outcome of the following?

>>>word = 'GordonCollege'
>>>word[1:8]

ordonCo

400

Say (or write on the board) the binary representation of the number 16.

00010000

400

>>>x = y = z = 6
>>> x * y        

36

400

Describe what the following line would do:

—for px in getPixels(pic):

This would begin a loop through each pixel in the image (pic).

400

What will be accomplished by the following function?

def mystery(picture):                                  
   for p in getPixels(picture):                        
      setBlue(p, getBlue(p) * 0.7)                
      setGreen(p, getGreen(p) * 0.7)            


The picture will be processed to look like it was taken at sunset.

500

What would the following command give you?

>>>name='Gordon'
>>>len(name)

6

500

Suppose a certain pixel in a picture had the color values:

            Red = 100       Green = 50     Blue = 150

If we converted this picture to grayscale, what would be the Red, Green, and Blue values for this new pixel?

Red = 100       Green = 100     Blue = 100

500

What is the outcome of the following?

>>> '5' + 100

TypeError: cannot concatenate 'str' and 'int' objects

500

What output would you expect from the following?

>>> name = 'GordonCollege'
>>> print name[1:6:2]          

odn

This would process characters 1 through 5 (not including 6), with an increment value of 2.

500

What would be the outcome of the following?

This function will decreases size of the src image by 50% and crop the image.

M
e
n
u