Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q13 of 15
Python - Modules and Code Organization
What will be the output of this code?
import math as m
print(m.sqrt(16))
A16
B4.0
Csqrt(16)
DError: module not found
Step-by-Step Solution
Solution:
  1. Step 1: Understand alias usage in code

    The math module is imported as 'm', so m.sqrt(16) calls the sqrt function from math.
  2. Step 2: Calculate sqrt(16)

    The square root of 16 is 4.0, so print(m.sqrt(16)) outputs 4.0.
  3. Final Answer:

    4.0 -> Option B
  4. Quick Check:

    m.sqrt(16) = 4.0 [OK]
Quick Trick: Alias calls work like original module calls [OK]
Common Mistakes:
  • Expecting integer 4 instead of float 4.0
  • Confusing alias name with original module name
  • Thinking alias causes import error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes