Bird
0
0

You have a NumPy array arr = np.array([2, 4, 6, 8]). You want to increase each element by 50% using scalar operations. Which code correctly achieves this?

hard📝 Application Q8 of 15
NumPy - Array Operations
You have a NumPy array arr = np.array([2, 4, 6, 8]). You want to increase each element by 50% using scalar operations. Which code correctly achieves this?
Aarr + 50
Barr * 1.5
Carr / 1.5
Darr - 0.5
Step-by-Step Solution
Solution:
  1. Step 1: Understand increasing by 50%

    Increasing by 50% means multiplying by 1.5 (100% + 50%).
  2. Step 2: Evaluate each option

    Only arr * 1.5 correctly increases each element by 50%.
  3. Final Answer:

    arr * 1.5 -> Option B
  4. Quick Check:

    Increase by 50% = multiply by 1.5 [OK]
Quick Trick: Multiply by 1.5 to increase values by 50% [OK]
Common Mistakes:
  • Adding 50 instead of 50%
  • Dividing instead of multiplying
  • Subtracting instead of adding

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes