Bird
0
0

Given this code snippet, what is the error?

medium📝 Debug Q14 of 15
Matplotlib - Image Display
Given this code snippet, what is the error?
import matplotlib.pyplot as plt
import numpy as np
image = np.random.rand(10,10)
plt.imshow(image, interpolation='bicubicc')
plt.show()
Aplt.show() is missing parentheses
BMissing import for numpy
Cimshow does not accept interpolation parameter
DTypo in interpolation method name
Step-by-Step Solution
Solution:
  1. Step 1: Check interpolation parameter spelling

    The string 'bicubicc' has an extra 'c' and is not a valid method.
  2. Step 2: Validate other code parts

    Imports and plt.show() are correct; imshow accepts interpolation parameter.
  3. Final Answer:

    Typo in interpolation method name -> Option D
  4. Quick Check:

    Correct spelling needed for interpolation [OK]
Quick Trick: Check spelling of interpolation strings carefully [OK]
Common Mistakes:
  • Assuming plt.show() missing parentheses
  • Thinking numpy import is missing
  • Believing imshow lacks interpolation parameter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes