This set of Data Science online test focuses on “NumPy – 2”.
1. Which of the following sets the size of the buffer used in ufuncs?
a) bufsize(size)
b) setsize(size)
c) setbufsize(size)
d) all of the mentioned
View Answer
Explanation: Adjusting the size of the buffer may therefore alter the speed at which ufunc calculations of various sorts are completed.
2. Point out the wrong statement.
a) A universal function is a function that operates on ndarrays in an element-by-element fashion
b) In Numpy, universal functions are instances of the numpy.ufunction class
c) Many of the built-in functions are implemented in compiled C code
d) All of the mentioned
View Answer
Explanation: ufunc instances can also be produced using the frompyfunc factory function.
3. Which of the following attribute should be used while checking for type combination input and output?
a) .types
b) .type
c) .class
d) all of the mentioned
View Answer
Explanation: Universal functions in NumPy are flexible enough to have mixed type signatures.
4. Which of the following returns an array of ones with the same shape and type as a given array?
a) all_like
b) ones_like
c) one_alike
d) all of the mentioned
View Answer
Explanation: The optional output arguments of the function can be used to help you save memory for large calculations.
5. Point out the wrong statement.
a) Each universal function takes array inputs and produces array outputs
b) Broadcasting is used throughout NumPy to decide how to handle disparately shaped arrays
c) The output of the ufunc is necessarily an ndarray, if all input arguments are ndarrays
d) All of the mentioned
View Answer
Explanation: The output of the ufunc is not necessarily an ndarray, if all input arguments are not ndarrays.
6. Which of the following set the floating-point error callback function or log object?
a) setter
b) settercall
c) setterstack
d) all of the mentioned
View Answer
Explanation: seterr sets how floating-point errors are handled.
7. Some ufuncs can take output arguments.
a) True
b) False
View Answer
Explanation: All ufuncs can take output arguments. If necessary, output will be cast to the data-type of the provided output array.
8. ___________ decompose the elements of x into mantissa and twos exponent.
a) trunc
b) fmod
c) frexp
d) ldexp
View Answer
Explanation: fmod function return the element-wise remainder of division.
9. Which of the following function take only single value as input?
a) iscomplex
b) minimum
c) fmin
d) all of the mentioned
View Answer
Explanation: iscomplex function returns a bool array, where true if input element is complex.
10. The array object returned by __array_prepare__ is passed to the ufunc for computation.
a) True
b) False
View Answer
Explanation: If the class has an __array_wrap__ method, the returned ndarray result will be passed to that method just before passing control back to the caller.
Sanfoundry Global Education & Learning Series – Data Science.
Here’s the list of Best Books in Data Science.
- Practice Programming MCQs
- Check Programming Books
- Check Data Science Books
- Practice Computer Science MCQs
- Apply for Data Science Internship