Arithmetic Operations on numPy Array

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

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

  1. [2 4 1 3 5 ]
  2. [5 9 1]
  3. 15
  4. ValueError
Qus. 3 : <p> What will be output for the following code?</p><pre>import numpy as np<br>ary = np.array([1,2,3,5,8])<br>ary = ary + 1<br>print (ary[1])</pre><div><br></div><p> </p>

  1. 0
  2. 1
  3. 2
  4. 3
Qus. 4 : <p>What will be output for the following code?</p><pre>import numpy as np<br>a = np.array([1,2,3,5,8])<br>b = np.array([0,3,4,2,1])<br>c = a + b<br>c = c*a<br>print (c[2])</pre><p> </p>

  1. 18
  2. 20
  3. 21
  4. 22

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