Built-ins & Standard Library · Question 4 · Easy

A program starts with the line import math as m. Which call correctly computes the square root of 16?

  1. math.sqrt(16)
  2. sqrt(16)
  3. m.sqrt(16)
  4. m.math.sqrt(16)
Answer and explanation

Answer: C. m.sqrt(16)

Explanation: import math as m binds the module only to the name m. The names math and sqrt are not defined in the program, so both would raise NameError.

Previous: any and all are each given a list containing a mix of truthy and falsy values… · Next: isinstance is given a tuple of types in one call and a single type in the…

Practise built-ins & standard library

Try a fresh set of built-ins & standard library questions with an explanation after every answer, free and without signing up: Built-ins & Standard Library practice. Or sit a full placement mock test.

More built-ins & standard library questions

More python practice

Variables, Types & Operators · Python Strings · Lists & Tuples · Dictionaries & Sets · Conditions & Loops · Functions & Scope · Comprehensions & Generators · Classes & Objects

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge