Bird
0
0

What will the following Python code print on a Raspberry Pi with a connected camera?

medium📝 Predict Output Q4 of 15
Raspberry Pi - Camera Module
What will the following Python code print on a Raspberry Pi with a connected camera?
import picamera
with picamera.PiCamera() as camera:
    camera.resolution = (640, 480)
    print(camera.resolution)
AError: resolution attribute not found
B(640, 480)
C(480, 640)
DNone
Step-by-Step Solution
Solution:
  1. Step 1: Understand the code setting camera resolution

    The code sets the camera resolution to (640, 480) pixels.
  2. Step 2: Print the camera resolution attribute

    Printing camera.resolution outputs the tuple (640, 480) as set.
  3. Final Answer:

    (640, 480) -> Option B
  4. Quick Check:

    Output = (640, 480) [OK]
Quick Trick: camera.resolution shows current resolution tuple [OK]
Common Mistakes:
MISTAKES
  • Swapping width and height values
  • Assuming resolution attribute is missing
  • Expecting None instead of tuple

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes