array attributes

Qus. 1 : <p>What is the output of the following code ?</p><pre>import numpy as np<br>a = np.array([[1,2,3]])<br>print(a.shape)</pre>

  1. (2,3)
  2. (3,1)
  3. (1,3)
  4. None of These
Qus. 2 : <p>What will be output for the following code ?</p><pre>import numpy as np<br>a = np.array([[1, 2, 3],[0,1,4],[11,22,33]])<br>print (a.size)</pre><div><br></div>

  1. 1
  2. 3
  3. 9
  4. 4
Qus. 3 : <p>What will be the output of the following ?</p><pre><span style="font-size: 14px;">import numpy as np<br></span><span style="font-size: 14px;">a = np.array([1, 5, 4, 7, 8])<br></span><span style="font-size: 14px;">a = a + 1<br></span><span style="font-size: 14px;">print(a[1])</span></pre><div><br></div>

  1. 4
  2. 5
  3. 6
  4. 7
Qus. 4 : <p>What will be the output of following Python code?</p><pre>import numpy as np<br>a = np.array([(10,20,30)])<br>print(a.itemsize)</pre><div><br></div>

  1. 10
  2. 9
  3. 4
  4. All of the mentioned above
Qus. 5 : What is a correct syntax to check the number of dimensions in an array?

  1. np.ndim(array_name)
  2. array_name.ndim()
  3. np.dim(array_name)
  4. array_name.dim
Qus. 6 : In NumPy, what does the SHAPE of an array mean?

  1. the shape is the number of rows
  2. the shape is the number of columns
  3. the shape is the number of element in each dimension
  4. Total number of elements in array
Qus. 7 : What is a correct method to join two or more arrays?

  1. np.concatenate()
  2. np.join()
  3. np.array_join()
  4. np.join_array()
Qus. 8 : What are the attributes of numpy array?

  1. shape, dtype, ndim
  2. objects, type, list
  3. objects, non vectorization
  4. Unicode and shape
Qus. 9 : What is the use of shape() in numpy?

  1. change in shape of array
  2. reshaping of array
  3. get the shape of the array
  4. All of above
Qus. 10 : What does size attribute in numpy use to find?

  1. Number of Rows and Column in array
  2. Size of each items in array
  3. Number of elements in array
  4. Largest element of an array
Qus. 11 : <p>What is the output of the following code?</p><pre><span style="font-size: 14px;">import numpy as np a=np.array([1,2,3,5,8]) b=np.array([0,3,4,2,1]) c=a+b c=c*a print(c[2])</span> </pre><div><br></div><div><br></div>

  1. 10
  2. 21
  3. 12
  4. 28
Qus. 12 : <p>What is the output of following code ?</p><pre>a = np.array([[1,2,3],[4,5,6]])<br>print(a.shape)</pre>

  1. (2,3)
  2. (3,2)
  3. (1,1)
  4. none of these
Qus. 13 : <p>What will be output for the following code?</p><pre>import numpy as np<br>a=np.array([[1,2,3],[0,1,4]])<br>print (a.size)</pre><div><br></div>

  1. 1
  2. 5
  3. 6
  4. 4
Qus. 14 : <p>What will be the output of the following ?</p><pre><span style="font-size: 14px;">import numpy as np<br></span><span style="font-size: 14px;">arr=np.array([1,2,3])<br></span><span style="font-size: 14px;">print(arr.shape)</span></pre><div><br></div>

  1. (3,)
  2. (4,)
  3. 1
  4. 3
Qus. 15 : <p>What will be the output of the following code?</p><pre><span style="font-size: 14px;">import numpy as np<br></span><span style="font-size: 14px;">a=np.array([1,2,3])<br></span><span style="font-size: 14px;">print(a.ndim)</span></pre><div><br></div>

  1. 1
  2. 2
  3. 3
  4. 0

Programs

Create a numpy array having two dimensions and shape(3,3) and perform the following operations on array elements:

View Solution


Write a program to find the intersection of two arrays

View Solution


CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad