What is the output of the following code?
import numpy as np a = np.array([1,2,3,5,8]) b = np.array([0,1,5,4,2]) c = a + b c = c*a print (c[2])
6
24
0
None of these
What will be the output of the following ?
import numpy as np a = np.array( [2, 3, 4, 5] ) b = np.arange(4) print(a+b)
[2 3 4 5]
[3 4 5 6]
[1 2 3 4]
[2 4 6 8]
import numpy as np print(np.maximum([2, 3, 4], [1, 5, 2]))
[1 5 2]
[1 5 4]
[2 3 4]
[2 5 4]
import numpy as np a = np.array([1, 5, 4, 7, 8]) a = a + 1 print(a[1])
4
5
7
import numpy as np a = np.arange(1,5,2) print(a)
[1 3 5]
[1 3]
[1,3]
[1,2,3,4,5]
import numpy as np a = np.arange(5,1) print(a)
[ ]
[1 2 3 4 5]
[5 4 3 2 1]
import numpy as np a = np.arange(1,3,.5) print(a)
[1 2 3]
[1. 1.5 2. 2.5]
[1. 1.5 2. 2.5 3]
[1 1.5 2 2.5 3]
import numpy as np a=np.array([2,4]) b=np.array([3,5]) c=a*b print(c)
[ 2 4 3 5]
[ 6 20]
[ 6 12 10 20]
26
import numpy as np a=np.array([2,4,1]) b=np.array([3,5]) c=a+b print(c)
[2 4 1 3 5 ]
[5 9 1]
15
ValueError
import numpy as np a=np.array([2,4,1]) b=a a[1]=3 print(b)
[2 4 1]
[3 4 1]
[2 3 1]
[2 4 3]
import numpy as np a=np.array([2,4,1]) b=a.copy() a[1]=3 print(b)
Indexed
Sliced
Iterated
All of the mentioned above
We can find the dimension of the array
Size of array
Operational activities on Matrix
None of the mentioned above
What will be the output of following Python code?
import numpy as np a = np.array([(10,20,30)]) print(a.itemsize)
10
9
Guido van Rossum
Travis Oliphant
Wes McKinney
Jim Hugunin
Mathematical and logical operations on arrays.
Fourier transforms and routines for shape manipulation.
Operations related to linear algebra.
All of the above
ndarray
narray
nd_array
darray
np.array([4,5,6])
np.create_array([4,5,6])
np.createArray([4,5,6])
np.numpyArray([4,5,6])
89
[1,2,3,4]
[1,2,3],[3,4,5],[1,3,4]
[[2 3 5][ 4 5 6][4 5 6]]
np.ndim(array_name)
array_name.ndim()
np.dim(array_name)
array_name.dim