Constructors
Destructors
recursive
Nested
Retriever
Finder
Selectors
What is the output of the following code ?
import numpy as np y = np.array([[11, 12, 13, 14], [32, 33, 34, 35]]) print(y.ndim)
1
2
3
0
To make a Matrix with all diagonal element 0
To make a Matrix with first row 0
To make a Matrix with all elements 0
None of the above
import numpy as np a = np.array([[1,2,3]]) print(a.shape)
(2,3)
(3,1)
(1,3)
None of These
What will be output for the following code ?
import numpy as np a = np.array([[1, 2, 3],[0,1,4],[11,22,33]]) print (a.size)
9
4
What will be the output of the following ?
import numpy as np a = np.array([[ 1,2,3,4], [5,6,7,8], [9,10,11,12]]) print(a[2,2])
7
11
10
8
Numbering Python
Number in Python
Numerical Python
Number for Python
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
None of these
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])
5
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