Data Science Questions and Answers – NumPy – 1

This set of Data Science Questions for campus interviews focuses on “NumPy – 1”.

1. Which of the following is contained in NumPy library?
a) n-dimensional array object
b) tools for integrating C/C++ and Fortran code
c) fourier transform
d) all of the mentioned
View Answer

Answer: d
Explanation: NumPy is the fundamental package for scientific computing with Python.

2. Point out the wrong statement.
a) ipython is an enhanced interactive Python shell
b) matplotlib will enable you to plot graphics
c) rPy provides a lot of scientific routines that work on top of NumPy
d) all of the mentioned
View Answer

Answer: c
Explanation: SciPy provides a lot of scientific routines that work on top of NumPy.

3. The ________ function returns its argument with a modified shape, whereas the ________ method modifies the array itself.
a) reshape, resize
b) resize, reshape
c) reshape2, resize
d) all of the mentioned
View Answer

Answer: a
Explanation: If a dimension is given as -1 in a reshaping operation, the other dimensions are automatically calculated.

4. To create sequences of numbers, NumPy provides a function __________ analogous to range that returns arrays instead of lists.
a) arange
b) aspace
c) aline
d) all of the mentioned
View Answer

Answer: a
Explanation: When arange is used with floating point arguments, it is generally not possible to predict the number of elements obtained.

advertisement
advertisement

5. Point out the correct statement.
a) NumPy main object is the homogeneous multidimensional array
b) In Numpy, dimensions are called axes
c) Numpy array class is called ndarray
d) All of the mentioned
View Answer

Answer: d
Explanation: The number of axes is called rank.

6. Which of the following function stacks 1D arrays as columns into a 2D array?
a) row_stack
b) column_stack
c) com_stack
d) all of the mentioned
View Answer

Answer: b
Explanation: column_stack is equivalent to vstack only for 1D arrays.

7. ndarray is also known as the alias array.
a) True
b) False
View Answer

Answer: a
Explanation: numpy.array is not the same as the Standard Python Library class array.array.

8. Which of the following method creates a new array object that looks at the same data?
a) view
b) copy
c) paste
d) all of the mentioned
View Answer

Answer: a
Explanation: The copy method makes a complete copy of the array and its data.

advertisement

9. Which of the following function can be used to combine different vectors so as to obtain the result for each n-uplet?
a) iid_
b) ix_
c) ixd_
d) all of the mentioned
View Answer

Answer: b
Explanation: Length of the 1D boolean array must coincide with the length of the dimension (or axis) you want to slice.

10. ndarray.dataitemSize is the buffer containing the actual elements of the array.
a) True
b) False
View Answer

Answer: a
Explanation: ndarray.data is the buffer containing the actual elements of the array.

advertisement

Sanfoundry Global Education & Learning Series – Data Science.

Here’s the list of Best Books in Data Science.

To practice all areas of Data Science for campus interviews, Here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.