Bird
0
0

What is the output of this Python code simulating a neural network layer?

medium📝 Analysis Q5 of 15
AI for Everyone - How AI Models Actually Work
What is the output of this Python code simulating a neural network layer?
inputs = [2, 5]
weights = [0.1, 0.4]
output = sum(i * w for i, w in zip(inputs, weights))
print(round(output, 1))
A2.0
B2.4
C2.2
D2.6
Step-by-Step Solution
Solution:
  1. Step 1: Multiply inputs by weights

    2 * 0.1 = 0.2 and 5 * 0.4 = 2.0
  2. Step 2: Sum the products

    0.2 + 2.0 = 2.2
  3. Step 3: Round to one decimal place

    2.2 (already one decimal place)
  4. Final Answer:

    2.2 -> Option C
  5. Quick Check:

    Correct weighted sum and rounding [OK]
Quick Trick: Multiply inputs and weights, then sum and round [OK]
Common Mistakes:
  • Rounding before summing
  • Incorrect multiplication
  • Ignoring rounding

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AI for Everyone Quizzes