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. Pixels
C. Folders
D. Commands

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. Rotates the complete image
B. Removes unwanted outer areas
C. Changes all colors to gray
D. Increases every pixel value

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

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

5 What happens when an image is resized?

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

6 Why is aspect ratio often preserved during resizing?

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

7 Which operation turns an image around a center point?

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

8 What does a horizontal flip usually produce?

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

9 What does increasing image brightness generally do?

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

10 What does contrast describe in an image?

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

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

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

12 What is the main purpose of color adjustment?

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

13 Why are filters applied to digital images?

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

14 What is a common effect of blurring an image?

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

15 Which filter is commonly used to smooth an image?

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

16 What is the main purpose of image sharpening?

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

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. Thumbnail
B. Bilinear
C. Gaussian
D. Canny

19 Which OpenCV function reads an image from a file?

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

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

PIL (Pillow) Easy
A. Image.read("photo.jpg")
B. Image.open("photo.jpg")
C. Image.create_and_display_a_new_file("photo.jpg")
D. Image.loadfile("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. 3,840,000 bytes
C. 1,440,000 bytes
D. 2,880,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. 400 × 300 pixels
B. 200 × 200 pixels
C. 200 × 250 pixels
D. 300 × 250 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. 250 pixels
B. 400 pixels
C. 300 pixels
D. 350 pixels

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

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

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

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

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

Flipping Medium
A. cv2.flip(image, -1)
B. cv2.flip(image, 0)
C. cv2.flip(image, 1)
D. cv2.rotate(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. 255
B. 280
C. 24
D. 230

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

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

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

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

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

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

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

Color adjustment Medium
A. A maximum-saturation image
B. A fully transparent image
C. A color-inverted image
D. A grayscale-looking 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 reverse image colors
C. To detect only diagonal edges
D. To preserve average brightness

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. Higher color saturation
B. Larger image dimensions
C. Stronger smoothing of details
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. original + blurred
B. original - blurred
C. original * blurred
D. blurred - original

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

Edge detection Medium
A. To reduce noise-generated edges
B. To enlarge the output image
C. To equalize all pixel values
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 control hue and saturation ranges
C. They select horizontal and vertical edges
D. They classify strong and weak edges

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

Edge detection Medium
A. Intensity change along the x-axis
B. Intensity change along the y-axis
C. Color saturation across channels
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_RGB2GRAY)
B. cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
C. cv2.cvtColor(image, cv2.COLOR_GRAY2RGB)
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 × 300 pixels
B. 150 × 300 pixels
C. 600 × 300 pixels
D. 300 × 150 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 (61, 61, 3)
D. Pixels , ; shape (60, 60, 3)

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

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

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. Bicubic interpolation without any prefiltering
C. Area averaging after suitable low-pass filtering
D. Nearest-neighbor sampling at destination pixel centers

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 × 500
B. 281 × 500
C. 889 × 500
D. 500 × 281

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 (53, 107, 147)
B. It becomes (120, 240, 330)
C. It becomes (120, 240, 255)
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. gives grayscale, preserves color, and larger values increase saturation
B. preserves color, gives grayscale, and larger values reduce saturation
C. gives black, preserves color, and larger values increase brightness
D. gives grayscale, inverts color, and larger values alter contrast

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 always zero
B. The response is four times the intensity
C. The response is the negative intensity
D. The response equals the constant intensity

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 are inverted, while removed high frequencies are attenuated
B. Constant regions are multiplied by , while low frequencies are eliminated
C. Constant regions are preserved, while removed high frequencies are amplified by
D. Constant regions become zero, while all frequencies are amplified equally

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 has a larger gradient angle than every adjacent pixel
B. It is isolated from all pixels above the high threshold
C. It lies in a region with nearly constant image intensity
D. It is connected through candidate edge pixels to a strong edge

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, 255, 0)
B. (255, 255, 255)
C. (0, 0, 255)
D. (255, 0, 0)

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. NumPy produces by wraparound; OpenCV produces by saturation
D. Both produce after automatic conversion to signed integers

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, 127, 255)
B. (128, 0, 127, 255)
C. (255, 0, 255, 128)
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