Home »
Python »
Python NumPy MCQs
NumPy arrays can be ___
5. NumPy arrays can be ___.
- Indexed
- Sliced
- Iterated
- All of the mentioned above
Answer: D) All of the mentioned above
Explanation:
The index value of an array starts at zero, and each element is referred by the index value of the previous member.
Slicing - Slicing is used when we need to extract a portion of an array from another. This is accomplished by the use of slicing. We can indicate which part of the array should be sliced by using the [start: end] syntax in conjunction with the array name to give the start and end index values.
Iterating - The first axis of a multidimensional array is used to iterate through the arrays, for example.
for x in b:
print(x)