exam questions

Exam 98-381 All Questions

View all questions & answers for the 98-381 exam

Exam 98-381 topic 1 question 25 discussion

Actual exam question from Microsoft's 98-381
Question #: 25
Topic #: 1
[All 98-381 Questions]

You are writing an application that uses the sqrt function. The program must reference the function using the name squareRoot.
You need to import the function.
Which code segment should you use?

  • A. import math.sqrt as squareRoot
  • B. import sqrt from math as squareRoot
  • C. from math import sqrt as squareRoot
  • D. from math.sqrt as squareRoot
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
References: https://infohost.nmt.edu/tcc/help/pubs/python/web/import-statement.html

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
print_HelloWorld
2 years, 11 months ago
CORRECT
upvoted 1 times
...
gargaditya
4 years, 6 months ago
Correct answer,there are only 2 ways in general while importing packages: 1.import math OR import math as m print(m.sqrt(2)) 2.from math import sqrt OR from math import sqrt as squareRoot -->Note here 'function' name is user-defined,in the prev explanation the entire 'package' name was referenced with user defined name print(squareRoot(2))
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago