Bird
0
0

What is the output of this code?

medium📝 Predict Output Q13 of 15
Python - Methods and Behavior Definition
What is the output of this code?
def multiply(x, y):
    return x * y

result = multiply(3, 4)
print(result)
A7
B12
C34
DNone
Step-by-Step Solution
Solution:
  1. Step 1: Understand the method call

    The method multiply returns the product of 3 and 4, which is 12.
  2. Step 2: Print the returned value

    The variable result stores 12, so print(result) outputs 12.
  3. Final Answer:

    12 -> Option B
  4. Quick Check:

    3 * 4 = 12 [OK]
Quick Trick: Multiply inputs, return result, print shows it [OK]
Common Mistakes:
  • Adding instead of multiplying
  • Printing None by missing return
  • Confusing string concatenation with multiplication

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes