Home

NumPy Online Question

is a correct syntax to create a NumPy array? (A) np.createArray([1, 2, 3, 4, 5]) (B) np.array([1, 2, 3, 4, 5]) (C) np.object([1, 2, 3, 4, 5])

Which of the following arrays is a two dimensional (2-D) array? (A) 42 (B) [1, 2, 3, 4, 5] (C) [[1, 2, 3], [4, 5, 6]]

is a correct syntax to check the number of dimensions in an array? (A) np.ndim (B) np.ndim() (C) np.dim() (D) np.dim

is a correct syntax to print the first item of an array? (A) print(myArr,1) (B) print(myArr[1]) (C) print(myArr[0])

is a correct syntax to print the number 8 from the array below: arr = np.array([[1,2,3,4,5], [6,7,8,9,10]]) (A) print(arr[7, 2]) (B) print(arr[3, 0]) (C) print(arr[1, 2])

is a correct syntax to print the numbers [3, 4, 5] from the array below: arr = np.array([1,2,3,4,5,6,7]) (A) print(arr[2:4]) (B) print(arr[3:6]) (C) print(arr[2:5]) (D) print(arr[2:6])

Which syntax would print the last 4 numbers from the array below: arr = np.array([1,2,3,4,5,6,7]) (A) print(arr[3:]) (B) print(arr[:4]) (C) print(arr[4]) (D) print(arr[4:])

Which syntax would print every other item from the array below: arr = np.array([1,2,3,4,5,6,7]) (A) print(arr(0: step = 2)) (B) print(arr[::2]) (C) print(arr[1:3:5:7])

is a correct syntax to check the data type of an array? (A) arr.dtype (B) arr.datatype (C) arr.ntype (D) arr.type

When using the NumPy random module, how can you return a random number from 0 to 100? (A) random.randint(100) (B) random.rand(100) (C) random.rand()

NumPy Online Question

is a correct syntax to create an array of type float? (A) arr = np.float([1, 2, 3, 4]) (B) arr = np.array([1, 2, 3, 4]).toFloat() (C) arr = np.array([1, 2, 3, 4], dtype='f')

Only one of the following statements is true when it comes to Views in NumPy, which one? (A) The view SHOULD NOT be affected by the changes made to the original array. (B) The view SHOULD be affected by the changes made to the original array.

Only one of the following statements is true when it comes to Copies in NumPy, which one? (A) The copy SHOULD be affected by the changes made to the original array. (B) The copy SHOULD NOT be affected by the changes made to the original array.

In NumPy, what does the SHAPE of an array mean? (A) The shape is the number of rows. (B) The shape is the number of elements in each dimension. (C) The shape is the number of columns.

is a correct syntax to return the shape of an array? (A) shape(arr) (B) arr.shape() (C) arr.shape

is a correct method to join two or more arrays? (A) array_join() (B) join() (C) concatenate()

is a correct method to split arrays? (A) All the other 3 answers are correct (B) hstack() (C) vstack() (D) array_split()

is a correct method to search for a certain value in an array? (A) search() (B) where() (C) find()

is a correct syntax to return the index of all items that has the value 4 from the array below: arr = np.array([1,4,3,4,5,4,4])? (A) np.where(arr == 4) (B) arr.search(4) (C) arr.where()

is a correct method to sort the elements of an array? (A) sort() (B) order() (C) orderby()

NumPy Online Question

When using the NumPy random module, how can you return a Normal Data Distrbution with 1000 numbers, concentrated around the number 50, with a standard deviation of 0.2? (A) random.normal(size=1000, loc=50, scale=0.2) (B) random.normal(size=1000, normal=50, s=0.1) (C) random.normal(size=1000, mean=50, deviation=0.2)

is a correct syntax to mathematically add the numbers of arr1 to the numbers of arr2? (A) sum(arr1, arr2) (B) np.add(arr1, arr2) (C) np.append(arr1, arr2)

is a correct syntax to subtract the numbers from arr1 with the numbers from arr2? (A) np.substract(arr1, arr2) (B) np.min(arr1, arr2) (C) np.sub(arr1, arr2) (D) np.minus(arr1, arr2)

is a correct method to round decimals in NumPy? (A) All the other 3 are rounding methods in NumPy (B) np.trunc() (C) np.fix() (D) np.around()

would be the answer of this cummulative summation in NumPy? arr = np.array([1,2,3]) print(np.cumsum(arr)) (A) [3 6 9] (B) [9] (C) [1 3 6] (D) [6]