Bird
0
0

What will the following code print?

medium📝 Predict Output Q13 of 15
Raspberry Pi - Camera Module
What will the following code print?
from picamera2 import Picamera2
picam2 = Picamera2()
picam2.start()
print(type(picam2))
picam2.stop()
AError: Picamera2 not defined
B<class 'picamera2.Picamera2'>
C<class 'camera.Picam2'>
DNone
Step-by-Step Solution
Solution:
  1. Step 1: Analyze object creation and type

    The code creates an instance of Picamera2 and prints its type, which should be the class picamera2.Picamera2.
  2. Step 2: Check for errors or output

    Since the import and instantiation are correct, no error occurs. The printed type matches <class 'picamera2.Picamera2'>.
  3. Final Answer:

    <class 'picamera2.Picamera2'> -> Option B
  4. Quick Check:

    type(picam2) = <class 'picamera2.Picamera2'> [OK]
Quick Trick: type() shows the object's class with module name [OK]
Common Mistakes:
MISTAKES
  • Expecting a runtime error due to missing start()
  • Confusing class name or module in output
  • Thinking print outputs None

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes