array creation routines

Qus. 1 : What is the purpose of zeros() function used in NumPy array ?

  1. To make a Matrix with all diagonal element 0
  2. To make a Matrix with first row 0
  3. To make a Matrix with all elements 0
  4. None of the above
Qus. 2 : <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.arange(1,5,2)<br></span><span style="font-size: 14px;">print(a)</span></pre>

  1. [1 3 5]
  2. [1 3]
  3. [1,3]
  4. [1,2,3,4,5]
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.arange(5,1)<br></span><span style="font-size: 14px;">print(a)</span></pre>

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

  1. [2 4 1]
  2. [3 4 1]
  3. [2 3 1]
  4. [2 4 3]
Qus. 5 : What is a correct method to split arrays?

  1. array_split()
  2. split()
  3. split_array()
  4. hstack() and vstack()
Qus. 6 : Regarding creating ndarray, choose the build in functions in numpy.

  1. np.array()
  2. np.zeros()
  3. np.empty()
  4. All of the above
Qus. 7 : What is zeros() function in numpy use to?

  1. make a matrix with first column 0
  2. make a matrix with all elements 0
  3. make a matrix with diagonal elements 0
  4. All of the above
Qus. 8 : empty( ) function used to create a NumPy array which contained the values

  1. Filled with Zero
  2. Filled with Blank space
  3. Filled with random garbage value
  4. Filled with One
Qus. 9 : Which of the following argument we need to pass in reshape function.

  1. Shape
  2. Array
  3. both a) and b)
  4. None of the above.
Qus. 10 : Which of the following returns an array of ones with the same shape and type as a given array?

  1. all_like
  2. ones_like
  3. one_alike
  4. all of the mentioned

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