Bird
0
0

Consider this code snippet applying the KISS principle:

medium📝 Analysis Q13 of 15
Software Engineering - Fundamentals
Consider this code snippet applying the KISS principle:
def calculate_area(radius):
    return 3.14 * radius * radius

area = calculate_area(5)
print(area)

What will be the output?
A31.4
B78.5
CError due to missing import
DNone
Step-by-Step Solution
Solution:
  1. Step 1: Calculate area using formula

    Area = π * radius² = 3.14 * 5 * 5 = 3.14 * 25 = 78.5
  2. Step 2: Check code output

    The function returns 78.5 and print outputs it.
  3. Final Answer:

    78.5 -> Option B
  4. Quick Check:

    3.14 * 25 = 78.5 [OK]
Quick Trick: Multiply π by radius squared for area [OK]
Common Mistakes:
  • Using 2 * π * r (circumference) instead of area formula
  • Expecting error due to missing math module (not needed here)
  • Confusing output with None from missing return

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Software Engineering Quizzes