Unit 6: Image Processing Using Python - Practice Quiz

CAP776 — Programming In Python 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is a digital image mainly made of?

Introduction to digital image processing Easy
A. Functions
B. Commands
C. Pixels
D. Folders

2 What does image resolution commonly describe?

Introduction to digital image processing Easy
A. The image file name
B. The camera brand
C. The number of Python functions used to display the image
D. The number of pixels

3 What does cropping an image do?

Cropping Easy
A. Changes all colors to gray
B. Removes unwanted outer areas
C. Increases every pixel value
D. Rotates the complete image

4 In Pillow, which method is used to crop an image?

Cropping Easy
A. crop()
B. resize()
C. rotate()
D. filter()

5 What happens when an image is resized?

Resizing Easy
A. Its file is automatically deleted after the operation
B. Its dimensions change
C. Its colors are removed
D. Its format always changes

6 Why is aspect ratio often preserved during resizing?

Resizing Easy
A. To detect image edges
B. To prevent image distortion
C. To increase image brightness
D. To convert the image to another programming language

7 Which operation turns an image around a center point?

Rotation Easy
A. Blurring
B. Rotation
C. Cropping
D. Sharpening

8 What does a horizontal flip usually produce?

Flipping Easy
A. A left-to-right mirror image
B. A smaller version of the image
C. A version with improved brightness and contrast settings
D. A top-to-bottom mirror image

9 What does increasing image brightness generally do?

Brightness adjustment Easy
A. Reduces the image dimensions
B. Reverses the image from left to right
C. Makes pixels appear lighter
D. Makes edges appear sharper

10 What does contrast describe in an image?

Contrast adjustment Easy
A. The direction in which the image is flipped
B. The width and height of the image
C. The software library that originally created the image file
D. The difference between light and dark areas

11 Which color model commonly uses red, green, and blue channels?

Color adjustment Easy
A. CMYK
B. RGB
C. Grayscale
D. HSV

12 What is the main purpose of color adjustment?

Color adjustment Easy
A. To rename the image file
B. To modify image colors
C. To change the Python version
D. To calculate the total number of folders containing images

13 Why are filters applied to digital images?

Filtering and enhancement Easy
A. To alter or improve appearance
B. To replace the operating system used by the computer
C. To create Python variables
D. To rename image folders

14 What is a common effect of blurring an image?

Blurring Easy
A. Image dimensions become larger
B. Every edge is identified and assigned a numerical label
C. Fine details become less visible
D. All colors become fully saturated

15 Which filter is commonly used to smooth an image?

Blurring Easy
A. Sharpen filter
B. Gaussian blur
C. Edge detector
D. Color inverter

16 What is the main purpose of image sharpening?

Sharpening Easy
A. To save the image in several different folders automatically
B. To make details more distinct
C. To remove the image border
D. To reduce the image width

17 What does edge detection attempt to locate?

Edge detection Easy
A. Repeated words stored in an image's file name
B. Python installation paths
C. Image file extensions
D. Sharp intensity changes

18 Which OpenCV algorithm is commonly used for edge detection?

Edge detection Easy
A. Gaussian
B. Canny
C. Bilinear
D. Thumbnail

19 Which OpenCV function reads an image from a file?

OpenCV basics Easy
A. cv2.destroyAllWindows()
B. cv2.imread()
C. cv2.resize()
D. cv2.imwrite()

20 Which Pillow statement opens an image file when Image has been imported?

PIL (Pillow) Easy
A. Image.loadfile("photo.jpg")
B. Image.create_and_display_a_new_file("photo.jpg")
C. Image.open("photo.jpg")
D. Image.read("photo.jpg")

21 An uncompressed RGB image has dimensions pixels and uses 8 bits for each color channel. Approximately how much memory is required to store its pixel data?

Introduction to digital image processing Medium
A. 480,000 bytes
B. 2,880,000 bytes
C. 1,440,000 bytes
D. 3,840,000 bytes

22 In Pillow, an image is cropped using image.crop((100, 50, 300, 250)). What are the dimensions of the resulting image?

Cropping Medium
A. 200 × 250 pixels
B. 300 × 250 pixels
C. 200 × 200 pixels
D. 400 × 300 pixels

23 A image must be resized to a width of 450 pixels while preserving its aspect ratio. What should the new height be?

Resizing Medium
A. 400 pixels
B. 350 pixels
C. 300 pixels
D. 250 pixels

24 Which OpenCV interpolation method is generally preferred when substantially reducing an image's dimensions?

Resizing Medium
A. cv2.INTER_LANCZOS4
B. cv2.INTER_AREA
C. cv2.INTER_LINEAR
D. cv2.INTER_CUBIC

25 A rectangular Pillow image is rotated by 45 degrees. Which call best prevents the rotated corners from being clipped?

Rotation Medium
A. image.rotate(45, expand=True)
B. image.rotate(45, expand=False)
C. image.transpose(45)
D. image.resize((45, 45))

26 Which OpenCV statement flips an image vertically, exchanging its top and bottom regions?

Flipping Medium
A. cv2.flip(image, -1)
B. cv2.rotate(image, 0)
C. cv2.flip(image, 1)
D. cv2.flip(image, 0)

27 A grayscale pixel has intensity 230. A brightness operation adds 50 using saturating arithmetic. What is the resulting intensity?

Brightness adjustment Medium
A. 24
B. 230
C. 280
D. 255

28 What is the effect of applying ImageEnhance.Brightness(image).enhance(0.6) in Pillow?

Brightness adjustment Medium
A. The image becomes sharper
B. The image becomes inverted
C. The image becomes more saturated
D. The image becomes darker

29 A contrast transformation is defined by . What happens to pixel values relative to 128?

Contrast adjustment Medium
A. They all increase by 128
B. They all decrease by 128
C. They move farther from 128
D. They move closer to 128

30 Which Pillow expression leaves an image's contrast unchanged?

Contrast adjustment Medium
A. ImageEnhance.Contrast(image).enhance(-1.0)
B. ImageEnhance.Contrast(image).enhance(1.0)
C. ImageEnhance.Contrast(image).enhance(0.0)
D. ImageEnhance.Contrast(image).enhance(2.0)

31 What is the expected result of ImageEnhance.Color(image).enhance(0.0) on an RGB image?

Color adjustment Medium
A. A fully transparent image
B. A color-inverted image
C. A grayscale-looking image
D. A maximum-saturation image

32 Why does a normalized smoothing kernel usually have coefficients whose sum is 1?

Filtering and enhancement Medium
A. To increase image dimensions
B. To detect only diagonal edges
C. To preserve average brightness
D. To reverse image colors

33 Which blur is generally most effective for removing isolated salt-and-pepper noise while preserving edges better than an averaging filter?

Blurring Medium
A. Bilateral blur
B. Median blur
C. Gaussian blur
D. Box blur

34 What is the most likely effect of increasing a Gaussian blur kernel from to while keeping other settings comparable?

Blurring Medium
A. Stronger smoothing of details
B. Larger image dimensions
C. Higher color saturation
D. Sharper high-frequency details

35 In unsharp masking, which expression describes the detail mask that is added back to the original image?

Sharpening Medium
A. blurred - original
B. original * blurred
C. original - blurred
D. original + blurred

36 Before applying cv2.Canny, why is a small Gaussian blur often applied to the grayscale image?

Edge detection Medium
A. To enlarge the output image
B. To equalize all pixel values
C. To reduce noise-generated edges
D. To convert edges into colors

37 In Canny edge detection, what is the role of the two threshold values?

Edge detection Medium
A. They define image width and height
B. They classify strong and weak edges
C. They control hue and saturation ranges
D. They select horizontal and vertical edges

38 A Sobel filter with derivative order dx=1, dy=0 primarily measures which image change?

Edge detection Medium
A. Color saturation across channels
B. Intensity change along the y-axis
C. Intensity change along the x-axis
D. Average intensity in both axes

39 An image loaded using cv2.imread() appears with incorrect colors when displayed using Matplotlib. Which conversion should be performed?

OpenCV basics Medium
A. cv2.cvtColor(image, cv2.COLOR_GRAY2RGB)
B. cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
C. cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
D. cv2.cvtColor(image, cv2.COLOR_BGR2HSV)

40 A Pillow image has size . After image.thumbnail((300, 300)), what is its resulting size?

PIL (Pillow) Medium
A. 300 × 150 pixels
B. 300 × 300 pixels
C. 150 × 300 pixels
D. 600 × 300 pixels

41 A black pixel and a white pixel in an 8-bit sRGB image are averaged to produce a perceptually correct linear-light midpoint. After converting the linear value back to sRGB, what is the approximate output intensity?

Introduction to digital image processing Hard
A.
B.
C.
D.

42 An OpenCV image has shape (120, 160, 3). What region and shape are produced by roi = image[20:80, 30:90]?

Cropping Hard
A. Pixels , ; shape (60, 60, 3)
B. Pixels , ; shape (61, 61, 3)
C. Pixels , ; shape (60, 60, 3)
D. Pixels , ; shape (61, 61, 3)

43 For an RGB Pillow image of size (100, 80), what does image.crop((-10, -5, 30, 25)) return?

Cropping Hard
A. An exception because negative coordinates are prohibited
B. A (30, 25) image after silently clipping the box
C. A (40, 30) image created by reflecting border pixels
D. A (40, 30) image with out-of-bounds areas filled black

44 A one-pixel black-and-white checkerboard is reduced to a much smaller size. Which method best prevents severe aliasing while preserving its average intensity?

Resizing Hard
A. Pixel replication followed by center cropping
B. Nearest-neighbor sampling at destination pixel centers
C. Area averaging after suitable low-pass filtering
D. Bicubic interpolation without any prefiltering

45 A 1920 × 1080 image must fit inside a 500 × 500 box without cropping or distortion. Using one uniform scale factor and rounding the final dimensions to the nearest integers, what size results?

Resizing Hard
A. 500 × 281
B. 500 × 500
C. 281 × 500
D. 889 × 500

46 Ignoring library-specific center rounding, what minimum integer canvas can contain a 100 × 60 image rotated by without cropping?

Rotation Hard
A. 116 × 101
B. 117 × 102
C. 102 × 117
D. 100 × 60

47 An image of width and height is rotated clockwise and then flipped horizontally. Where does an original pixel at appear, using zero-based coordinates?

Flipping Hard
A.
B.
C.
D.

48 A linear brightness operation multiplies each 8-bit channel by and clips values to . What happens to the RGB pixel (80, 160, 220)?

Brightness adjustment Hard
A. It becomes (120, 240, 330)
B. It becomes (120, 240, 255)
C. It becomes (53, 107, 147)
D. It becomes (81, 161, 221)

49 Contrast is adjusted using around a fixed mean . If clipping and rounding are absent, what single factor is equivalent to applying factors and then ?

Contrast adjustment Hard
A.
B.
C.
D.

50 In PIL.ImageEnhance.Color, how should enhancement factors , , and values greater than be interpreted?

Color adjustment Hard
A. preserves color, gives grayscale, and larger values reduce saturation
B. gives grayscale, inverts color, and larger values alter contrast
C. gives grayscale, preserves color, and larger values increase saturation
D. gives black, preserves color, and larger values increase brightness

51 A normalized image is convolved away from its boundaries with the kernel What is its response over a spatially constant region?

Filtering and enhancement Hard
A. The response is the negative intensity
B. The response equals the constant intensity
C. The response is four times the intensity
D. The response is always zero

52 An image is blurred successively with Gaussian kernels having standard deviations and . Assuming ideal Gaussian convolution, what is the equivalent standard deviation?

Blurring Hard
A.
B.
C.
D.

53 A 3 × 3 neighborhood contains eight pixels with value and a center pixel with value . What center value is produced by a 3 × 3 median filter?

Blurring Hard
A.
B.
C.
D.

54 Unsharp masking is defined by , where is a blurred version of . Which statement is correct when clipping is ignored?

Sharpening Hard
A. Constant regions become zero, while all frequencies are amplified equally
B. Constant regions are inverted, while removed high frequencies are attenuated
C. Constant regions are multiplied by , while low frequencies are eliminated
D. Constant regions are preserved, while removed high frequencies are amplified by

55 Using the Sobel kernels what gradient is obtained at the center of a patch whose three rows are all [0, 1, 2]?

Edge detection Hard
A. , with magnitude
B. , with magnitude
C. , with magnitude
D. , with magnitude

56 During Canny hysteresis, a weak edge pixel is above the low threshold but below the high threshold. Under what condition is it normally retained?

Edge detection Hard
A. It lies in a region with nearly constant image intensity
B. It is isolated from all pixels above the high threshold
C. It is connected through candidate edge pixels to a strong edge
D. It has a larger gradient angle than every adjacent pixel

57 A pure red image loaded with cv2.imread() has no alpha channel. What channel triplet represents a red pixel before any color conversion?

OpenCV basics Hard
A. (0, 0, 255)
B. (0, 255, 0)
C. (255, 0, 0)
D. (255, 255, 255)

58 Let a and b be one-element NumPy arrays of type uint8 containing and . How do a - b and cv2.subtract(a, b) differ?

OpenCV basics Hard
A. NumPy produces by saturation; OpenCV produces by wraparound
B. Both produce because unsigned arithmetic always saturates
C. Both produce after automatic conversion to signed integers
D. NumPy produces by wraparound; OpenCV produces by saturation

59 Using straight alpha compositing, an RGBA red pixel (255, 0, 0, 128) is placed over an opaque blue pixel (0, 0, 255, 255). What is the approximate composite pixel?

PIL (Pillow) Hard
A. (255, 0, 255, 128)
B. (255, 0, 127, 255)
C. (128, 0, 127, 255)
D. (127, 0, 128, 128)

60 A JPEG stores its pixels in landscape orientation but contains an EXIF orientation tag requesting a display rotation. What is the safest Pillow operation before coordinate-sensitive cropping?

PIL (Pillow) Hard
A. Convert with image.convert("RGB") after calculating the crop
B. Call image.resize(image.size) to force EXIF interpretation
C. Call image.transpose(Image.Transpose.FLIP_LEFT_RIGHT) after cropping
D. Apply ImageOps.exif_transpose(image) before calculating the crop