Bird
0
0

You have a numpy array of type int16 with values [-32769, 0, 32768]. What will be the stored values after creation?

hard📝 Application Q9 of 15
NumPy - Array Data Types
You have a numpy array of type int16 with values [-32769, 0, 32768]. What will be the stored values after creation?
A[32767, 0, -32768]
B[-32768, 0, 32767]
C[32767, 0, 32768]
D[-32769, 0, -32768]
Step-by-Step Solution
Solution:
  1. Step 1: Understand int16 range

    int16 stores from -32768 to 32767.
  2. Step 2: Handle overflow and underflow

    -32769 underflows to 32767 (wraps around), 32768 overflows to -32768.
  3. Final Answer:

    [32767, 0, -32768] -> Option A
  4. Quick Check:

    int16 overflow/underflow wraps modulo 65536 [OK]
Quick Trick: int16 wraps values outside -32768 to 32767 [OK]
Common Mistakes:
  • Expecting original values stored
  • Ignoring overflow wrap behavior

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes