What will be the output of the code given below:

ICSE Class 10 Robotics & AI PYQ · 2025 Specimen · Section A

2(ix)1 Mark · 2025 · Section A · 2025 Specimen

What will be the output of the code given below:

import numpy as np
arr = np.array([1, 2, 3, 4, 5])
print(arr[2])
Show SolutionHide Solution↓
3

In a NumPy array, indexing starts from 0. Therefore, arr[2] accesses the element at index position 2, which is 3.

← Previous questionNext question →

Share on WhatsApp

Browse the free Robotics & AI sample bank