Bird
0
0

Given this code snippet:

medium📝 Predict Output Q5 of 15
Matplotlib - Image Display
Given this code snippet:
import matplotlib.pyplot as plt
import numpy as np
image = np.array([[0, 1], [1, 0]])
plt.imshow(image, interpolation='bicubic')
plt.show()

What is the expected visual effect compared to interpolation='nearest'?
AEdges will be smoother and colors blended
BEdges will be sharper and blocky
CImage will be displayed upside down
DImage will not display
Step-by-Step Solution
Solution:
  1. Step 1: Understand bicubic interpolation

    Bicubic interpolation smooths edges by blending pixel colors smoothly.
  2. Step 2: Compare with nearest interpolation

    Nearest shows blocky sharp edges, bicubic smooths transitions.
  3. Final Answer:

    Edges will be smoother and colors blended -> Option A
  4. Quick Check:

    Bicubic = smooth edges and blending [OK]
Quick Trick: Bicubic blends pixels for smooth edges [OK]
Common Mistakes:
  • Expecting blocky edges
  • Thinking image flips
  • Assuming image won't show

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes