Deck 6: Image Processing: Nested for Loops, Functions As Parameters, Namespaces, Lists of Lists

Full screen (f)
exit full mode
Question
Resolution is typically expressed as a number of:

A) pixels.
B) megapixels.
C) digital dots.
D) RGB.
Use Space or
up arrow
down arrow
to flip the card.
Question
A color with 255 red intensity, 0 green intensity, and 255 blue intensity will be:

A) magenta.
B) red.
C) blue.
D) white.
Question
How many different color combinations are possible in the RGB color model?

A) 10
B) 255
C) 777,216
D) 16,777,216
Question
What module contains objects that allow us to construct and manipulate pixels?

A) RGB
B) pixelimg
C) cImage
D) pImage
Question
Case Study 1:
>>> p = Pixel(200, 100, 150)
>>> p
(200, 100, 150)
>>> p.getRed()
1. ??????
>>> p.setBlue(20)
>>> p
2. ??????
>>>
-Refer to the session in the accompanying Case Study 1. What is printed on line 1?

A) 200
B) 100
C) 150
D) (200, 100, 20)
Question
Case Study 1:
>>> p = Pixel(200, 100, 150)
>>> p
(200, 100, 150)
>>> p.getRed()
1. ??????
>>> p.setBlue(20)
>>> p
2. ??????
>>>
-Refer to the session in the accompanying Case Study 1. What is printed on line 2?

A) (20, 100, 150)
B) (200, 20, 150)
C) (200, 100, 170)
D) (200, 100, 20)
Question
What statement constructs a window that is 600 pixels wide and 400 pixels high?

A) PixelWin(400, 600)
B) PixelWin(600, 400)
C) ImageWin("Image Processing", 400, 600)
D) ImageWin("Image Processing", 600, 400)
Question
What image object is used to create an image from a file?

A) FileImage
B) PixelImage
C) EmptyImage
D) ImageWin
Question
What method would you use to get the width of an image?

A) getWidth
B) getHeight
C) getPixels("width")
D) width
Question
When creating an empty image, what is the color of each pixel?

A) White
B) Yellow
C) Blue
D) Black
Question
What is the name for the type of iteration shown in the session below?
>>> for num in range(3):
For ch in "cat":
Print(num, ch)

A) Listed
B) Nested
C) Recursive
D) Range
Question
Which of the following is a grayscale color?

A) (1, 2, 3)
B) (30, 30, 30)
C) (0, 20, 20)
D) (255, 0, 0)
Question
Case Study 2:
>>> def squareIt(n):
return n * n
>>> squareIt(3)
9
>>> squareIt(squareIt(3))
1. ??????
>>> squareIt
&It;function squareIt at 0x0000022740D68E18>
>>> z = squareIt
>>> z(3)
9
>>> z
2. ??????
-Refer to the session in the accompanying Case Study 2. What is printed on line 1?

A) 9
B) 81
C) function squareIt at 0x0000022740D68E18
D) An error message
Question
Case Study 2:
>>> def squareIt(n):
return n * n
>>> squareIt(3)
9
>>> squareIt(squareIt(3))
1. ??????
>>> squareIt
&It;function squareIt at 0x0000022740D68E18>
>>> z = squareIt
>>> z(3)
9
>>> z
2. ??????
-Refer to the session in the accompanying case study. What is printed on line 2?

A) 9
B) 81
C) function squareIt at 0x0000022740D68E18
D) An error message
Question
Parameters that are defined within a function are called:

A) actual parameters.
B) formal parameters.
C) passed parameters.
D) assigned parameters.
Question
When a window is constructed, it is not immediately displayed.
Question
We can access a particular pixel by using the getPixel method.
Question
To create a negative pixel, we subtract the red, green, and blue intensities from 255.
Question
In Python, all the names defined in a program, whether for data or for functions, are organized into namespaces.
Question
When a function is invoked, a new namespace known as the function namespace is created corresponding to the function itself.
Question
Match each definition with its term.
-Holds the name of the current namespace.

A) __name__
B) Local variables
C) builtins namespace
D) Edge detection
Question
Match each definition with its term.
-Created within a function.

A) __name__
B) Local variables
C) builtins namespace
D) Edge detection
Question
Match each definition with its term.
-Includes all of the system-defined names of functions and data types used regularly in Python.

A) __name__
B) Local variables
C) builtins namespace
D) Edge detection
Question
Match each definition with its term.
-Tries to extract feature information from an image by finding places in the image that have dramatic changes in color intensity values.

A) __name__
B) Local variables
C) builtins namespace
D) Edge detection
Question
Explain how to create a negative image at the pixel level.
Question
What kinds of operators can be used with a function?
Question
What terms would be used to describe the numbers 3 and 4 in the following code listing? Why?
>>> hypotenuse(3, 4)
5.0
Question
How are parameters passed into a function in Python?
Question
What are the ramifications of the call by assignment parameter in Python? How does program execution differ depending on whether the actual parameter is mutable or immutable?
Question
What are namespaces? Describe the builtins namespace.
Question
How can you discover the names of the objects in the built-in namespace?
Question
Explain how the different Python namespaces are organized with respect to one another.
Question
Provide a description on how you might use a Python program to resize an image.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/33
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 6: Image Processing: Nested for Loops, Functions As Parameters, Namespaces, Lists of Lists
1
Resolution is typically expressed as a number of:

A) pixels.
B) megapixels.
C) digital dots.
D) RGB.
B
2
A color with 255 red intensity, 0 green intensity, and 255 blue intensity will be:

A) magenta.
B) red.
C) blue.
D) white.
A
3
How many different color combinations are possible in the RGB color model?

A) 10
B) 255
C) 777,216
D) 16,777,216
D
4
What module contains objects that allow us to construct and manipulate pixels?

A) RGB
B) pixelimg
C) cImage
D) pImage
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
5
Case Study 1:
>>> p = Pixel(200, 100, 150)
>>> p
(200, 100, 150)
>>> p.getRed()
1. ??????
>>> p.setBlue(20)
>>> p
2. ??????
>>>
-Refer to the session in the accompanying Case Study 1. What is printed on line 1?

A) 200
B) 100
C) 150
D) (200, 100, 20)
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
6
Case Study 1:
>>> p = Pixel(200, 100, 150)
>>> p
(200, 100, 150)
>>> p.getRed()
1. ??????
>>> p.setBlue(20)
>>> p
2. ??????
>>>
-Refer to the session in the accompanying Case Study 1. What is printed on line 2?

A) (20, 100, 150)
B) (200, 20, 150)
C) (200, 100, 170)
D) (200, 100, 20)
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
7
What statement constructs a window that is 600 pixels wide and 400 pixels high?

A) PixelWin(400, 600)
B) PixelWin(600, 400)
C) ImageWin("Image Processing", 400, 600)
D) ImageWin("Image Processing", 600, 400)
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
8
What image object is used to create an image from a file?

A) FileImage
B) PixelImage
C) EmptyImage
D) ImageWin
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
9
What method would you use to get the width of an image?

A) getWidth
B) getHeight
C) getPixels("width")
D) width
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
10
When creating an empty image, what is the color of each pixel?

A) White
B) Yellow
C) Blue
D) Black
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
11
What is the name for the type of iteration shown in the session below?
>>> for num in range(3):
For ch in "cat":
Print(num, ch)

A) Listed
B) Nested
C) Recursive
D) Range
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
12
Which of the following is a grayscale color?

A) (1, 2, 3)
B) (30, 30, 30)
C) (0, 20, 20)
D) (255, 0, 0)
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
13
Case Study 2:
>>> def squareIt(n):
return n * n
>>> squareIt(3)
9
>>> squareIt(squareIt(3))
1. ??????
>>> squareIt
&It;function squareIt at 0x0000022740D68E18>
>>> z = squareIt
>>> z(3)
9
>>> z
2. ??????
-Refer to the session in the accompanying Case Study 2. What is printed on line 1?

A) 9
B) 81
C) function squareIt at 0x0000022740D68E18
D) An error message
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
14
Case Study 2:
>>> def squareIt(n):
return n * n
>>> squareIt(3)
9
>>> squareIt(squareIt(3))
1. ??????
>>> squareIt
&It;function squareIt at 0x0000022740D68E18>
>>> z = squareIt
>>> z(3)
9
>>> z
2. ??????
-Refer to the session in the accompanying case study. What is printed on line 2?

A) 9
B) 81
C) function squareIt at 0x0000022740D68E18
D) An error message
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
15
Parameters that are defined within a function are called:

A) actual parameters.
B) formal parameters.
C) passed parameters.
D) assigned parameters.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
16
When a window is constructed, it is not immediately displayed.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
17
We can access a particular pixel by using the getPixel method.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
18
To create a negative pixel, we subtract the red, green, and blue intensities from 255.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
19
In Python, all the names defined in a program, whether for data or for functions, are organized into namespaces.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
20
When a function is invoked, a new namespace known as the function namespace is created corresponding to the function itself.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
21
Match each definition with its term.
-Holds the name of the current namespace.

A) __name__
B) Local variables
C) builtins namespace
D) Edge detection
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
22
Match each definition with its term.
-Created within a function.

A) __name__
B) Local variables
C) builtins namespace
D) Edge detection
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
23
Match each definition with its term.
-Includes all of the system-defined names of functions and data types used regularly in Python.

A) __name__
B) Local variables
C) builtins namespace
D) Edge detection
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
24
Match each definition with its term.
-Tries to extract feature information from an image by finding places in the image that have dramatic changes in color intensity values.

A) __name__
B) Local variables
C) builtins namespace
D) Edge detection
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
25
Explain how to create a negative image at the pixel level.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
26
What kinds of operators can be used with a function?
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
27
What terms would be used to describe the numbers 3 and 4 in the following code listing? Why?
>>> hypotenuse(3, 4)
5.0
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
28
How are parameters passed into a function in Python?
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
29
What are the ramifications of the call by assignment parameter in Python? How does program execution differ depending on whether the actual parameter is mutable or immutable?
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
30
What are namespaces? Describe the builtins namespace.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
31
How can you discover the names of the objects in the built-in namespace?
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
32
Explain how the different Python namespaces are organized with respect to one another.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
33
Provide a description on how you might use a Python program to resize an image.
Unlock Deck
Unlock for access to all 33 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 33 flashcards in this deck.