Deck 6: Image Processing: Nested for Loops, Functions As Parameters, Namespaces, Lists of Lists
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/33
Play
Full screen (f)
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.
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) 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
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
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)
>>> 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)
>>> 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)
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
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
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
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
>>> 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)
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
>>> 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
>>> 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.
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
-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
-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
-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
-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
>>> 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