SciPy MCQ

2 .
What is a correct syntax to return the mathematical number PI from the constants module, if the module is imported like this :

`from scipy import constants`

Correct Answer : Option (C) :   constants.pi

3 .
What is a correct syntax to a list of all units under the constants module, if the module is imported like this:

`from scipy import constants`

Correct Answer : Option (A) :   dir(constants)

4 .
What will be output for the following code?

``````import numpy as np
print np.linspace(1., 4., 6)``````

Correct Answer : Option (D) :   array([ 1. , 1.6, 2.2, 2.8, 3.4, 4. ])

5 .
What will be output for the following code?

``````from scipy import linalg
import numpy as np
a = np.array([[3, 2, 0], [1, -1, 0], [0, 5, 1]])
b = np.array([2, 4, -1])
x = linalg.solve(a, b)
print x``````

Correct Answer : Option (C) :   array([ 2., -2., 9.])

Explaination : The above program will generate the following output : `array([ 2., -2., 9.])`

6 .
What is a correct syntax to return the speed of sound (in meters per seconds), if the module is imported like this:

`from scipy import constants`

Correct Answer : Option (B) :   constants.speed_of_sound

7 .
What will be output for the following code?

``````import numpy as np
print np.arange(7)``````

Correct Answer : Option (D) :   array([0, 1, 2, 3, 4, 5, 6])

8 .
What will be output for the following code?

``````from scipy.special import logsumexp
import numpy as np
a = np.arange(10)
res = logsumexp(a)
print res``````

Correct Answer : Option (A) :   9.45862974443

9 .
When working with constanst, what would be the result of the following:

`constants.kilo`

Correct Answer : Option (D) :   1000.0

`constants.gram`